Posts

Showing posts from August, 2025

Run a Dynamics 365 Plugin from JavaScript on Button Click

Image
Trigger a Dynamics 365 Plugin from JavaScript on Button Click In Dynamics 365, plugins usually run when system events happen — like creating, updating, or deleting a record. But in some cases, you might want to run a plugin only when the user clicks a button on a form. This blog will guide you step by step on how to trigger a Dynamics 365 plugin from JavaScript using a Custom Action and a Plugin. Steps to call a plugin from JavaScript   Create a Custom Action Open Advanced Settings → Solutions (or open the specific solution where you want to add the action). Click New in the top menu. Choose Automation → Process. From the process types, pick Action — use an Action when you want to call plugins or custom logic from JavaScript, workflows, or Power Automate. Once you click on Action a Quick Create Process form will open and fill details. After that below form is open and you can update process argument as below. And Activate process. 2. Register the Plugin on the Acti...

Option Field Based on other Field Value using javascript

Image
Option Field Based on Other Field Value using JavaScript Field:   The field must be in Form function filterClientStatusOptions(executionContext) { debugger; var formContext = executionContext.getFormContext();    var tradePartnerStatus = Xrm.Page.getAttribute("dsy_tradepartnerstatus").getValue();    var clientStatusControl = Xrm.Page.getControl("dsy_clientstatus");   var clientStatusAttr = Xrm.Page.getAttribute("dsy_clientstatus"); var allOptions = clientStatusAttr.getOptions();  allOptions.forEach(function(option) {         clientStatusControl.removeOption(option.value);     });   if (tradePartnerStatus == 0) { allOptions.forEach(function(option) {             if (option.value === 780100000) {                 clientStatusControl.addOption(option);             }     if (option.value === 780100001) { ...