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 :
Microsoft Dynamics CRM (Archived)

Dynamics 365 9.x How to invoke a custom action from C#

(0) ShareShare
ReportReport
Posted on by 152

Hello everyone,

In previous verions of CRM I have been able to execute successfully actions via C# console application or plugins.  But in this scenario, a Dynamics 365 9.x envionment, I am having an issue and I cannot find any answer about it.

I am using the following code to execute the action:

//Define the action as a OrganizationRequest
var targetAction = new OrganizationRequest("actionlogicalname"); // Action logicalName

//Define Input Parameters.Only mandatory parameters are needed for a successful execution, optional parameters can be added too.
targetAction["Inputparameter1"] = "value1";
targetAction["Inputparameter2"] = "value2";
targetAction["Inputparameter3"] = "value3";
targetAction["Inputparameter4"] = "value4";
Console.WriteLine("Input parameters provided sucessfully");

//Execute the action
OrganizationResponse response = service.Execute(targetAction);
Console.WriteLine("Action executed successfully");
Console.ReadKey();

But by any reason, I am experiencing the following issue on the service.Execute(targetAction):  "System.ServiceModel.FaultException`1: 'Required field 'Name' is missing'"

Does anyone have any insight regarding this issue?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Jorge,

    I don't think there is anything change in the way you call custom action between 8.2 & 9.0.

    Just did a quick try from console and it worked fine. Created a global action which take "Name" (string) as an input parameter and create a task with the subject as the paramter value.

    =================

    using (service = new OrganizationServiceProxy(new Uri(_organizationURI), null, _credential, null))

               {

                   var testCustomAction = new OrganizationRequest()

                   {

                       RequestName = "new_TestCustomAction"

                   };

                   testCustomAction.Parameters.Add("Name", "Ravi");

                   service.Execute(testCustomAction);

               }

    ==================

    8764.customaction.png

    Hope this helps.

  • Verified answer
    Jorge Gomez Profile Picture
    152 on at

    Thanks a lot Ravi,

    It is fixed,  the issue was in the action steps definition, it was execution another action with parameters which were not being provided.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans