locked
how to get guid in update event RRS feed

  • Question

  • I'm in Update event, and I can't get the guid, what I want  to do is to update a field but it's necssary to have the guid, any idea about how to retrieve the guid   and update an attribute???

    Thanks a lot!!

    Friday, October 1, 2010 5:02 PM

Answers

  • Use the below code to get the GUID of entity record:

    Guid CourtCaseGuid = ((Lookup)((DynamicEntity)context.InputParameters.Properties["Target"]).Properties["new_courtcaseid"]).Value;

    Hope this helps.


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    • Proposed as answer by Ranjitsingh R Saturday, October 2, 2010 5:02 AM
    • Marked as answer by Jim Glass Jr Saturday, October 2, 2010 8:58 PM
    Saturday, October 2, 2010 5:02 AM

All replies

  • if you are working with plugin you should get it in inputproperty bag.
    Mahain : http://mahenderpal.wordpress.com
    Friday, October 1, 2010 5:11 PM
    Moderator
  • from the inputproperty bag by using "id" you will always get th GUID of the current record.

    it may be any event except the pre create.

     

    Sudhanshu

    • Proposed as answer by yes.sudhanshu Friday, October 1, 2010 6:13 PM
    Friday, October 1, 2010 6:11 PM
  • Use the below code to get the GUID of entity record:

    Guid CourtCaseGuid = ((Lookup)((DynamicEntity)context.InputParameters.Properties["Target"]).Properties["new_courtcaseid"]).Value;

    Hope this helps.


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    • Proposed as answer by Ranjitsingh R Saturday, October 2, 2010 5:02 AM
    • Marked as answer by Jim Glass Jr Saturday, October 2, 2010 8:58 PM
    Saturday, October 2, 2010 5:02 AM
  • use this one (Guid)context.OutputParameters.Properties["id"] to get the GUID except in the pre create , because in that step no guid has been created as the record has not been ccreated.

     

    Sudhanshu

    Saturday, October 2, 2010 6:58 AM