You need to sign in to do that
Don't have an account?
Javascript Query Custom Button
hey all i need help on getting one of my javascript button to work properly, can someone help me out?? All i am trying to do is redirect a button to new Contact Record page and setting the Record Type Id. I figured out how to query the recordType, but I can't seem to figure it out how to add it to the URL without hardcoding the RecordTypeId. Any input?
{!REQUIRESCRIPT("/soap/ajax/23.0/connection.js")}
var leadRec = sforce.connection.query("select id, Name from RecordType where SObjectType = 'Contact' and Name = 'Standard Contact'");
parent.window.location = "003/e?{!$Label.LeadContactField}={!Lead.Name}&{!$Label.LeadContactField}_lkid={!Lead.Id}&retURL={!Lead.Id}&RecordType="+leadRec.id +"&ent=Contact"
All Answers
{!REQUIRESCRIPT("/soap/ajax/23.0/connection.js")}
var leadRec = sforce.connection.query("select Id, Name from RecordType where SObjectType = 'Contact' and Name = 'Standard Contact'");
parent.window.location = "003/e?{!$Label.LeadContactField}={!Lead.Name}&{!$Label.LeadContactField}_lkid={!Lead.Id}&retURL={!Lead.Id}&RecordType="+leadRec.Id+"&ent=Contact"