Improved update method –Microsoft Dynamics CRM 2015 Update 1


Microsoft Dynamics CRM 2015 Update 1 released some new features that will be very help for developers. In this post we will discuss new improvement in Update method. In earlier version we had different request for the special operations for example AssignRequest for changing owner once record is created, SetStateRequest to change the status of entity record. But now with the release of CRM2015 Update 1 we don’t need to use request (they are deprecated). We can simply apply these operation in the update request only.

For example below is the request to update account record and assign to another user and change status to inactive:

OrganizationService service=GetCrmService();

//Create account object

Entity account=new Entity(“account”);

//set account id

account[“accounted”]=new Guid(“af393105-2a98-407b-9215-6113f19498ad”);

//Assign this record to dev user

account[“ownerid”]=new EntityReference(“systemuser”, new Guid(“af80d7b3-e5e1-4b52-a141-a594f24ee015”);

//set account status to inactive

account[“statecode”]=new OptionSetValue(1);

account[“statuscode”]=new OptionSetValue(2);

//call update method

service.Update(account);

Before: 

Capture1

After:

Capture2

HIMBAP | Need any help in Microsoft CRM 2015 Development Contact US !!

Advertisements

Leave a comment

Filed under MS CRM 2015 Update 1, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s