calling server-side actions from js in crm? RRS feed

  • Question

  • Hello, I have some js that runs in the context of Workplace > Cases.  When the user selects cases from the subgrid and then clicks a ribbon button, a server-side method needs to be called.  What are my options for this and what is the most proper way to do this in CRM?

    In an MVC app I would use ajax to make an asyncronous call to an MVC controller. In a more generic SOA app I would make an ajax call to a web service that encapsulated the business logic.

    I suppose I could create a custom web service and then call it through ajax.  However, I wasn't sure if CRM provided a more built-in way to do this, such as putting declarative tags on plugins, or using some other specialized class designed to support this scenario?

    Friday, February 21, 2014 1:34 AM

All replies

  • hi

    One way could be to develop a custom workflow activity and include it in CRM UI workflow as a  step.

    Then on ribbon button click you can call this UI workflow, which insteads call the Custom Workflow activity.

    In ribbon button under actions you have property to get guids of selected records in grid.


    If my answer helped you, mark it as answer. This might help someone else in future too.

    Friday, February 21, 2014 9:44 AM
  • How and where is the server-side logic implemented ? If it's a web service, then I'd make an ajax call. If your logic is implemented as a CRM plugin, then you'd need to cause the plugin to fire, which you can do with a call to the CRM web services (either via the REST endpoint if it's a simple CRUD message, or the SOAP endpoint if the plugin is on a message that isn't supported by the REST endpoint)

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Friday, February 21, 2014 7:31 PM
  • What is your scenario? Calling a server-side endpoint is no big thing when you can use CRM's OData endpoint.

    The question is what you need to accomplish...

    If this post is an answer or helpful, please do not forget to vote!

    Monday, February 24, 2014 9:54 PM