How to call dynamics crm actions on sdk

Try this code below;


OrganizationRequest oRequest = new OrganizationRequest();
oRequest.RequestName = "action_name";
oRequest["Target"] = new EntityReference("entityname", guid);
oRequest["other_input_parameter"] = "test" // like "name" 

OrganizationResponse orr = service.Execute(oRequest);

#action-call-with-sdk, #actions, #dynamics-365, #dynamics-365-action-call, #dynamics-crm

How to create early bound class for crm?

For this use to CrmSvcUtil.exe. Go to sdk folder (D:\Libraries\MS Dynamics CRM SDK\SDK\Bin) my version 7.1.1.xx

Create a sample bat file, create.bat. Open text editor and put this.

For AD Crm

CrmSvcUtil.exe /url:https://url/organiztionname/XRMServices/2011/Organization.svc    /out:CrmObjects.cs /username:yourusername /password:yourpassword /domain:yourdomain    /namespace:CrmEntityClasses /serviceContextName:CrmEntityContext

For IFD Crm

CrmSvcUtil.exe /url:https://url/XRMServices/2011/Organization.svc     /out:CrmObjects.cs /username:domain\yourusername /password:yourpassword

Run the create.bat file, after then created CrmObjects.cs

Copy to your project and create the context object


CrmEntityClasses.CrmEntityContext  context = new CrmEntityClasses.CrmEntityContext(service)

“service” object must be inherit IOrganizationService !

Lets try to simple code


var list = from z in context.ContactSet select z;

#crm-entity-class, #crmutilsvc, #dynamics-crm, #early-bound, #entity-class

Xrm page ui controls is null or not an object

Xrm.Page.ui.control functions only run this actions (onload, onchange, onsave and onkeypress(2016 feature) ) This functions call in action. If it still does not work, try this methods and check fields.


Xrm.Page.getAttribute("fieldName") or Xrm.Page.getAttribute("fieldName").getValue()

#control-is-null, #crm, #dynamics-crm, #getattribute, #getvalue, #xrm, #xrm-page

MS Dynamic crm region list

MS Dynamic crm region list method


private string GetRegion(string region)
{
if (String.IsNullOrEmpty(region))
{
return string.Empty;
}

RegionList.Add("1", "North America");
RegionList.Add("2", "South America");
RegionList.Add("3", "Canada");
RegionList.Add("4", "EMEA");
RegionList.Add("5", "APAC");
RegionList.Add("6", "Australia");
RegionList.Add("7", "Japan");
RegionList.Add("8", "India");
RegionList.Add("9", "North America");

return RegionList[region];
}

 

#c-sharp, #crm-region-list, #dynamics-crm, #region

MS Dynamics Crm 2016 connection and retrive multiple data

This feature came to ms dynamics crm 2016 SDK and using to Microsoft.Xrm.Tooling.Connector.dll


static void Main(string[] args)
{
    IOrganizationService service;
    CrmServiceClient crmSvc = null;

    crmSvc = new CrmServiceClient(new System.Net.NetworkCredential("username", "password", "domain"), AuthenticationType.AD, "organizationurl", "443", "organizationname", useUniqueInstance: false, useSsl: true);

    service = crmSvc.OrganizationServiceProxy;

    QueryExpression qe = new QueryExpression();
    qe.ColumnSet = new ColumnSet(true);
    qe.EntityName = "account";
    qe.Criteria = new FilterExpression();
    qe.Criteria.AddCondition(new ConditionExpression("name", ConditionOperator.Equal, "huseyin"));

    var list = service.RetrieveMultiple(qe);
}

 

 

#c, #console, #crm, #dynamics-crm, #dynamics-crm-2016, #retrieve-multiple-data-2016