Skip to content

Instantly share code, notes, and snippets.

@synesthesia
Created February 3, 2017 10:03
Show Gist options
  • Save synesthesia/9a2a32eefc534d03a4b09c8f00097536 to your computer and use it in GitHub Desktop.
Save synesthesia/9a2a32eefc534d03a4b09c8f00097536 to your computer and use it in GitHub Desktop.
Workarounds for CRM set state weirdness - C#
var invoiceEntity = new Entity(Invoice.EntityLogicalName) { Id = invoiceRef.Id };
invoiceEntity["statecode"] = new OptionSetValue((int)InvoiceState.Active);
invoiceEntity["statuscode"] = new OptionSetValue((int)invoice_statuscode.ReadyToIssue);
tracingService.Trace("Update invoice status to Ready To Issue, Id:{0}", invoiceEntity.Id);
service.Update(invoiceEntity);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment