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 / Advanced Form Custom J...
Power Pages
Unanswered

Advanced Form Custom JS to get values from fields and call a custom flow

(0) ShareShare
ReportReport
Posted on by

Hello, 

 

I created an advanced form where I fill the different fields. What I want to do is to get the values of those fields and send to my flow to populate a word template.

 

My problems are :  

How do I get the values with my javascript function?

How to add the flow to the "Submit" button to make it work and create my word with the values I give ?

 

Here is my "function" where i try to console log my value

function callFlow(executionContext)
{
var formContext = executionContext.getFormContext();

//How do i get the value of my field filename from the form?


var filename = formContext.getAttribute("Filename").getValue();
console.log("Test filename -> "+filename);
/*
var params = { } var url = "CUSTOM URL";
var req = new XMLHttpRequest();
req.open("POST", url, true);
req.setRequestHeader('Content-Type', 'application/json');
req.send(JSON.stringify(params));
Xrm.Utility.alertDialog("Flow initiated. The PDF will be sent soon.");
*/
}

 

 

 

 

Categories:
I have the same question (0)
  • Christian Leverenz Profile Picture
    1,214 on at

    Hi @Anonymous ,

    i am talking about power apps portals, hope i got the question right 🙂

    The attributes on the form have the same id as the logical names in the dataverserse. So, if you have "my_stringattr" as a logical fieldname on your form, you could get the value of it by document.getElemenetByIf("my_stringattr").value .

    As you have jQuery on board out of the box i would recommend using $("#my_stringattr").val() .

    On listboxes you will get the value of the listbox (usually the numerical value) and on lookups, you have additional inputs which are postfixed with _name and _entityname which carry the expected contents (not sure about the exact names, would have to inspect the dom...)

    So, you can gather all the data from the form.

    When submit is pressed, two functions are calles, which may be overwriotten by you. Page_ClientValidate and entityFormClientValidate are called by the submitbutton. If one (or both 🙂 ) of these functions exist and return false, the submit is canceled. So, when overwriting it, using return true is not a bad option.

    These functions are a good plye to to something while submitting. Two remarks: when you do a post its a fire and forget as the save will navigate away from the page. And these functions are not really documented. I do not know, whether they are simply an overleft from old times and might disappear somewhen.

    May be, you just render another button on the form triggering the printout 🙂

     

    May be, its a better idea to make the printaout when the data is saved. Just attach to the saveevent with the flow (i think, it should be possible, i am not a flowexpert)

    Does this help in any direction?

     

    Have fun,

      Christian

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 89 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard