Which Global Action button was clicked?

  • 2
  • Question
  • Updated 3 years ago
I am running a snippet from a group of global actions. To dynamically change content, I need to know which one was clicked. I tried I few things unsuccessfully and therefore need the help of the community. Thanks.
Photo of Neville O'Meally

Neville O'Meally

  • 180 Points 100 badge 2x thumb

Posted 3 years ago

  • 2
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 43,156 Points 20k badge 2x thumb
Hmmmm ... not sure about knowing which was clicked.

I do know that you can set it up such each Global Action runs a snippet specific to it which then runs the snippet you created. In doing so, each of these snippets can pass in a parameter in order to be able know which Global Action was clicked.

See this post by Moshe.

Create a snippet like this to make this work.

var params = arguments[0],
$ = skuid.$,
snip = skuid.snippet.getSnippet('your_snippet');
snip(arguments[0], "GlobalAction1");
Then in your existing snippet you would take this second parameter, which from the above example would be "GlobalAction1" and use it in your snippet.

As an example.
var params = arguments[0],	
$ = skuid.$,
globalAction = arguments[1];
if (globalAction == "GlobalAction1"){ //Codehere }