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)



  • a33ik Profile Picture
    84,325 Most Valuable Professional on at
    RE: Call Action (process) from plugin / debug

    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?

  • Suggested answer
    Bipin D365 Profile Picture
    28,961 Moderator on at
    RE: Call Action (process) from plugin / debug

    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.

  • Suggested answer
    Amit Katariya007 Profile Picture
    10,402 Super User 2025 Season 1 on at
    RE: Call Action (process) from plugin / debug

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

  • haines10 Profile Picture
    5 on at
    RE: Call Action (process) from plugin / debug

    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,402 Super User 2025 Season 1 on at
    RE: Call Action (process) from plugin / debug

    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,758 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans