Respondida workflow error

  • Wednesday, January 30, 2013 5:09 AM
     
     

    Hi Everyone,

    I have created a custom workflow and i want to run this workflow on on demand on ribbon button click in dynamic crm 2011. But i m getting error the given key was not present in dictionary. I have usesd target entity in workflow for getting current entity guid.

    Please help me.

All Replies

  • Wednesday, January 30, 2013 7:17 AM
    Moderator
     
     Answered Has Code

    Hello,

    You should not use Target. You should use following code inside your custom workflow activity:

    IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
    IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
    IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
    
    Entity currentEntity = service.Retrieve(context.PrimaryEntityName, context.PrimaryEntityId, new ColumnSet(true));
    


    Freelance Developer for Dynamics CRM 4.0/2011

    • Marked As Answer by Akhileshrajpoot Wednesday, January 30, 2013 11:49 AM
    •  
  • Wednesday, January 30, 2013 11:55 AM
     
     

    Thanks Andrii. Its working now.

    But i have another problem also.

    How to debug a custom workflow. I have already added .pdb and .dll files in server assembly folder .

    I have attached visual remote debugger with CrmAsynch Service.exe but its not working.

    Please help me

  • Wednesday, January 30, 2013 12:17 PM
    Moderator
     
     
  • Thursday, January 31, 2013 4:28 AM
     
     

    Hi Andrii,

    I have used all steps according to above link provided by you but still i am not able to debug custom workflow. But debugger not coming on break point after attaching the crmAsyncService.

    Cold you please help me.

  • Thursday, January 31, 2013 6:54 AM
    Moderator
     
     

    Hi Andrii,

    I have used all steps according to above link provided by you but still i am not able to debug custom workflow. But debugger not coming on break point after attaching the crmAsyncService.

    Cold you please help me.


    This worked for me but doesn't for you. I have only one assumption - that you did something in wrong way. Try to repeat all the steps attentivelly.

    Freelance Developer for Dynamics CRM 4.0/2011

  • Saturday, February 09, 2013 5:13 AM
     
     

    Hi,

    I have created a asp.net webservice. In this service i have created a updatefunction with parameters list and  i want to call this function by crm2011 javascript on page load for update the field of incident entity.

    Please help me how i will call this web service in crm.