Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. trigger setGuid on dftly_app_contact__c (before insert) {
  2. For (dftly_app_contact__c dac: Trigger.new){
  3. Blob b = Crypto.GenerateAESKey(128);
  4. String h = EncodingUtil.ConvertTohex(b);
  5. String guid = h.SubString(0,8)+ '-' +
  6. h.SubString(8,12) + '-' +
  7. h.SubString(12,16) + '-' +
  8. h.SubString(16,20) + '-' +
  9. h.substring(20);
  10. system.debug(guid);
  11. dac.Guid_App_Contact__c = guid;
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement