function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RC_48RC_48 

Update field and display message on UI

Hi ,

I have a requirement, if user clicks a button order object field should update and display a message on UI. Please let me know how it can be acheived using New button or Link and VisualForce.. Once i click the button on detail page layout I should update the field and display message on UI.
Best Answer chosen by RC_48
Sai PraveenSai Praveen (Salesforce Developers) 
As the flow is ready Now add this flow as action on the object as shown below.

User-added image
Add the action to the Layout. This action will be availble as button now on record. Here I used Account object and Validate Latest Contact as Checkbox field.

Please modify these according to your requirement.

If this solution helps, Please mark it as best answer.

Thanks,
 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Is there any specific field that should get updated?

We can do it using screenflow. Let me know if you need any help on the screenflow.

Thanks,
K. Sai Praveen Kumar
RC_48RC_48
Hi Praveen,

Yes we have new check box field that should change to true if user clicks the button and display message on UI.

Thanks,
Ragadeep
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Ragadeep,

Create a screenflow as below.

First Create a variable as below to capture the recordid:

User-added image
Drag a Update record action and fill the details as below.

User-added imageUser-added image
Add the Screen Component into the flow and fill the details as below.

User-added imageSearch for Display Text and click on it and give the text message you want and name of the display text as shown below.

User-added image
Now Save the flow and Activate. Continutaion in next comment.

 
Sai PraveenSai Praveen (Salesforce Developers) 
As the flow is ready Now add this flow as action on the object as shown below.

User-added image
Add the action to the Layout. This action will be availble as button now on record. Here I used Account object and Validate Latest Contact as Checkbox field.

Please modify these according to your requirement.

If this solution helps, Please mark it as best answer.

Thanks,
 
This was selected as the best answer
Prerna AgrawalPrerna Agrawal
Hi,

To update a field when user clicks a button on order object, field should update and display a message on UI. Below mentioned steps can be taken into consideration (using javascript)- 

Create a button on order object.
Make it 'detail page button' and select 'execute javascript'.
Copy Paste the below mentioned code.

Code - 
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} 
 
var agree = confirm("Are you sure you want to go ahead?"); 
if(agree){
    var rma = new sforce.SObject("Account");
  rma.id = "{!Account.Id}";
  rma.Date_of_Custom__c = new Date().toISOString();
  rma.Value1__c = "{!User.Name}";

  result = sforce.connection.update([rma]);
debugger;
  console.log('result::',(result));
 if(result[0].success){

  alert('Field Updated Successfully');
}
else{
alert('Error Occurred',result[0].error);

}
}

Thanks,