In Package Manager Console, type :
Install-Package -Id Microsoft.CrmSdk.CoreTools -ProjectName FashionCompany.TestImportConsoleApplication -Version 7.0.1
joi, 21 mai 2015
marți, 5 mai 2015
Using Update in CRM 2015 to set the State and Status of entities
Today I managed to waste at least one hour, because I tried to use a new feature from the SDK of 2015.
Basically, I tried to create a simple account, then deactivate it.
the code :
Entity account = new Entity("account");
account["name"] = "FreeAcademy";
Guid id = CrmOrganizationService.Create(account);
account["accountid"] = id;
account["statecode"] = new OptionSetValue(1); // inactive
account["statuscode"] = new OptionSetValue(2);
CrmOrganizationService.Update(account);
I received a nice exception message :
2 is not a valid status code for state code AccountState.Active on account with Id 7f21fa89-45f3-e411-9430-005056bd3a00.
On MSDN, it says like this : For Microsoft Dynamics CRM Online organizations, this feature is available only if your organization has updated to Dynamics CRM Online 2015 Update 1. This feature is not available for Dynamics CRM (on-premises).
So, take into account that if you are using an On-premise deployment, the piece of code from above will not work.
Happy Coding !
Basically, I tried to create a simple account, then deactivate it.
the code :
Entity account = new Entity("account");
account["name"] = "FreeAcademy";
Guid id = CrmOrganizationService.Create(account);
account["accountid"] = id;
account["statecode"] = new OptionSetValue(1); // inactive
account["statuscode"] = new OptionSetValue(2);
CrmOrganizationService.Update(account);
I received a nice exception message :
2 is not a valid status code for state code AccountState.Active on account with Id 7f21fa89-45f3-e411-9430-005056bd3a00.
On MSDN, it says like this : For Microsoft Dynamics CRM Online organizations, this feature is available only if your organization has updated to Dynamics CRM Online 2015 Update 1. This feature is not available for Dynamics CRM (on-premises).
So, take into account that if you are using an On-premise deployment, the piece of code from above will not work.
Happy Coding !
Abonați-vă la:
Postări (Atom)