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
nrwingnrwing 

java script - changing opportunity record type and reload page

I have the below code setup for a detail page button/on click execute java script, and it doesn't give any errors, it reloads the page, but it doesn't change the record type at all.  From everything I can find this should work.  Any eyes see what I cannot? 
 
Code:
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var newRecords = []; 
var c = new sforce.SObject("Opportunity"); 
c.id ="{!Opportunity.Id}";
c.RecordTypeId = "01240000000DMIpADO";
newRecords.push(c); 
result = sforce.connection.update(newRecords);
window.location.reload();

 
Thanks a ton in advance!
 
 
Best Answer chosen by Admin (Salesforce Developers) 
nrwingnrwing
Nevermind........stupid error on my part.......I noticed it the second after I posted the question...code is fine......

All Answers

nrwingnrwing
Nevermind........stupid error on my part.......I noticed it the second after I posted the question...code is fine......
This was selected as the best answer
MatsMats

Eh? What was the solution?

 

/Mats