In Console, I'm having a custom component where I have to show all relevant Macro based on the primary tab record (Case(Sobject)) Subject (Sobject field).

For example : When I select a Case, I should show the relevant Macro for that particular Case - Subject.

If the Case - Subject is Personal Loan Query, I have to Query Macro object based on the Case - Subject and I have to show in Custom Console Component.

From Custom Console Component, the selected macro has to be executed, going and executing in Macro widget instead.

Here is my code :

for (var i = 0; i < records.length; i++) {
        var mc = records[i];
           <!-- output += <A HREF="#" onClick="openInWidget('account.Id');return false">account.name</A> +"<br>"; -->
            //alert(mc.name + mc.Id);
            var p2 = "<a href="+"\"#\" onClick=\"openInWidget('"+mc.Id+"');return false\">"+mc.Name+"</a> <br>";
            //alert('dfs '+ p2);
            document.getElementById("output").insertAdjacentHTML('beforebegin', p2);

    //render the generated html string
    source.output.innerHTML = output;

  function openInWidget(id){

  function executeInWidget() {

It is selecting the Macro but not executed.

  • 2
    Please do not mention the urgency of your requests when asking strangers on the internet for help. If it's that urgent, hire someone or intensify your research efforts, perhaps in addition to posting here. – Adrian Larson May 13 '17 at 12:19

I have to call the "executeInWidget" function as like I have given below Then the selected macro is executed.

function openInWidget(id){
    sforce.console.selectMacro(id, executeInWidget);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.