
Announcements
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'
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