Showing posts with label Action. Show all posts
Showing posts with label Action. Show all posts

Wednesday, January 22, 2014

MS CRM 2013: How to fix ‘sdkmessage With Id = {} Does Not Exist’ error

This error appears when you are trying to import solution that contains plugin(-s) that handle Action(-s) from one environment to other environment:


In Log file and trace file you can find description of error similar to following:
sdkmessage With Id = a79cef5c-dd82-e311-a344-0800272ad985 Does Not Exist

Source of issue is that Ids of SdkMessage

This issue is well-known, registered on Connect but haven’t been fixed yet.

This article describes workaround that will allow to import such solution.

Thursday, October 31, 2013

Actions: usage of input/output arguments in plugins that handle Actions

Main message is that input/output arguments are available in InputParameters/OutputParameters collections of PluginExecutionContext.

Usage of Input argument
Following code shows how to check that Input Argument was passed and get value:

if (localContext.PluginExecutionContext.InputParameters.Contains("ArgumentName"))
{
    string stringInputArgument = (string)localContext.PluginExecutionContext.InputParameters["ArgumentName"];
}
else
{
    //Your code for case when Argument was not passed
}

Usage of Output argument
Following code shows how to set Output argument:

localContext.PluginExecutionContext.OutputParameters["OutputArgumentName"] = <Value>;

One thing you should remember is that step that handles your action and sets Output arguments had to be registered on Post Operation (40).

For those who use CRM Developer Toolkit – registration of new plugin, registration of your step in code of your plugin and part of RegisterFile.crmregister file:


base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(40, 
    "MessageName", null, new Action<LocalPluginContext>(PluginClass)));

<Step CustomConfiguration="" Name="StepName" Description="Description" Id="024c3b93-6041-e311-ad38-6c3be5a8d218" 
    MessageName="MessageName" Mode="Synchronous" PrimaryEntityName="none" Rank="1" SecureConfiguration="" 
    Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly">

For those who use PluginRegistration tool:

Monday, October 28, 2013

Actions, input parameters and “Object reference not set to an instance of an object” exception

During playing with Actions I wrote simple .Net code that invoked execution of an Action:
slick_CustomActionsTestRequest request = new slick_CustomActionsTestRequest()
{
    BoolInArgument = true,
    DateTimeInArgument = DateTime.Now,
    DecimalInArgument = decimal.Zero
};

slick_CustomActionsTestResponse response = service.Execute(request) as slick_CustomActionsTestResponse;

During testing I have got really weird and unclear error – “Object reference not set to an instance of an object.”:

Sunday, October 27, 2013

Microsoft Dynamics CRM 2013: Actions: deployment of plugins through CRM Developer Toolkit

I played with new version of CRM Developer Toolkit and was not able to find a way to register plugin that handles action using UI. Following post describes workaround how make it possible.

Microsoft Dynamics CRM 2013: Actions walkthrough for .Net and JavaScript developers

I believe that almost every developer for Dynamics CRM faced with scenario when he/she had to invoke some complex logic on a server side, pass parameters and receive a response back. Before CRM 2013 we used workarounds similar to this one. Once Dynamics CRM 2013 was released we have got solution that would not require ‘magic’.