+ 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.


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');