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)

how to identify proper workflow id?

(0) ShareShare
ReportReport
Posted on by

Hello, I've created a new on-demand workflow named "MyWorkflow" and I need to execute this from js. I found SDK.SAMPLES.ExecuteWorkflowRequest js which I plan to use for this purpose.  As part of this process I need to specify the w/f id. I ran the following query to identify the lookup table for this:

select * from information_schema.tables
where table_name like '%workflow%'

Workflow/WorkflowBase seem to be the proper lookups for this. However, WorkflowBase returns 2 rows that have different WorkflowId's but which have a matching workflow name of "MyWorkflow." So how can I decide which row to use? I noticed the following data pattern:

Match #1: ActiveWorkflowId is not null, ParentWorkflowId is null
Match #2: ActiveWorkflowId is null, ParentWorkflowId is not null

So my first impression is to go with the WorkflowId for Match #1. Is that the correct choice?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Karth Profile Picture
    on at

    How about retrieving the workflow ID from the workflow form URL?

    For example - --https://myorg.crm.dynamics.com/sfa/workflow/edit.aspx?id=%7b44A1722A-2D32-4065-803D-9472126BB4E4%7d

  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    Karth is absolutely right, you can get the Id by CRM UI:

  • Verified answer
    ScottDurow Profile Picture
    21 on at

    Hi,

    If you need to get the ID dynamically from the workflow name you can do this using the REST endpoint - see sliong.wordpress.com/.../crm-2011-runningexecuting-workflow-using-javascript

    You could a library such as the XrmSvcToolkit or XrmServiceToolkit to easily execute this REST request:

    "WorkflowSet?$select=WorkflowId&$filter=StateCode/Value eq 1 and ParentWorkflowId/Id eq null and Name eq \'' + workflowName + "\"

    This would only really be needed if you have a situation when you only know the name - if you create a workflow and add it to a solution, it will always maintain the same ID when deployed to another organization so it's ok to hard code the ID.

    Hope this helps,

    Scott

  • Suggested answer
    Vipin J Profile Picture
    1,603 on at

    The context, where you mentioned about Match #1 and Match #2 is correct.

    I was also looking for some answers, as I wanted to cancel the waiting workflows (specific one) for some business scenario and found that there are multiple workflows of same name.

    They get created as when we activate and deactivate them.

    I have written a blog around this, hope it might help you.

    http://vjcity.blogspot.in/2017/12/cancel-workflow-using-javascript-and.html

    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