Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Calling Actions Using Plugins in CRM

Posted on by 2,665

Hi All,

Can anyone tell about few examples on actions in crm.

Here one I am trying example but not able to do.

Below example :

https://deepakexploring.wordpress.com/2013/10/23/actions-in-crm-2013/

public void Execute(IServiceProvider serviceProvider)
{
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(context.UserId);

if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is EntityReference)
{
try
{
EntityReference eventObj = (EntityReference)context.InputParameters["Target"];
string projectName = (string)context.InputParameters["ProjectName"];

if (eventObj != null)
{
//Custom Validation
// Calling the Action
OrganizationRequest req = new OrganizationRequest("ags_CreateProjectUsingAction");
req["ProjectName"] = "This is a test operation for using Actions in CRM 2013 ";
req["Target"] = new EntityReference("ags_event", eventObj.Id);

//execute the request
OrganizationResponse response = service.Execute(req);
}
else return;
}
catch (Exception ex)
{
throw new InvalidPluginExecutionException("An Error occurred in plugin.", ex);
}
}
}

Please suggest anyone ??

Thanks,

Jharana

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,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans