For every new custom entity created in CRM corresponding SetStateCustomEntityNameRequest and SetStateCustomEntityNameResponse class gets created which we can use to set their status.
In the below example we have set the status inactive for our custom country entity records.
SetStateNew_CountryRequest myCountryRequest = new SetStateNew_CountryRequest();
// guid of the record to be deactivated
myCountryRequest.EntityId = new Guid(“3AE10D22-60E4-DD11-9D85-00164145E126”);
// statecode – 1 , statecodename- Inactive, statuscode – 2, statuscodename – Inactive
// statecode – 0 , statecodename- Inactive, statuscode – 1, statuscodename – Inactive
myCountryRequest.New_CountryState = New_CountryState.Inactive;
myCountryRequest.New_CountryStatus = 2;
SetStateNew_CountryResponse myCountryResponse = (SetStateNew_CountryResponse)crmService.Execute(myCountryRequest);
Bye ..
Hi Nishant,
This is interesting. Need some help for this. Under which step I need to register the plugin?
LikeLike
Hi Nishant,
how does it work using JScript?
Thanks a lot
LikeLike
Hi Nishant
EntityId which you are using in this record is of Individual record or of Account Entity as a whole.
My requirement is to inactivate records based on some criterion.
LikeLike