I'm sending a POST request to Power Automate from button in Dynamics. I'd like to send ID of user who triggered the flow and ID of Quote in which the action was triggered. My current Java script is:
function sendEmailWithTriggerred(executionContext) { var userSettings = Xrm.Utility.getGlobalContext().userSettings; var currentuserid = userSettings.userId; var formContext = executionContext; var recordID = formContext.getId; var req = new XMLHttpRequest(); var url = 'xxx'; req.open('POST', url); req.setRequestHeader("Content-Type", "application/json"); var params = { "user": currentuserid, "quote": recordID} var data = JSON.stringify(params); req.send(data); }
to get the record Id you should do
var formContext = executionContext.getFormContext(); var recordID = formContext.data.entity.getId();
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,902 Super User 2024 Season 2
Martin Dráb 229,302 Most Valuable Professional
nmaenpaa 101,156