Newer Version Available

This content describes an older version of this product. View Latest

selectMacro()

Selects and displays a specific macro in the macro widget. This method is only available in API version 36.0 or later. This method isn’t supported in Lightning Console.

Syntax

1sforce.console.selectMacro(macroId:String, (optional)callback:Function)

Arguments

Name Type Description
callback function JavaScript method that is called when the method is completed
macroID string ID of the macro that’s selected

Sample Code–Visualforce

1<apex:page>
2    <A HREF="#" onClick="openInWidget('0JZ00123456789A');return false">Click here to select a macro</A>
3    <apex:includeScript value="/support/console/61.0/integration.js"/>
4    <script type="text/javascript">
5        function openInWidget(id) {
6            sforce.console.selectMacro(id);
7        }
8    </script>
9</apex:page>

Response

This method is asynchronous, so it returns its response in an object in a callback method. The response object contains the following field:
Name Type Description
cause string Explanation of function failure, if applicable
success boolean true if selecting the macro was successful; false otherwise