web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

status change workflow triggering twice on service.update

(0) ShareShare
ReportReport
Posted on by 570

Hi,

1. We have a OOB workflow on an entity, it triggers on 'Record Status change'.

To Deactivate the record we are setting value in

status=1, statusreason=2 and calling  service.Update().

We found the record is Deactivated but the workflow triggering two times and in both times the record status showing as 'Inactive'.

Why it is calling 2 times? How can I prevent the 2nd time workflow calling?

2. One more thing I found in Audit History:#

It recorded 2 update events

latest:      Status                Active   InActive

               StatusReason    Active   InActive

   old        Status                Active   Active

                StatusReason    Active   Active

Even the record status is Active-->Active, why it showed me in audit as update?

Thanks

krishna

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Drew Poggemann Profile Picture
    4 on at

    Hi Bala,

    This is not two times, it is showing what is happening in old and new.  Both fields are being updated and this is the way it is reflecting from what I see.

    If your workflow is not checking the status first and calls the update method it will show in audit because that is what happened, you ran an update setting that field and the before and after values are the same.

    Hope this helps.

    Thanks,

  • balakrishna uppala Profile Picture
    570 on at

    1. I didn't understand why it is updated from Active  to Active.

    In our code we just updated record status from Active to Inactive.

    2. Any idea why my workflow triggered twice?

  • Drew Poggemann Profile Picture
    4 on at

    Hi Bala,

    Can you paste the workflow for me to take a look?

    Thanks,

  • balakrishna uppala Profile Picture
    570 on at

    Sorry for late reply!!.

    It is happening for any workflow. I have created a dummy workflow without any logics to test this it is also triggering 2 times, when I deactivate record from c# code using service.update()

  • Drew Poggemann Profile Picture
    4 on at

    The following is only a single workflow execution:

    latest:      Status                Active   InActive

                  StatusReason    Active   InActive

      old        Status                Active   Active

                   StatusReason    Active   Active

    How are you determining it is running twice?

    Thanks,

  • balakrishna uppala Profile Picture
    570 on at

    Hi Drew,

    I just gave the Audit history details to understand more about the issue. But actual issue is it is triggering workflow twice.

    I have created a workflow with no logic in it. It just checks if Status='InActive' stop workflow as success.

    I Deactivated the record from backend using c#  service.update(). I can see the workflow ran twice and it entered into the workflow condition also as Status='InActive'.

  • Suggested answer
    TNS Profile Picture
    1,197 on at

    Hi bala,

       in your record status change just select only one attribute that can be status or status reason....because..if you only choose one also then also the workflow will work fine...

    So, just select one attribute and then try..

    Thanks!

  • balakrishna uppala Profile Picture
    570 on at

    Hi TNS,

    In OOB workflow I am selecting 'Record status changes' we cannot select field here right.

  • TNS Profile Picture
    1,197 on at

    oh sorry! ...forget that..

  • Suggested answer
    Drew Poggemann Profile Picture
    4 on at

    Hi Bala,

    So your trigger on the workflow to execute is on the status change and then you are setting the status in the workflow?  This means it will at least fire twice at a minimum.  Sorry, am I missing something?  Please explain if I am missing it, I would expect this based on your trigger.

    Thanks,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans