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
Esteban RochaEsteban Rocha 

Create a Parent Case record javaScript Button

Got this script to create a Parent Case when a user clicks on the button. 
The code is fine however what I'm missing here is from the case child record I would like to update the field Parent Case with the Case that it was created from the button.

{!REQUIRESCRIPT('/soap/ajax/41.0/connection.js')} 


var PC= new sforce.SObject('Case'); 

PC.OwnerId = '{!Case.OwnerId }'; 
PC.Status = '{!Case.Status }'; 
PC.Origin= '{!Case.Origin }'; 
PC.Origin_Brand__c= '{!Case.Origin_Brand__c }'; 
PC.Subject= '{!Case.Subject }'; 
PC.Description = '{!JSENCODE( Case.Description )}'; 
PC.Priority= '{!Case.Priority }';
 

result = sforce.connection.create([PC]); 

if(result[0].success == 'true'){ 
alert('The Parent Case was created'); 

Thanks!