Can’t set record Status Reason to default value in CRM Worklfow with Status Transition Rules Enabled

I encountered a weird case when trying to set record status reason to default value on creation of the record in CRM Workflow with Status Transition Rules enabled in the entity configuration. I’ll replicate the case and implement a workaround in my trial CRM Online instance.

Let’s say we need to track payments from customers. Each payment has two statuses “Pending” and “Paid”. When some condition is met, we’ll need to update the status to “Paid”, otherwise update the status to “Pending”. It’s fairly simple. Now, let’s set things up in CRM:

  1. Add status reasons: “Pending”, “Paid”. and set “Pending” default value.status reason.PNG
  2. Enable status transition rules:statustransition.PNG
  3. Create a two options field called “Condition 1” to play as a flag in our workflow.
  4. Create a workflow for the Payment entity:
    • Make it a real-time workflow.
    • Trigger on record creation, and on change of the “Condition 1” field.
    • Add workflow step to check if Condition 1 is Yes, then update status to “Paid”, else update status to “Pending”

workflow

Go ahead and try out the workflow, you’ll see with an existing record, the workflow works fine. However, when you try with a new record, you’ll see followings:

  • With Condition 1 set to Yes, the record can be saved and created with status “Paid”, this works correctly.
  • With Condition 1 set to No, when you save the record you’ll get this error:statuserror.PNG

It’s weird that, the default status is “Pending”, our workflow also tries to set the status to “Pending”, nothing seems to be not valid here. If you set the default status to “Paid” instead, and try again, you’ll get the same error when the workflow tries to set the status to “Paid”. You’ll even get this error when you create a new record using CRM SDK.

My guess is that it’s because of status transition rules. There is no rule allow status from “default value” (in creation) to “default value” (in workflow), in our example from “Pending” to “Pending”. So the workaround is simple, we’ll check if the status is not “default value”, then we can set the status to “default value”.

workflow2.PNG

In conclusion, I’m not sure if it is a bug or expected behavior. But well, it’s just one of weird things in CRM we need to keep in mind. Hope it helps!

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s