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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Call Action (process) from plugin / debug

(0) ShareShare
ReportReport
Posted on by

I am attempting to call a new action from an existing plugin that will then trigger another plugin asynchronously.

My action accepts a number of parameters -
 
SiteSettings - Entity - Input
quoteJson - String - Input
opportunity - Entity - Input
quoteId - String - Input
priceList - Entity - Input

Existing plugin

public class examplePlugin : IPlugin {
    public void Execute(IServiceProvider serviceProvider) {
        // Get tracing service for debugging purposes
        ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
        // Get the context of the message
        IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
        IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
        IOrganizationService dynamicsService = serviceFactory.CreateOrganizationService(context.UserId);
                
        // API name of action is new_bactchProductMapping
        OrganizationRequest req = new OrganizationRequest("new_bactchProductMapping");
        // uses custom entity
        req["SiteSettings"] = siteSettings;
        // uses string
        req["quoteJSON"] = "example string";
        // uses dynamics standard Opportunity entiry
        req["opportunity"] = opportunity;
        // uses string
        req["quoteId"] = "quoteid example";
        // uses dynamics standard priceLlist entiry
        req["priceLlist"] = price_list;
        
        tracingService.Trace("ExamplePlugin - attempt to exicute request");
        
        try
        {
            OrganizationResponse response = dynamicsService.Execute(req);
        }
        catch (FaultException e)
        {
            tracingService.Trace("ExamplePlugin - error = "   e.Message   " - "   e.Reason   " - "   e.StackTrace);
        }
    }
}

when calling the action i am hitting the below error - 

ExamplePlugin - error = new_bactchProductMapping#2011/Organization.svc - new_bactchProductMapping#2011/Organization.svc - at Microsoft.CDSRuntime.SandboxWorker.SandboxCallbackService.<>c__DisplayClass14_0.<ExecuteCallBack>b__0() in C:\source\src\CDS.RunTime.Sandbox.Fabric\Microsoft.CDSRuntime.SandboxWorker\SandboxCallbackService.cs:line 109
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult(ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)
at Microsoft.CDSRuntime.SandboxWorker.SandboxCallbackService.ExecuteCallBack(Func`2 callback, Func`2 HandleClientException) in C:\source\src\CDS.RunTime.Sandbox.Fabric\Microsoft.CDSRuntime.SandboxWorker\SandboxCallbackService.cs:line 88
at Microsoft.CDSRuntime.SandboxWorker.SandboxOrganizationService.Execute(String operation, ByteString serializedRequest, Object traceSettings) in C:\source\src\CDS.RunTime.Sandbox.Fabric\Microsoft.CDSRuntime.SandboxWorker\SandboxOrganizationService.cs:line 47
at Microsoft.CDSRuntime.SandboxWorker.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request) in C:\source\src\CDS.RunTime.Sandbox.Fabric\Microsoft.CDSRuntime.SandboxWorker\SandboxOrganizationServiceWrapper.cs:line 226
at new_Dynamics365_Plugins.ExamplePlugin.Execute(IServiceProvider serviceProvider)



I have the same question (0)
  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at

    Hello RyanCRM ,

    Can also share JS code which is used to call this Action ?

    Also refer below article and try to pass only one entity once and check if it is accepting or not.

    community.dynamics.com/.../814671

    Thank You,

    Amit Katariya

  • haines10 Profile Picture
    5 on at

    Hello Amit,

    I am not calling the Action from JS im calling it from a plugin using the IOrganizationService, i have tried to exicute using a single paramater and am sadly hitting the same issue.

  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at

    Can you also provide more details about the trigger point or when it will be run ?

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Can you try executing custom action from console application to see if it works ?

    I hope you have activated your custom action from UI.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Your code doesn't show how you get SiteSettings, opportunity and pricelist. Please provide that.

    Can you please also provide a screenshot of your action that includes input/output parameters?

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans