Trying to add custom javascript button to SKUID

I am trying to add a custom Javascript Button to SKUID this is a working functional button.  Here is the button code:

{!REQUIRESCRIPT(“/soap/ajax/24.0/connection.js”)}
{!REQUIRESCRIPT(“/soap/ajax/24.0/apex.js”)}
sforce.apex.execute(“SGSFA_NA_OverLay”,“OverlaySales”, {id: ‘{!Opportunity.Id}’});
window.alert(“Overlay Sales Team has been added” );
window.location.reload();

I have added the requirescripts as external resources in Skuid and taken them out of the code in the snippet that I am adding.  However, when I press the button I get the following error:

POST https://sungardas–ebuatb–skuid.cs11.visual.force.com/services/Soap/package/SGSFA_NA_OverLay 500 (Server Error) connection.js:595

Uncaught {faultcode:‘sf:INVALID_SESSION_ID’, faultstring:‘INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session’, }


Any ideas on how to get this working would be appreciated.  Thanks!


Hi Jacob,  Skuid comes with connection.js included, so you just need to include apex.js.  I think removing connection.js may help you get past the invalid session error.  The next possible issue that I see is your opportunity merge.  I would start with a hard-coded opportunity id and make sure that works first.  Then you’ll need to use skuid’s javascript api to retrieve the correct opportunity id.  

var oppModel = skuid.model.getModel('OppModelName');<br>var oppRow = oppModel.getFirstRow();<br>var oppId = oppRow.Id;


Let me know if this makes sense, if not, maybe you can give us access to your org and we can troubleshoot.