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

Creating Custom Action to trigger a plugin that is triggered by JavaScript? Custom workflow is better?

(0) ShareShare
ReportReport
Posted on by 20

Hey there.

I have a business problem. I need to execute custom code that sends a JSON object from CRM to an external API. The API will then respond one with 1 useful field I need to bring into CRM and update.

In the past I have used a custom workflow that is triggered by JavaScript to perform what I need. So the flow was JavaScript -> Process -> Within the Process Trigger my Custom Workflow Assembly -> Update the entity field.

However, as I've been reading online people say plugins are more useful? Why is this? I've created a JavaScript -> Custom Action -> Plugin Code... but I can't get good error logging from it in the plug-in trace log. The action has no steps or parameters. I can trigger the plugin code just fine, but it only works in pre-validation because no record or entity is being created/updated/etc... I just was seeing if this pattern was better than custom workflows and it seems like it isn't.

The button that is being clicked is on a subgrid of my entity.

When I go to the plugin trace-log I can find it so I know the plugin is triggering since I can see my tracelogs. However, it doesn't give me the execution start time. As well as I have it throwing an InvalidPluginException in the plugin to try and get an error dialog when I'm viewing the subgrid/view where I click the button and there is no pop up or failed callback from my JavaScript to trigger the action. Is it because the custom action has no output parameter or steps?

My question really is... why do people say plugins are better? If I'm needing to click a button I feel like executing a custom workflow works a whole lot better for my use-case? It seems to be easier to get a failure on your JavaScript call to the workflow/process since you have to add steps in the custom workflow to trigger your custom C# code. As well as you can look at the process audit log a lot easier when you force an InvalidPluginException or just get a general error for troubleshooting not using the plugin profiler (that is buggy and obnoxious to use)

Can anyone potentially fill in my knowledge gap?

I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hello, 

    A custom Workflow meets your needs very well because your logic is executed on demand. 

    Personally I can't compare a custom workflow and a plugin and say that one is better than the other. It depends on the context and the business need.

  • Suggested answer
    Fubar Profile Picture
    2,761 on at

    Need to stop thinking of it as a plugin as its an Action (you have registered your code against the Action - its like calling a custom workflow activity a plugin) it is its akin to other actions like create, update etc.

    Unlike Workflows/and plugins, the Action can accept Inputs and return Output - we use one for making a call to an external service, then receive the results in the JavaScript and format it into a selectable list that the user then selects the item they want - can't do that with a Workflow or Plugin; and we couldn't do it solely in in JavaScript without exposing the Web Service credentials and for this particular service we had a CORS issue if going directly via Ajax (due to their server setup).

    Originally the big thing with them was that they were reusable, and could be called from both Workflows and Plugins - but there are a ton of other uses for them.  

  • Joe99 Profile Picture
    20 on at

    I ended up going with a Custom Workflow over a Custom Action. The reason why is because a Custom Workflow can be found with the Plug-In Profiler. As well as Traces actually show up when you go to the Process's Process Sessions. When you go to your Custom Workflow you are able to see both success and failed runs of the Workflow in the Process Sessions page. It is super helpful to be able to Trace log a custom workflow on success and see all of your variables.

    A Custom Action doesn't do this same behavior. The trace logs do not do anything in the C# code and to get any information you have to purposely throw an exception in the C# code and put whatever variables you want to see in that exception. Custom actions also do not show up in the Plug-In Profiler. It's sort of a nightmare to debug Actions in my opinion.

    Now my new issue is the Plug-In Profiler is giving me a Unable to Load Assembly error, which makes no sense on my Custom Workflow so I'll need to use Trace logs as a workaround.

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