ToutApp Javascript button in Skuid

  • 1
  • Question
  • Updated 2 years ago
  • Answered
Hi! I am currently trying to implement a Salesforce JS button into my Skuid page. The reference fields in the URL are not pulling dynamically and I was wondering what the correct format would be or if I need to create new variables in my code. (I am not JS savvy).

Original SF button code:
 var u = "https://www.toutapp.com/pitches/new?name={!Contact.Name}&email={!Contact.Email}&salesforce_contact_id={!Contact.Id}}&force_bookmarklet=true&style=salesforce";
var w = window;
w.open(u,'Tout','scrollbars=1,status=1,width=762,height=' + ( w.screen.height < 970 ? w.screen.height : 970))

Skuid reference Fields:

     model: SelectedAccountContacts (Name, Email, Id)

Any thoughts?? 
     
Photo of Megan Minahan

Megan Minahan

  • 726 Points 500 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Are you running this from a Table Row Action, or a Page Title button?

Regardless of how you run it you'll need to do the following:

1. Go to the JavaScript menu in the Composer (next to Models and Components), and click the + icon to add a new JavaScript Resource.
2. Set Resource Location to "Inline (Snippet)"
3. Set Resource Name to "ToutAppForContact".
4. Click the icon to edit the Resource Body, and paste in the following:

var params = arguments[0],
     model = params.model,
     row = params.item ? params.item.row : params.row;
var u = skuid.utils.mergeAsTextInContext(
   "https://www.toutapp.com/pitches/new?name={{{Name}}}&email={{{Email}}}&salesforce_contact_id={{{Id}}}&force_bookmarklet=true&style=salesforce",
   { model: model, row: row }
);
var w = window;
w.open(u,'Tout','scrollbars=1,status=1,width=762,height=' + ( w.screen.height < 970 ? w.screen.height : 970));


From either your Row Action or Page Title button, set your Action Type to Custom / Run a Snippet, and for "Snippet Name", enter "ToutAppForContact"
Photo of Megan Minahan

Megan Minahan

  • 726 Points 500 badge 2x thumb
I am running this using a Table Row Action. But everything worked perfectly! Thank you so much for your help!
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Yay! Great to hear.
Photo of Henry Goddard

Henry Goddard

  • 776 Points 500 badge 2x thumb
Hey Megan

We're integrating Tout right now as well and that quick email row action is awesome! Where did you find the URL to launch that? I'd like to get the same thing working for calls as well.