Hi ,
I am new to skuid and I have an execute javascript button on Courses__c custom object it’s related to Lead.I have tried to write javascript snipet code and I made some changes to my code but it doesn’t work for me. So could you please help me to create custom button in skuid with above code.
And my button code is
{!REQUIRESCRIPT(“/soap/ajax/22.0/connection.js”)}
var updateRecord = new Array();
var myquery = “SELECT Id,Centre__c FROM Lead WHERE Id = ‘{!Lead.Id}’ limit 1”;
result = sforce.connection.query(myquery);
records = result.getArray(“records”);
if(recordsb0].Centre__c==null)
{
alert('Please select Centre on Enquiries ')
}
else{
window.open(“/apex/AddNewCourse?leadId={!Lead.Id}”,“_self”);
}
Thanks.
I’m assuming that your button is on a page title bound to a model that grabs a single lead.
No guarantees but I think your code would look like this
var params = argumentsn0],
$ = skuid.$,
field = argumentsn0],
row = field.row,
centre = row.Centre__c;
lead = row.Leia
if(centre==null)
{
alert('Please select Centre on Enquiries ')
}
else{
var urlString = “/apex/AddNewCourse?leadId=” + lead
window.open(urlString,“_self”);
}
Thanks for the help Rob
I have changed the code like following and it’s working fine
var params = argumentsm0], $ = skuid.$;
var leadModel=skuid.model.getModel(‘LeadDetailQueue’);
alert(“leadModel “+leadModel);
var leadRow=leadModel.getFirstRow();
var centre=leadRow.Centre__c;
var id=leadRow.Id;
if(centre===null)
{
alert('Please select Centre on Enquiries ') ;
}
else{
var urlString = “/apex/c__AddNewCourse?leadId=” + id;
window.open(urlString,”_self”);
}
Deleep
Thanks for posting Deleep. Hope it works successfully for you.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.