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
asdfgasdfg 

Change the Record type using S-Control

Hi All,
            I need to change the record type of the record on the basis of the logged in User and some other conditions, My code works fine if previously the record type was none, but if it had some value then it does not work.

I saw the field level security and the field is editable.

the update result is also success, still not changing th record type.

Code:
var _Test = new sforce.SObject("Test__c");
 _Test.Id = "{!Test__c.Id}";
 _Test.RecordTypeId = "01220000000CskQMAS";
 try
 {
 var TestUpdate = sforce.connection.update([_Test]);
 }
 catch(err)
 {
 alert(err);
 } 
Someone please help.
SteveBowerSteveBower
I don't know that this would be the difference, your code seems right to me on visual inspection, and you can change the recordtype this way (assuming you have all the correct permissions).

Try using the 15 character version of the ID for the recordtype, that's what you get when you query the RecordType table.  Drop the "MAS".  Perhaps that's the issue.

Best, Steve.


asdfgasdfg
Hi Steve,
                I even tried with the 15 digit Id, still no change, do u have any idea about it ?

Thanks in Advance.

Message Edited by asdfg on 11-09-2007 10:46 PM