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
RupBRupB 

Custom Button Onclick JavaScript - updated related object

Hi,

 

I have a Task related to a Case. When I set a given Status on the Task, I would like to set a certain flag on the related Case.

JavaScript Onclick is working well for me to update Task fields; can anyone help me update the related Case ?

 

example :

 

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")}var task = {!GETRECORDIDS( $ObjectType.Task )};task.Status = 'CS Decision expected';

 

// FIXME, please :
// case = task.Case;   // get related Case
// case.Flag__c = 'CS Decision requested by plant';   // update flag on Case
// sforce.connection.update(case);
 

var result = sforce.connection.update(task);if (result[0].getBoolean("success"){ window.location.reload();}else{ alert("Error"); 

} 

weraysdtjifrytgweraysdtjifrytg

Hi,

 

did you find a solution to this ??