Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
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

Categories:
  • AbdulWahab Profile Picture
    517 on at
    Re: Command bar button to read URL

    Hi @JLKM ,

     

    You can find details from the link: Xrm.Navigation (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
    Re: Command bar button to read URL

    Hi @powerH 

     

    I am exploring Custom Page, and I am new to this. Hope to seek your expertise.

     

    I am passing in viewid from the url (using parent.window.location) instead of recordId. What should my javascript syntax for Xrm.Navigation.navigateTo be?

     

    Thanks in advance!

  • Josephkm_lim Profile Picture
    64 on at
    Re: Command bar button to read URL

    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?

  • AbdulWahab Profile Picture
    517 on at
    Re: Command bar button to read URL

    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
    Re: Command bar button to read URL

    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

  • Hauke Jacobsen Profile Picture
    64 on at
    Re: Command bar button to read URL

    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

  • AbdulWahab Profile Picture
    517 on at
    Re: Command bar button to read URL

    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
    Re: Command bar button to read URL

    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

  • Josephkm_lim Profile Picture
    64 on at
    Re: Command bar button to read URL

    Hi Abdul


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


    Thanks

  • AbdulWahab Profile Picture
    517 on at
    Re: Command bar button to read URL

    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/

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
mmbr1606 Profile Picture

mmbr1606 22 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 17

#3
Fubar Profile Picture

Fubar 11 Super User 2025 Season 1

Overall leaderboard

Featured topics