You need to sign in to do that
Don't have an account?
Trigger that gets Old and New Values
Hiya,
I was just wondering if its possible to write a trigger that will be able to post both old and new values of a field (Email) to a URL? E.g Http://superurl.com/bla.aspx?oldemail=123@email.com&newEmail=456@email.com
Im pretty sure i can handle the URL bit with HTTPRequest class.
What im wondering is how to access both new and old values in a trigger? I read around and saw that there is a Trigger.Old process i could use through a for loop, would this work? Could i just have one for loop for the old emails, add them to a list, do the same with new emails then put them both through a for loop that visits the URL?
Any help or pseudocode would be awesome!!! I apologize for not writing any of my own code in here, but im going to attempt it today and post any i can! :)
Thanks
Mike
Edit: So i just realized il need to use @future method because i cant use HTTPRequest while in a trigger :) Meaning il have to pass the old and new triggers values to the class! :)
List<String> oldEmails=new List<String>(); List<String> newEmails=new List<String>(); for (MyType__c oldEle : trigger.old) { oldEmails.add(oldEle.Email_Address__c); newEmails.add(trigger.newMap.get(oldEle.id).Email_Address__c); } // do what you need to with the lists here.