I have a table called DriverInductions, which is a custom many to many. That is, it has two lookup columns, one for Driver and one for Induction, creating a custom many to many, with additional columns (which Dataverse doesn't allow in its many to many relationships).
It has an "Active DriverInductions" view, which has a PowerFx "+ Add Existing Induction" command button. If the view is placed in the Induction Main Form, that button works as expected but the view can also be placed in the Driver Main Form, where the button doesn't make sense, instead it needs to show a "+ Add Existing Driver" button and hide the Add Induction button.
Is there a way to write a formula that sets the command visibility based on the parent?
This question mentions making a reference to the parent record but I am not sure if I can use this for what I need.
With(
{
PARENT_RECORD: First(Self.Selected.AllItems).<YOUR_LOOKUP_COLUMN_TO_PARENT_RECORD>
},
CountRows(Filter('Questions','Questionnaire'.'Questionnaire'=PARENT_RECORD.<YOUR_PARENT_RECORD_IDENTIFIER> And 'Status Reason'='Status Reason (Questions)'.Unanswered))=0
)
Bonus question. How does one debug a PowerFx command? I see that you can put a breakpoint in Javascript on the line for the formula but debugging a minified JS script is rather difficult to say the least.