Search code examples
c#dynamics-crmdynamics-crm-2013workflow-activity

CRM Custom Action Parameter


Currently I'm working with Dynamics CRM 2015 specially: Custom Actions

I'm able to start my custom action which will create an Invoice from a account.

But I'd like to get that invoice in my code...

I'm starting the "WorkFlow" with

Microsoft.Crm.Sdk.Messages.ExecuteWorkflowRequest request = new Microsoft.Crm.Sdk.Messages.ExecuteWorkflowRequest()
{
    WorkflowId = WorflowId,
    EntityId = xEntity.Id
};    
ExecuteWorkflowResponse xOrganizationResponse = (ExecuteWorkflowResponse)orgSvcContext.Execute(request)

But than the xOrganizationResponse just has 1 attribute which is GUID Empty..

Does anyone knows how to get the Output parameter specified in the custom action?

Here's a screenshot of my custom action: enter image description here


Solution

  • I was now able to get the output parameter like

    OrganizationRequest request = new OrganizationRequest("ise_account_newinvoice_")
    request.Parameters.Add("Target", xAccountReference);
    request.Parameters.Add("invoicenumber", strInvoiceNumber);
    
    OrganizationResponse xResponse = orgSvcContext.Execute(request);
    

    I just needed tho had the "Target" as is in the request.