cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rmaziwis Resolver I
Resolver I

Disable A record and Ensure user is not able to use it on the Form

Hi All 

 

I have an issue  I need to resolve , In the App  I have an admin section where the Admin users go and perform maintenance for records captured on a form in this example I will use Accident group where there can add ,edit or disable these Accident groups .

 

They can be Animals ,Fatigue ,Hijacking etc .

 

  • Once  they select the disable button  achieved by Setting the Display Mode property of the field in my example Animal to :If(Checkbox 2. Value=true,Display Mode. Disabled,Display-mode. Edit)  which grays out that field.
  • This Accident group type  : Animal is used by users on a form  called  vehicle incidents and its is a drop down selection . 
    •  I would like once the Admin user has ticked the check box  for  this item to be greyed out it cannot be edited ,
    • On the form drop down it must  become greyed out  so that user can no longer use it  when they create new incidents 
    •  For previous incidents that it was used ,users can still enquire  the previous incidents  and see that field animal  because there reports that users pull for these incidents .

How can I achieve this ?, I have also added the attachments to show my screens . 

 

 

Accident Group Formula to disable the record on the admin screen.PNG

Disbaled item.PNG

Select the disabled and is now greyed out and can be edited 

 

 

Not greyed on the form and can be used 

Accident not greyed out on the dropdown.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
rmaziwis Resolver I
Resolver I

Re: Disable A record and Ensure user is not able to use it on the Form

Hi 

 

Iam still getting an error so iam not sure : 

 

If(LookUp('[rp].[Accident group]',Accidentgroup =DataCardValue46.Selected.Name, Checkbox2 = true,Accidentgroup,Notify("You cannot select this item",NotificationType.Error);Reset(DataCardValue46)

  • my datasource is called rp.Accidentgroup 
  • the actual drop-down field is called accident group 
  • The dropdown is called datacardvalue46 on the form -
  • Iam ticking a checkbox in the admin screen called checkbox2 
  • The record iam disabling and is on the accident group list is called animal Error on this formula.PNGDisbaled item.PNG 

The Accident group list.PNG

View solution in original post

10 REPLIES 10
WarrenBelz Community Champion
Community Champion

Re: Disable A record and Ensure user is not able to use it on the Form

Hi @rmaziwis ,

I do not believe you can disable/grey out a drop down / combo box item in the control itself, however there are a couple of approaches you could take.

One would be to filter the drop-down list based on the criteria and simply not display it for choice.

Another would be to trigger a notification to the user instead and reset the box.

If you head this direction and want some assistance with the code, please let me know.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more. It also closes the item.

 

 

 

rmaziwis Resolver I
Resolver I

Re: Disable A record and Ensure user is not able to use it on the Form

Hi 

 

That is a tough one to work  because it is a requirement ,I will keep testing in the mean time .

rmaziwis Resolver I
Resolver I

Re: Disable A record and Ensure user is not able to use it on the Form

Hi 

 

Iam considering  trigger a notification to the user instead and reset the box option if we can go through that process i will be grateful 

Highlighted
WarrenBelz Community Champion
Community Champion

Re: Disable A record and Ensure user is not able to use it on the Form

OK @rmaziwis ,

What is the trigger you would have used to disable the selection?

I will write something generic so you can get the idea

If(
   <Whatever the trigger is>,
   Notify("You cannot select this item", NotificationType.Error);   //nice bright red message
   Reset(<dropdown name),
   <Whatever you would do if input valid>
)

 

rmaziwis Resolver I
Resolver I

Re: Disable A record and Ensure user is not able to use it on the Form

Hi 

 

To disable a field am using  If(Checkbox2. Value=true,DisplayMode.Disabled,DisplayMode.Edit).

 

If i understand you correctly in the visible property of the accident group drop down OR in the field for animal I have formula like below :

If(Checkbox2.Value,Notify("You cannot select this item",NotificationType.Error);Reset(DataCardValue46);

 and Am not understanding the part ,sorry Iam just trying to get this right?

<Whatever you would do if input valid>

 

WarrenBelz Community Champion
Community Champion

Re: Disable A record and Ensure user is not able to use it on the Form

@rmaziwis ,

You don't need an "else" on an "if" statement unless there is one - I just put it there in case you did something else if the box value was valid so,

 

If(
   Checkbox2.Value = true,
   Notify("You cannot select this item",NotificationType.Error);
   Reset(DataCardValue46)
);

 

 would work as a formula, however what method do you use to determine what item selected in the drop down needs to be disabled? I am assuming the disabled checkbox is in a table containing the drop-down values and you want to check this table to see if the item should be disabled?

I will ask you to confirm this however if this is the case, you need to do a lookup on that list for the value the user has chosen, then action the Notify if it is disabled. So - calling:-

  • the list Accidents
  • the field Accident Group
  • the drop-down is DataCardValue46 (as per your code)
  • the Checkbox field in Accidents NoShow

On the OnChange property of the drop down

 

If(
   Lookup(
      Accidents,
      'Accident Group' =  DataCardValue46.Selected.'Accident Group',
      NoShow
   )
   = true,
   Notify("You cannot select this item",NotificationType.Error);
   Reset(DataCardValue46)
)

 

You need to substitute your field and control names for the above. If the name has no spaces, you do not need the quotes '.

Also AccidentChoose.Selected.'Accident Group', may be something else depending on how you structured the drop down items

rmaziwis Resolver I
Resolver I

Re: Disable A record and Ensure user is not able to use it on the Form

Hi 

 

I really appreciate your a help and I am busy with this but just to answer you the table is called Accident group .

The list is accident group(drop-down) and animal is from that list let me substitute and give you feedback if the logic works .

WarrenBelz Community Champion
Community Champion

Re: Disable A record and Ensure user is not able to use it on the Form

OK thanks @rmaziwis ,

Please note timezone difference (I am in Australia), I look forward to the result of your efforts but may not get back to you until (my) morning.

 

rmaziwis Resolver I
Resolver I

Re: Disable A record and Ensure user is not able to use it on the Form

Hi 

 

Iam still getting an error so iam not sure : 

 

If(LookUp('[rp].[Accident group]',Accidentgroup =DataCardValue46.Selected.Name, Checkbox2 = true,Accidentgroup,Notify("You cannot select this item",NotificationType.Error);Reset(DataCardValue46)

  • my datasource is called rp.Accidentgroup 
  • the actual drop-down field is called accident group 
  • The dropdown is called datacardvalue46 on the form -
  • Iam ticking a checkbox in the admin screen called checkbox2 
  • The record iam disabling and is on the accident group list is called animal Error on this formula.PNGDisbaled item.PNG 

The Accident group list.PNG

View solution in original post

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (9,450)