locked
Get GUID of new record witin CRM 2011 online RRS feed

  • Question

  • Still struggling....

    I need to get the GUID of a record created by workflow process and have the GUID immediately populated into a field of the new record. For example, record 'A' is created by workflow, and GUID of record 'A' is populated into an attribute of the entity. This exposes the GUID value, perhaps available in atext field, to future workflow processes.

    I can get the GUID via JScript but it requires me to open the relevant form. this is no help for my application. I can also get the GUID of the form for the new reocrd, but again this does not help. I need the GUID of the record created, and I would like it to be available immediately upon creation.

    ???


    Warren Wood
    Tuesday, November 15, 2011 7:32 AM

Answers

  • Hi Warren,

    If I understand correctly, you trying to get the GUID once the new record create, right?

    You need to create a custom workflow activity to return contextservice of the current record ID, register using the plugin registration provided by the SDK, ,then you will be able to select the function in your CRM workflow screen...

    //Get context  
    				IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
    				IWorkflowContext ctx = contextService.Context;
    
    				// Get the record id from the context and pass it back to the output parameter
    				this.RecordID = ctx.PrimaryEntityId.ToString();
    


    Something like above in CRM4... havent convert to CRM2011 yet ;)

    thanks

     


    regards,
    Toong Yang
    http://eastoceantechnical.blogspot.com/
    Tuesday, November 15, 2011 8:24 AM