Call Power automate flow

 function SendCPSBReport(executionContext, Recordids, Entityname, HideButton) {

    debugger;

    window.recordValues = Recordids;

    var pageInput = {

        pageType: "webresource",

        webresourceName: "ecl_CPSBQuarter"

    };

    var navigationOptions = {

        target: 2,

        width: 200, // value specified in pixel

        height: 250, // value specified in pixel

        position: 1,

        title: "CPSB Quarter selection"

    };

    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(

        function success(returnValue) {

            if (returnValue.returnValue != null) {

                var ids = window.recordValues;

                var records = [];

                if (Recordids != null && ids.length > 0) {

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

                        records.push({

                            "RecordId": ids[i],

                            "Quarter": returnValue.returnValue

                        });

                    }

                }

                var input = JSON.stringify(records);

                var flowUrl = "https://prod-19.australiasoutheast.logic.azure.com:443/workflows/12b3c35d41fb49a989ada045d5f1dc49/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gip2wWKGBMe5CzHpK4Jd3oln0nrbeAVU7ue8IC18UuA";

                var req = new XMLHttpRequest();

                req.open("POST", flowUrl, true);

                req.setRequestHeader('Content-Type', 'application/json');

                req.send(input);

            }

        },

        function error() {

            // Handle errors

        }

    );

Comments

Popular posts from this blog

Power Automate compose vs variable

Update record when checkbox checked using JavaScript and save d365

Power pages custom button add in gried