You need to sign in to do that
Don't have an account?
Samantha Chua
Custom Button to Generate Case of Specific Record Type
Hi,
I have a snippet of code for a custom button which works great. But issue here is that it only generates the case record type tag to the profile of the current user.
I am trying to get it to create another case record type instead but somehow the case.recordtypeid isnt working. Would appreciate any help or feedback on my snippet of codes here! (:
Regards,
Samantha
I have a snippet of code for a custom button which works great. But issue here is that it only generates the case record type tag to the profile of the current user.
I am trying to get it to create another case record type instead but somehow the case.recordtypeid isnt working. Would appreciate any help or feedback on my snippet of codes here! (:
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} var status = "{!Opportunity.StageName}"; var newRecords = []; if (status == "Closed Won") { var c = new sforce.SObject("Case"); c.RecordType = "0126F000000uanz"; c.AccountId = "{!Opportunity.AccountId}"; c.Type = "{!Opportunity.Type}"; c.Subject = "{!Opportunity.Name}"; newRecords.push(c); result = sforce.connection.create(newRecords); alert ('Case has been created.Please refresh page')} else { alert ('Opportunity must be won before a case can be generated.'); }
Regards,
Samantha
Cheers (:
All Answers
Change
c.RecordType = "0126F000000uanz";
to So your code will be notice the line in bold font
Please let me know if it helps you or you still face issues.
Thanks
Shashikant
You will have to specify the RecordTypeId value on Case object. There is no field exist named as RecordType on Sobjects.
Thanks
Shashikant
Cheers (: