web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Frustration executing a plugin from a ribbon workbench button

(0) ShareShare
ReportReport
Posted on by 1,703

CRM2016 On premises

I have tried this before on a different version of CRM, but cannot seem to get it to work on a new project.

I have created a solution and used Ribbon workbench to add a button. The button calls JS;

 

   function BuildBACSFile(selectedItems)
{ alert("started"(;
 try {
        var stringlist ="";
       for (var i = 0; i < selectedItems.length; i++)
      {
        if(stringlist != "")
        { 
            if(selectedItems[i] != null && selectedItems[i] != undefined)
                stringlist = stringlist +  "," +  selectedItems[i].Id;

        }
        else
 
            if(selectedItems[i] != null && selectedItems[i] != undefined)
                 stringlist = selectedItems[i].Id;

        }          

      }

        var inputParams = [
      { key: "ParameterGuids", type: Process.Type.String, value: stringlist },
      { key: "Target", type: Process.Type.EntityReference, value:  new Process.EntityReference("new_transactionsets", selectedItems[0].Id)
 } ];

I have added the plugin and registered the step

pastedimage1576534066399v1.png

basically at this stage I am writing the selected id's to a text file ( just to get this part working)

When I select an item and click the button, nothing happens. I'm at a loss as to what i'm missing

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I don't see in your code where you call the action - I believe that's why it doesn't work. Try to add the call.

  • Pete_N Profile Picture
    1,703 on at

    My apologies , I cut the JS script short when I pasted it

       function BuildBACSFile(selectedItems)

    { alert("started");

    try {

           var stringlist ="";

          for (var i = 0; i < selectedItems.length; i++)

         {

           if(stringlist != "")

           {  

               if(selectedItems[i] != null && selectedItems[i] != undefined)

                   stringlist = stringlist +  "," +  selectedItems[i].Id;

           }

           else

               if(selectedItems[i] != null && selectedItems[i] != undefined)

                    stringlist = selectedItems[i].Id;

           }          

         }

           var inputParams = [

         { key: "ParameterGuids", type: Process.Type.String, value: stringlist },

         { key: "Target", type: Process.Type.EntityReference, value:  new Process.EntityReference("new_transactionsets", selectedItems[0].Id)

    } ];

    //Call the custom action

        Process.callAction("new_BuildMultiBACSFile", inputParams, successCallback, errorCallback);

    }

    catch(err)

    {

    alert(err)

    }

    }

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Seems that you used Process.js library. Have you added that js file to ribbon reference?

    Anyway the best way to figure out what's wrong with your script is to troubleshoot it. Here is the video that can be helpful:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans