Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Calling a Workflow from JavaScript with no Parameters

Posted on by 6

Hi,

I have a workflow that takes no parameters that is triggered from the a main entity (let's call it "entityfoo").

When you got to the main page for "entityfoo" - I have a button that I want people to be able to click that calls an async workflow that goes off and populates records into "entityfoo".

This workflow is not tied to a specific entity record, it simply populates the list.

How can I call this workflow in D365?  I vaguely remember doing this before using the "Run Workflow" command in the non-unified interface but this doesn't seem possible now.

Is this possible and if not how do I trigger a workflow in this manner?

(It doesn't have to be a button or javascript, happy with whatever can work).

Thank you - Greg.

  • RaviKashyap Profile Picture
    RaviKashyap 55,406 on at
    RE: Calling a Workflow from JavaScript with no Parameters

    If you are looking for "Run Workflow", it has been moved under the Flows which appears when you select an existing record. Refer below screenshot-

    pastedimage1624234993422v1.png

  • Suggested answer
    Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Super User on at
    RE: Calling a Workflow from JavaScript with no Parameters

    It is mandatory to pass record id to trigger workflow. This id must be a GUID of an entity record you had selected while creating your workflow.

    Since the functionality of this workflow is to create records, you can convert the records creation logic from workflow to javascript so that, upon button click, javascript will directly create the records without triggering workflow.

  • IAmGreg Profile Picture
    IAmGreg 6 on at
    RE: Calling a Workflow from JavaScript with no Parameters

    But this requires an entity id to be present.

    In my case, there are no entity records populate, my workflow populates the records.  

    I've tried modifying these code snippets without entity id and they all generate errors.

    My workflow does not require any input parameters.

  • Suggested answer
    Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Super User on at
    RE: Calling a Workflow from JavaScript with no Parameters

    Hi Greg,

    Check below link to trigger workflow from javascript. When the button is clicked, you should be able to get all the selected record IDs and loop through each IDs to trigger workflow.

    www.inogic.com/.../

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans