Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Sending POST request to Power Automate

Posted on by 40

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);
}

But Power Automate "When a HTTP request is received" gets only first parameter. What should do to pass both parameters?

EDIT: It seems that I'm not getting ID of current Quote. How could I repair it?

  • Suggested answer
    Guido Preite Profile Picture
    Guido Preite 54,074 Super User 2024 Season 1 on at
    RE: Sending POST request to Power Automate

    to get the record Id you should do

    var formContext = executionContext.getFormContext();
    var recordID = formContext.data.entity.getId();

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,302 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans