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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Javascript on form suc...
Power Pages
Answered

Javascript on form success

(1) ShareShare
ReportReport
Posted on by 53

Hi everyone, 

 

I am building a portal and have a form with a submit button that allows the user to input a price (in a field named NewPrice within a table named RequestLine). When the user hits Submit and the record is saved, I would like to capture the price inputted by the user and send it as part of an api request to an external system. 

 

What I have done so far is as follows; 

 

- In the Basic Form where the user can input the new price I have added the below javascript that calls a web page  that does a fetchxml to retrieve the modified record from dataverse and returns the field NewPrice. (For now I'm just exposing the result of the fetchxml in an alert just to see the returned value.). The problem with this is that the record wouldn't have saved the new value yet and the previous value of the field NewPrice is retrieved, example; 

 

if the value in the field is 5.00 and the user opens the form, changes the value to 8.00 and Submits the form, the value of 5.00 is still being retrieved. 

 

 

 

$(document).ready(function() { 
 $("#UpdateButton").on("click", function() {
 alert('yooo');
 debugger;
 var recodId = $("#EntityFormControl_EntityFormView_EntityID").val();
 $.ajax({
 method: 'GET',
 dataType: 'json',
 url: "/returnprice?recordid=" + encodeURIComponent(recodId)
 }).done(function(data) {
	console.log(JSON.stringify(data.results));
	alert(data.results);
 })
});
});

 

 

Is it possible to move such javascript to run On Success of the form i.e. when the form has been fully submitted and the record fully updated? 

 

Thanks in advance! 

Categories:
I have the same question (0)
  • gng Profile Picture
    167 on at

    I am also wondering how we can add JavaScript code to capture whether a form was successfully submitted and what the response data is

  • Verified answer
    Fubar Profile Picture
    8,361 Super User 2025 Season 2 on at

    Not with JavaScript.

    Trigger a Power Automate Flow (or workflow or plugin) on update of the Price field and have Flow send the update to the other system.

    Alternatively, on your form's definition in the On Success settings set redirect to a Web Page (it will only redirect on success) and pass the record id, then on the page redirect to do the sending to the other system (but Flow, Workflow, or Plugin would probably be a better solution). https://learn.microsoft.com/en-us/power-apps/maker/portals/configure/entity-forms#on-success-settings

  • gng Profile Picture
    167 on at

    Thanks for the response. It looks like I can redirect the form success scenario into an 'empty' web page whose sole purpose is to run a power automate flow. I would be able to pass in the previous form's record ID.

  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @gospa 

     

    The creation of a record is a dataverse trigger in power automate. Choose the relevant table while using powerautomate dataverse trigger. 

     

    Hope it helps.

    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.Hope it helps. 

     

    ------------

     

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • gng Profile Picture
    167 on at

    That was our initial approach. Unfortunately we are triggering on a virtual table that was imported from Dynamics 365 Finance and Operations and the flow never gets triggered so we're looking for alternatives 

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard