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 Apps / Command bar button to ...
Power Apps
Unanswered

Command bar button to read URL

(0) ShareShare
ReportReport
Posted on by 64

Hi Community,

 

Is it possible to create a command bar button so that when a user clicks on the button, the PowerFx obtains the url? What is the function/syntax?

 

Desired outcome:

  • The above-mentioned is a 'Request for Approval' button.
  • We have various Sales Team views in Dynamics 365.
  • User clicks the button to request for approval based on the selected Sales Team view.
  • The button triggers a Power Automate flow, passes the url to the flow.
  • The flow reads the viewid from the url to determine the Sales Team before sending the request email (using the user's connection).

 

Or is there a simpler/easier way to do this? Am I over-thinking the process? Any advice welcomed.

 

--

Thank you

I have the same question (0)
  • AbdulWahab Profile Picture
    517 on at

    Hi @JLKM ,

     

    Are you working on Canvas App? or Is this a model-driven one?

     

    Thanks
    Regards,

     

    Abdul Wahab

    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: https://www.linkedin.com/in/abdul-wahab-a5b8b011a/

  • Josephkm_lim Profile Picture
    64 on at

    It is a table in Dynamics 365. So, model-driven app.

  • AbdulWahab Profile Picture
    517 on at

    Hi @JLKM 

     

    I do not think it is possible using power fx due to my very little knowledge. You can do it using JS. Here is the helpful link: getGlobalContext (Client API reference) in model-driven apps - Power Apps | Microsoft Learn

     

    If I have answered your question, please mark your post as Solved.

     

    If you like my response, please give it a Thumbs Up.

     

    Let me know if I can provide you with more details.

     

    Thanks
    Regards,

     

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: https://www.linkedin.com/in/abdul-wahab-a5b8b011a/

  • Josephkm_lim Profile Picture
    64 on at

    Hi Abdul


    I have amended my original post as I missed out the flow part. Hope you have a fresh idea.


    Thanks

  • Hauke Jacobsen Profile Picture
    64 on at

    Hi @JLKM ,

    I would suggest to create a Custom Page where you are able to link a Power Automate flow to a control.

    This is well explained here:

    https://dynatecon.com/2022/07/25/call-custom-page-with-parameters-from-model-driven-app-using-new-command-editor/

    Best regards

    Hauke

  • AbdulWahab Profile Picture
    517 on at

    Hi @JLKM , 

     

    I do not think so custom page is required here. you can trigger 'power automate' from js using the below code. Use an HTTP Request trigger on your 'power automate'. you can pass parameters also.

     

    function triggrFlow() {
     var flowUrl = "https://prod-17.australiasoutheast.logic.azure.com:443/work";
     var input = JSON.stringify({
     "Id": donationId.replace("{", "").replace("}", ""),
     "UserId": userId.replace("{", "").replace("}", "")
     });
     var req = new XMLHttpRequest();
     req.open("POST", flowUrl, true);
     req.setRequestHeader('Content-Type', 'application/json');
     req.send(input);
     }

     

    If I have answered your question, please mark your post as Solved.

     

    If you like my response, please give it a Thumbs Up.

     

    Let me know if I can provide you with more details.

     

    Thanks
    Regards,

     

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: https://www.linkedin.com/in/abdul-wahab-a5b8b011a/

     

     

  • Hauke Jacobsen Profile Picture
    64 on at

    Hi @AbdulWahab ,

    Thank you for the code snippet to do the call directly using JS.

    This is certainly doing the trick. What I like about the Custom Page approach is the fact that you are able to display the status of the Power Automate Flow in the page and enrich the application in terms of user interaction.

    Best regards

    Hauke

  • Josephkm_lim Profile Picture
    64 on at

    Hi @AbdulWahab

     

    With this method, the flow with the HTTP trigger uses the flow owner/admin's connection, not the user's connection, right? Is there a way to this this, yet use the user's connection for the flow?

     

    --

    Thank you

  • AbdulWahab Profile Picture
    517 on at

    Hi @JLKM 

     

    The link might be going to solve these issues: (3) Trigger a Power Automate Flow from a Custom Button without HTTP request - YouTube

     

    If I have answered your question, please mark your post as Solved.

     

    If you like my response, please give it a Thumbs Up.

     

    Let me know if I can provide you with more details.

     

    Thanks
    Regards,

     

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: https://www.linkedin.com/in/abdul-wahab-a5b8b011a/

  • Josephkm_lim Profile Picture
    64 on at

    Hi @AbdulWahab

     

    Awesome link. Thank you.

     

    But I need to click the button on the Main grid/a specific view and read the url to obtain the viewid.

     

    Can the video method do this?

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard