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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Dynamics 365 Unified Interface : Call Workflow with input and output parameter from Javascript

(0) ShareShare
ReportReport
Posted on by 55

Hello Experts,

How can we call the Workflow by sending input parameter and get the output parameter from the custom workflow activity using JavaScript (Xrm.WebApi.online.execute).

I know this is possible using action. Please lt us know your suggestions on the same

Thanks & Regards

Srikanth

I have the same question (0)
  • Suggested answer
    Wahaj Rashid Profile Picture
    11,323 on at

    Hi,

    Thank you for your query.

    It is impossible to pass Input Parameters to a workflow and grab its output in JavaScript. It is not designed in this way.

    Workflows are triggered on an event and take input from Workflow itself (not from calling code).

    As you already mentioned, for this purpose we use Actions.

    Anyhow, if it is necessary to use a workflow, you can do the following:

    • Create fields in the entity for storing input parameter values.
    • In the workflow custom code activity, pass these fields data as parameters.
    • From your JS function, first, update these fields (with the data you need to pass as parameters), save the data, and then call workflow.

    To capture the output, you again need to store it in a field in the entity, so later you can read the value of this field in JS. Also, if the workflow is async (background), it is impossible to catch updated data in the JS (as we are not sure when the workflow will run).

    In my opinion, I do not see why this needs to be done using a workflow, you can re-use the same custom code activity inside Action also, so create an action and use it in the JS.

  • Singapuram Profile Picture
    55 on at

    Wahaj, Thanks a lot for your clear explanation, But I cannot store those values (sensitive data) as a record as I am getting those values from an external service. that's why I am calling Actions from Javascript to send the input parameters to the custom workflow activity.

    How can I debug this custom workflow activity which I am calling this from the action?

    Thanks

    -Sri

  • Suggested answer
    Wahaj Rashid Profile Picture
    11,323 on at

    You are welcome.

    As I mentioned, for this requirement using Action is the right approach.

    You can debug a custom code activity using a plugin profile (same as debugging a plugin):

    Debugging a Custom Workflow Activity in Dynamics 365 and PowerApps - Carl de Souza

    Furthermore, use tracing service to log appropriate messages (which will be shown in the details for action job).

    Logging and tracing (Microsoft Dataverse) - Power Apps | Microsoft Docs

    To make it easier for the other readers, please select appropriate answers as verified (click 'Yes' under 'Did this answer your question?').

  • Singapuram Profile Picture
    55 on at

    I was trying to debug, but here it will show only workflows, not actions. Please suggest.


    pastedimage1626793703378v1.png

  • Suggested answer
    Wahaj Rashid Profile Picture
    11,323 on at

    Hi,

    For the debugging purpose, create a temp workflow and call the action from it (use Perform Action step).

    Then execute the profiler on this temp workflow.

    Otherwise, use tracing to log info and exception to debug.

  • Singapuram Profile Picture
    55 on at

    Thanks, Wahaj for your suggestion!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 196 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans