+ Start a Discussion

Javascript button cancel button Saves record


Need assistance with Javascript button that should convert record from Record type A to B.  If user clicks the Cancel on the Edit screen, the record is saved anyway.

How do I load the page back to previus view page if user Cancels?

Code below:


var caseObj = new sforce.SObject("Case"); 
caseObj.Id = '{!Case.Id}'; 
caseObj.RecordTypeId = '012D00000003I73'; 
var result = sforce.connection.update([caseObj]); 

if(result.success = 'true'){ 
*I assume the window reload function here?*

*It goes without saying that I'm new to this*

Thanks in advance.
SandhyaSandhya (Salesforce Developers) 
Hi Kaybee011,

I have not tried but seen in some posts that this would work try it if that can help you.

Please refer below links for more information on the simiar requirement.

Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards