• Nikhil Jaitly
  • 0 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1
I am very new to Apex, hence could use some help.
I want to write a trigger for the following scenario :
'Account and Contact are 2 sObjects. A custom field has to be created in Account, which should capture the No. of Contacts in Contact sObject.(a new Contact created, any Contact deleted or an existing Contact updated, should be considered separate events for the trigger).


I want to concatenate two object IDs in order to make a hash value for a map, but this doesn't work:


conversionMap.put(entry.Pricebook2Id + entry.Product2Id), entry);

If I could convert the IDs to strings first, then I should be able to concatenate them in this way.  But, while there is a function to convert a string to an ID, I can't find any way to convert an ID to a string.  Anybody know how to do that?  Or, a better way to do what I'm trying to do?