I'm trying to find a way to initiate service cloud (console) macro using workflow/process builder/APEX.
The only documentation remotly related to macros and code i found is metadata related and not on how to execute. You can see it here: Create/modify/delete macros
Is there a way to execute macros without clicking on the macro name in the console?

1 Answer 1


There is no way to execute a macro other than client-side. Other than a user manually clicking play or hitting enter from the widget, the only way to execute it would be by using the console's javascript toolkit methods selectMacro and runSelectedMacro which do as their names suggest and allow you to select and run a macro via javascript.

You can sort of trick apex into executing javascript, which may or may not work for your use case. You can use an unescaped outputText tag

<apex:outputText value="{!myScript}" escape="false" />

And in your controller have something like this

myScript ='‹script›alert(1);‹/script›';

But you would populate the script variable with javascript which calls the toolkit to execute the macro you want. You could also write the function that runs macros on your VF page itself, then have your outputText just write a call to that function. Then you can play with the VF rendering to determine if you want to call it on load, only under certain conditions, on a button press, etc...


  • Thanks Paul. I didn't know about the console integration toolkit. I created an action that is a visualforce page and it calls for the macro using javascript.
    – Dagish
    Jun 6, 2016 at 7:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .