Search This Blog

Wednesday, June 18, 2014

Add New Module in CRM 2013 using Sitemap


  • First create new solution and only add sitemap in it.

  •   Export that solution.

  • Extract the solution and then open customization file in any editor. 
  • There is area tag which we call module in CRM like. Sale, service and marketing etc.
  • copy paste full area tag to create new module in CRM. 
  • In this example I add goal,tool,extensions group in new are and name it ProcessArea and instead of Resource Id I add Title: Process Area.


  • Save it and add these three files to zip.

  • Then import solution in CRM and refresh.



 


 
 

Monday, June 2, 2014

Retrieve Record using Odata query filter with GUID of Record



var GroupId = Xrm.Page.data.entity.getId();
var _query = "?$filter=new_GroupId/Id eq (Guid'"+ GroupId +"')";
var obj = RecRetrieveMultiple(_query, 'new_student');

Retrieve Multiple Records Using Odata and Using Soap library


First Download xrmsvctoolkit library from here

Case: Apply code on account form and get account id and use this account id to check how many contacts are against that account id in retrieve multiple using OData.

function get_call()
{             
                var GUIDvalue = Xrm.Page.data.entity.getId();
                //alert(GUIDvalue);
                var lookupObject = Xrm.Page.getAttribute("primarycontactid");
                var lookUpObjectValue = lookupObject.getValue();
                var query = "?$filter=ParentCustomerId/Id eq (Guid'"+GUIDvalue+"')";
                var obj1 = get_Multiple(query,"Contact");
                //var obj1 = get_Multiple(lookUpObjectValue[0].id,"Contact");
                if(obj1==null)
                {
                                alert("I am null");
                }
                else
                {
                                alert(obj1.FullName+"currency : "+obj1.TransactionCurrencyId.type+obj1.TransactionCurrencyId.Name);
                }
                //for (var indx = 0; indx < obj1.length; indx++)
                //{
                                //alert("Name – " + obj1[indx].FullName + " "+"mobile  no: "+obj1.MobilePhone);
                //}
}
function get_Multiple(_query,_entitynames)
{

    XrmSvcToolkit.retrieveMultiple({
        entityName: _entitynames,
        async: false,
        odataQuery: _query,//"?$filter=FirstName eq 'Jim'  and EMailAddress1 eq 'someone@example.com' ",
        successCallback: function (result) {
            contacts = result;
        },
        errorCallback: function (error) {
           alert("Error");
        }
    });
                alert(contacts.length);
    var contact = contacts[0];
                return contact;
}