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

Handle Command button contexts with Javascript

(0) ShareShare
ReportReport
Posted on by 76

You can create Command buttons that call a JavaScript library function. Those commands have four different contexts. Main Form, Main Grid, Subgrid View and Associated View. Does anyone have advice on how to structure my code for those different contexts?

 

Can you determine where it was called from in code?

Do you have different procedure names for each of the commands?

e.g. fnMyFunction_Form(primaryControl, selectedControl), fnMyFunction_MainGrid(primaryControl, selectedControl)...

Do you pass in a string parameter that defines where it's being called from? 

e.g. fnMyFunction_Form(primaryControl, selectedControl, caller) //Where caller is 'mainform','maingrid','subgridview','associatedview'

 

I have the same question (0)
  • Jonathan Manrique Profile Picture
    2,687 on at

    Hi @srx_nstratton 

     

    Within the documentation the different events that exist within the context where it is being executed are described. Normally within the context of a form there are onload, Onchange, onsave events, and within the grid we have other events as well as in the views

     

    I suggest you review this documentation so that you become familiar with your questions.

     

    https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference

     

    Additionally, in some there are examples of how to use them.

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    You can accept more than one post as a solution

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