You need to sign in to do that
Don't have an account?
Shruti Nigam
Hello Actually I want to perform this scenario Create an Assignment_History__c record whenever an Account’s BillingPostalCode is changed. All fields should be populated.
Field Name | Field Type | Description |
Previous Owner | Lookup (User) | The prior sales rep assigned to this Account |
New Owner | Lookup (User) | The new sales rep assigned to this Account |
Previous Territory | Lookup (Territory__c) | The matching Territory__c record for the prior zip code |
New Territory | Lookup (Territory__c) | The matching Territory__c record for the new zip code |
Account | Master-Detail (Account) | The related Account record |
Changed By | Lookup (User) | The user who changed the BillingPostalCode |
you can use porcess builder to cover your task, https://help.salesforce.com/articleView?id=000220643&language=en_US&type=1
if you have any issue,Please tell me.
Kindly MARK AS A BEST ANSWER!!if the reply was helpful.
Regards
Mukesh
If you want to create Assignment_History__c on the update only then here`s the sample code.
You can start with this. If you have any further questions, let me know. P.S.: Mark this as Best Answer if this reply helped you.
Thanks
Shubham Kumar
My bad, i didn`t explain it clearly. You have to use API of Billing Address.
Please try this Code.
Thanks Shubham
As im getting only new owner in my data
Here is my code:
trigger AssignmentHistory5 on Account (before update,after update)
{
List <Assignment_History__c> assign = new List <Assignment_History__c> ();
for(Account a: Trigger.new)
{
if((a.BillingPostalCode!= null) && (a.BillingPostalCode != Trigger.oldMap.get(a.Id).BillingPostalCode))
{
Assignment_History__c assign1 = new Assignment_History__c ();
assign1.Account__c = a.Id;
assign1.NewOwner__c = a.OwnerId;
assign.add(assign1);
System.debug(assign1);
}
}
insert assign;
}
Teacher Student Jokes (https://www.funnyjokesnew.com/2020/02/teacher-student-jokes.html)
Santa Banta Jokes in Hindi (http://https://www.funnyjokesnew.com/2020/02/santa-banta-jokes.html)
Hindi non-veg jokes (https://www.funnyjokesnew.com/2020/01/non-veg-jokes-hindi.html)
Hindi Funny Jokes (https://www.funnyjokesnew.com/2019/11/hindi-jokes28.html)
Download Hindi marvel Movies (https://hotmarvelmovies.blogspot.com/) and also download All hindi marvel movies in HD (https://moviesmarveldownload.blogspot.com/) and also download marvel movies latest (https://allmarvelmoviesdown.blogspot.com/)
Downalod black panther in hindi and HD (https://moviesmarveldownload.blogspot.com/2019/10/black-panther-2018-dual-audio-in-hindi-download-watch-online.html) thor ragnarok Download in Hindi and HD (https://moviesmarveldownload.blogspot.com/2019/10/thor-ragnarok-2017-dual-audio-hindi-dh-download.html)
Moscow Suka Lyrics – Honey Singh, Neha Kakkar (https://songslyricsfree.com/moscow-suka-lyrics-yo-yo-honey-singh/)
Latest hindi Song Lyrics
Hindi Song Lyrics for free
Santa and banta Hindi funny Jokes (https://www.funnyjokesnew.com/santa-banta-jokes/)
REad Hindi funny jokes (https://www.funnyjokesnew.com/)
Rtmnu Question papers (https://eonlinelearners.com/)
trigger AssignmentHistory5 on Account (before update,after update)
{
List <Assignment_History__c> assign = new List <Assignment_History__c> ();
for(Account a: Trigger.new)
{
if((a.BillingPostalCode!= null) && (a.BillingPostalCode != Trigger.oldMap.get(a.Id).BillingPostalCode))
{
Assignment_History__c assign1 = new Assignment_History__c ();
assign1.Previous_Owner__c = Trigger.oldMap.get(a.ID).OwnerId;
assign1.Previous_Territory__c = Trigger.oldMap.get(a.ID).Territory__c;
assign1.Account__c = a.Id;
assign1.NewOwner__c = a.OwnerId;
assign.add(assign1);
System.debug(assign1);
}
}
insert assign;
}