You need to sign in to do that
Don't have an account?
Ravichandra sindhe
Need help for the below scenario with sample code
Example :
1.Update a phone number to backend
2.once successfull response comes from backend.
3.take the 'oldphone' and 'newphone'number value(planning to use trigger).
4.put both old and new phone number values in an array.
5.pass it to a table to form a note text.
note text will be like 'Phone number chnaged from %Oldphone% to %newPhone%'
once the text updated with phone values.
update the text to backend
'
Having some queries on your requirement.
1.How you updating your mobile number? either throught Standard UI or Custom lightning component.
2. Do you need to Store the text in one of the text field in the object right? If so, then if phone number is updated multiple times, How do you want record those phone number changing?
3. Do you want to save this text into the text field of the object "Phone number chnaged from %Oldphone% to %newPhone%"?
PFB the below code that save the mobile number changing into text field of the object.
To show the same thing in UI, you can use toast Message if you are using lightning components.
Example code using Account Object.
If it helps, Mark it as the best answer. If not, comment below the requirement little more detail. We will discuss.
Regards,
Navin
All Answers
Having some queries on your requirement.
1.How you updating your mobile number? either throught Standard UI or Custom lightning component.
2. Do you need to Store the text in one of the text field in the object right? If so, then if phone number is updated multiple times, How do you want record those phone number changing?
3. Do you want to save this text into the text field of the object "Phone number chnaged from %Oldphone% to %newPhone%"?
PFB the below code that save the mobile number changing into text field of the object.
To show the same thing in UI, you can use toast Message if you are using lightning components.
Example code using Account Object.
If it helps, Mark it as the best answer. If not, comment below the requirement little more detail. We will discuss.
Regards,
Navin
Hey Naveen,
thanks a lot for the response.
but one question is...instead of forming a text in code as below
accountObj.Phone_Number_Update_Details = 'Phone number changed from' +Trigger.oldMap.get(accountObj.Id).Phone + 'to' + Trigger.newMap.get(accountObj.Id).Phone;
can we plan to put the standard text in a data table
say like
messageID:Phonetext
messagetext:phone number chnaged from %oldphonevalue% to%newvalue%
and place the values
and answering your questions
1.How you updating your mobile number? either throught Standard UI or Custom lightning component.
Lightning component
2. Do you need to Store the text in one of the text field in the object right? If so, then if phone number is updated multiple times, How do you want record those phone number changing?
i do not want t record but just want to place the phone number values in those variable(messagetext:phone number chnaged from %oldphonevalue% to%newvalue%) and update the text to backend everytime phoner number changes(say backend is FDR(First data resourse)).
>i take the text having old and new values.
>Do a API call out by forming a JSON formate with text
>update it to FDR(anyway all saved values in FDR will be insink with Account record)
3. Do you want to save this text into the text field of the object "Phone number chnaged from %Oldphone% to %newPhone%"?
as i said above..no need to save,
If you are using lightning component, then there is no need to go for the trigger. While reteriving the data from apex controller, in Wrapper you can have the current phone number of the record as one seperate variable along with the record you are returning. Then once you changed the phone number and save the record. If the successful result returns, then you can show that message you need. Its all about how we are implementing. Doing more operations on the client side will give the better performance of the application.
Best Regards,
Navin S
Hey Navin...sorry to bother
do you have any APEX call out example,Please provide me me if you have any.
thanks in advance