cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LenC
Advocate I
Advocate I

Custom Command visibility not updating

With a custom command in a model-driven app, I have a Visible formula that works correctly when the form opens. Pressing the button changes the record data successfully (OnSelect uses Patch()). After which, the Visible formula evaluates to False. But the command stays visible. I have to exit the form, and re-enter to see that the command is now invisible.

 

Is there any way to get the custom command Visible formula to evaluate properly here? This seems like a bug.

1 ACCEPTED SOLUTION

Accepted Solutions

@LenC ,

Try Navigate(Self.Selected.Item) after patch. 

 

Regards,

Prakash

View solution in original post

4 REPLIES 4
Prakash4691
Super User
Super User

Hi @LenC ,

It should work. could you post your command which you used in visible property of the button?

Below is the snippet which I used in my button it works fine.

If(Self.Selected.Item.'Account Name' = "TCS"truefalse)
 
If it answers your question, Kindly give kudo and accept it as solution.
 
 
Regards,
Prakash
LenC
Advocate I
Advocate I

Mine works when you enter the form. It checks the value of a field 'Paperwork State'

 

Self.Selected.Item.'Paperwork State' = "Data Entry"

 

It also works if you manually update 'Paperwork State' and Save the form.

 

In the button's OnSelect method, the code updates 'Paperwork State', using Patch():

 

    Patch(DWOS, Self.Selected.Item,{'Paperwork State':"Under Review"});
    Notify("DWO marked as data entry complete");

The field value successfully changes on the screen. But the button's visibility does not update. You have to leave the form and come back in to see the visibility changed.

 
I've tried adding these lines to the OnSelect, but they do not help:
    Refresh(DWOS);
    Self.Visible = false;

@LenC ,

Try Navigate(Self.Selected.Item) after patch. 

 

Regards,

Prakash

LenC
Advocate I
Advocate I

That works.

 

Now, when you hit the back button, the navigation takes you to the same record. Might have to live with that.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (6,297)