Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

WebApi change quote status, multiple status changes

$
0
0

I had an issue with a workflow running three times. I've check the audit history and I did see that the status was changed three times when I made a REST call to change te status (from draft -> draft -> active -> active). 

I send a PATCH request to the rest endpoint to change the status and I was setting the statecode=1 and statuscode=2. This resulted in setting the quote active twice. 

Now I've changed it to only statecode=1.  And there's only one record in the log of setting the quote active. However, just before the quote is set active, it's first updated to Draft, a status it already had. Because CRM detects both status changes, the workflow is triggered twice. In my workflow I do check if the status is active, but because it's after the event (for a synchronous workflow) or an async workflow, it will check the status of the quote en for both workflows it's active.

I've checked when I make the REST call outside of CRM, and I see that the status is changed twice (draft -> draft, and draft -> active). So the underlying cause is the REST call.

When I check how to change the status with JavaScript, most references I get use SOAP with SetStateRequest, however I don't want to use SOAP. And the SetStateRequest is not available for the webapi.

Any ideas on how to solve this? For the user experience I would really like to change status with JS.


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>