Could any one help me to change salesforce Javascript execute button to Skuid custom button ?

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


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”);

alert('Please select Centre on Enquiries ')


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 = arguments[0],
$ = skuid.$,
field = arguments[0],
row = field.row,
centre = row.Centre__c;
lead = row.Leia

alert('Please select Centre on Enquiries ') 

var urlString = “/apex/AddNewCourse?leadId=” + lead,“_self”); 

Thanks for the help Rob :slight_smile:
I have changed the code like following and it’s working fine

var params = arguments[0], $ = skuid.$;
var leadModel=skuid.model.getModel(‘LeadDetailQueue’);
alert(“leadModel “+leadModel);
    var leadRow=leadModel.getFirstRow();
    var centre=leadRow.Centre__c;
    var id=leadRow.Id;

alert('Please select Centre on Enquiries ') ;

var urlString = “/apex/c__AddNewCourse?leadId=” + id;,”_self”); 


Thanks for posting Deleep.  Hope it works successfully for you.