Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. List<EntitySubscription> subscription = new List <EntitySubscription>();
  2. for (Story__c str:story) {
  3. if(str.Owner__c != NULL){
  4. subscription.add(New EntitySubscription(ParentID = str.Id,SubscriberId = str.Owner__c));
  5. }
  6. }
  7. try{
  8. Database.insert(subscription);
  9. }
  10. catch (DMLException dmlEx){
  11. if (dmlEx.getDmlType(0)==statusCode.Duplicate_Value) {
  12. System.Debug('DevOwnerChatSub: subscription already exists');
  13. } else{
  14. throw dmlEx;
  15. }
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement