How do I create a row action for a Salesforce button?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have an App called "Accounting Seed" installed that has a Salesforce custom button on the detail page for an object called "Billing". The button is called "Post".

I have a table in skuid with all of the billings that are associated with a specific student enrollment. I would like to create a row action that allows me to push the "Post" button for a specific row. 

Any suggestions on how to do this?
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
It depends on what that POST button is doing in Accounting seed. 

1. If it is a URL redirect button,  you can recreate it pretty easily in Skuid using a URL Redirect row action.   
2. If is is "on click javascript"  you will need to recreate the javascript using a custom snippet in Skuid. 
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb
Thanks Rob. It is onclick javascript with this code:

{!REQUIRESCRIPT("https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")

jQuery.noConflict();
(function($,buttonObj) {
var pageName = "BillingPostTransactionButton";
var recordId = "{!AcctSeed__Billing__c.Id}";
var disabledLabel = "Posting...";
var packageName = (buttonObj.name.indexOf("acctseed") >= 0 ? "acctseed__" : "");
var submitUrl = "{!URLFOR('/apex/" + packageName + pageName + "')}";
$("#topButtonRow > .btn, #bottomButtonRow > .btn").toggleClass("btnDisabled").val(disabledLabel).prop("disabled", true);
window.location = submitUrl + "?id=" + recordId + "&scontrolCaching=1";
})(jQuery,this);

So, do I just

  1. create a row action with Action Type "custom" with Snippet name "Post"
  2. Create new javascript resource that is an In-Line (Snippet) with Snippet name "Post"
  3. Paste the code into the Snippet Body underneath 
var params = arguments[0],
$ = skuid.$;
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
That is interesting javascript.  All it is doing is defining a series of varaibles that are used to create a URL and pass some parameter values into it.  This is probably done so that a single piece of javascript can be used in multiple scenarios.  But you can recreate what they are doing with a simple "URL Redirect" button.  Here is how. 

1. Make sure the field AcctSeed__Billing__c.Id is in your model. 

2. Create a row action of type "URL Redirect"  with this redirect code:   "/apex/acctseed__ BillingPostTransactionButton?id={{{AcctSeed__Billing__c.Id}}}&scontrolCaching=1 

This code is just a replacement for what ends up being the "window.location" url in the code above. 

I believe this will work.  Happy weekend!