Add custom onclick Javascript to skuid

Hi, Lauren,
I believe you should be able to call this from the Skuid page. Here are some tips to get you started:

  1. The sforce.apex.execute() function is a function to call Apex using the AJAX toolkit in Salesforce. In order for this to work, you will need to include the AJAX toolkit URL (/soap/ajax/30.0/connection.js) within your Skuid page. To do this, go to the JavaScript tab in the page composer, add a new resource with a Resource Location of “External”, and include the URL as the Resource URL.

  1. Create a new JavaScript snippet that you can execute from a button in your Skuid page. To do this, create another JavaScript resource with a Resource Location of type “In-Line (Snippet)”. You can give it whatever name you prefer (Example: AssignOpportunities ). Your snippet code may look something like this:

    // Use the name of your Account model here var acctModel = skuid.model.getModel(‘Account’),
    acctRow = acctModel.getFirstRow(); // Pass field values from your account row into the Apex action
    var newURL = sforce.apex.execute(
    “AutomaticOppAssigment”, “OpportunityAssignment”,
    acctIdInput: acctRow.Id,
    acctTerritoryInput: acctRow.Territory,
    acctSalesRegionInput: acctRow.SalesRegion,
    acctSegmentInput: acctRow.Segment,
    acctOwnerInput: acctRow.OwnerId
    parent.location.href = newURL;

  2. Call this snippet from a Skuid button or action. You could do this either through a button/action type “Custom: Run Skuid Snippet” or through the Action Framework. To use the Actions Framework, specify a button/action type “Run Multiple Actions”, and add an action of type “Run a Skuid JavaScript snippet”.

Here is a post with more information on various ways to call Apex from Skuid:

Also, here are some tutorials that may be helpful for you:
Action Framework
Skuid Snippets

I hope this is enough to get you started. Let me know if you have more questions specific to your use case.