You need to sign in to do that
Don't have an account?
SF_DEV_CDE
Trigger to update a Looup field ,with Text Field Value
Hi All
Need help on Trigger ,
My scenario is : I have a text field(jobNumber) and a Lookup Field(Job),Job field to be updated by Job Number (Need to get a name of the Number in the lookup)and It contains more than one value(normally it contains jobnumber1;jobnumber2;jobnumber3; etc),needs to update lookup field with the first value of Job Number.
You can write a before update/insert trigger, that will query Job record for Job number and do the update.
Something like this
Note : you need to bulkify this if using in Trigger.
Got the point , but I wil have bulk inserts and bulk updates and that text field contains more than one value like as 123455;123457;154332; etcso I need to get only the first value 123455 in to the lookup field , any idea to get that value and look for the name of that using SFDC ID and updating in lookup field
Hi,
Store that text field value inside a string and use split method find that first value.Try the below code as reference:
String st='123455;123457;154332';
String[] st1=st.split(';');
System.debug('@@@@@@@@@@@@@'+ st1[0]);
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi
I splitted it but i need to split all the inserted records at a time and I need to get this first values's SFDC ID and update the lookup ,how can i do this?