Breaking news from around the world
Get the Bing + MSN extension
The views and opinions expressed in this blog are those solely of the author(s) and do not necessarily reflect Microsoft’s current policy, position, or branding. For official announcements and guidance on Dynamics 365 apps and services, please visit the Microsoft Dynamics 365 Blog.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | View virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
A common request amongst our Dynamics CRM Portals customers is the ability to execute custom actions and serverside logic in CRM. There are several ways of communicating with the Dynamics 365 platform:
But it’s still not possible to directly call a custom action from within CRM Portals. Or at least… it wasn’t. We came up with a solution that allows us to call Custom Actions through Liquid.
When communication with Dynamics 365 through Liquid, we’re limited to retrieval only. This is because Liquid only supports Fetch XML. However, we can work around this by creating a new entity, writing a Fetch XML towards that new entity and creating a plugin on the RetrieveMultiple Message of that plugin. While I’m usually very weary of plugins on Retrieve / RetrieveMultiple, in this case it’s absolutely justifiable by the fact that we create a new entity that will solely be used for this purpose.
There’s a couple of things we want to achieve in calling Custom Actions through CRM Portals. We want to send information to CRM, let CRM work with that information and provide us a response, based on the actions it executed. Therefore, there are two important fields that we need to provide in this entity:
Our entity looks like this:
This is the engine of our CRM Portals Custom Action solution. Within the plugin we do a couple of things:
The tricky part here is to parse the filter criteria of the incoming query. We are doing this in the plugin as you can see in the screenshot below.
In the “DoStuff” method you can apply your own logic like triggering Custom Actions, workflows, etc. Afterwards we send a result back to the Portals. We do this by adding a dummy entity to the EntityCollection that is returned in the RetrieveMultiple message. In doing so, the Fetch XML always results in one single result, containing our response message.
This is how our Fetch looks like in Liquid. Of course you can modify this to pass along you own parameters like userid,etc …
notice that we add an additional filter on the date of creation. In this filter we pass the current timestamp. Although this will not impact our results, it ensures that our request will not be cached. We’ve noticed that CRM Portals tend to cache the results of previously executed Liquid queries, which could result in your action not being triggered.
And the response we’re getting (printscreen taken from the XML FetchBuilder):
Ultimately that’s all there is to it. With these three simpel components, we’ve made it possible to trigger custom actions from within CRM Portals.
Het bericht Call a Dynamics 365 Custom Action from CRM Portals verscheen eerst op Thrives.
Business Applications communities