Add-in button displays, but doesn't fire

Gonna throw this out there as a last hail Mary.


I'm trying to create an Add-in that displays as a button on constituent pages.  When the button is clicked, it should display a toast message and make an HTTP call with the constituent ID.  The button is showing up, and the reference to the ID on the button label works, so I know that part of the process works.  But clicking the button does nothing.


I'm not seeing any errors related to my add-in in the web console, though I know that doesn't mean that my code is error-free.  Here's what I'm trying to run - if you can pick out the error, I'll be in your debt.


(function () {


  // Add-in code goes here

    

  // BBSkyAddinClient is global here.

  var client = new BBSkyAddinClient.AddinClient({

    callbacks: {

      init: function(args) {


        // perform any initialization needed for the add-in

        

        // get system record id

        context = args.context;

        currentRecordId = context.recordId;

        

        // when the button is ready to be shown, inform the host page

        args.ready({

          showUI: true,

          title: ` Update this record in my application (Id: ${currentRecordId})`,

          buttonConfig: { style: BBSkyAddinClient.AddinButtonStyle.Add }

        });

      },

      buttonClick: sendHTTP

    }

  });


 function sendHTTP() {

    

    client.showToast({

      message: 'This constituent is being updated in my application',

      style: BBSkyAddinClient.AddinToastStyle.Success

    });

    

    const Url='MY_URL';

    const Data={

        SystemRecordID: currentRecordId,

        CheckForDeletions: false,

        Secret: "MY_SECRET"

    };

    const otherParam={

        headers: {

            'Content-Type': 'application/json',

        },

        body: JSON.stringify(Data),

        method: "POST"

    };

    fetch(Url,otherParam)

    .then(res=>{console.log(res)})

    .then(error=>console.log(error));

    


    

    

 }


}());

 

Comments

  • Neeevermind... the problem was that my browser's javascript blocker was blocking javascript.  I had whitelisted RE, but forgot to whitelist the URL of my add-in.

Categories