Sets the state and status of a Microsoft Dynamics CRM record.

Some entities, including Opportunity, require special CRM requests to change their state. This function doesn’t work for those entities.

The SetStateMscrmRecord() function has four parameters:

  • recordGuid (string): Required. The GUID of the record to set the state and status of.
  • entityName (string): Required. The name of the Microsoft Dynamics CRM entity.
  • stateToSet (string): Required. The state to set for the record. Accepted values: active or inactive.
  • statusToSet (string): Required. The status to set for the record. Accepted values: 0, 1, or -1. A value of -1 resets the status to its default value.

This example changes the state of an account to inactive.

The function doesn’t return a value.