cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sunilkumar
Helper II
Helper II

Need A Help with multiple user action from enable and disable

i have a form which is filling by multiple team, teamA will be filling 1to5 column and teamb 6to10. finally all the da

 

i would like to disable teamB column when teamA filing 1to 5 and reverse when teamB entering 6to10.

 

Can some one help me how to apply enable and disable on powerapps form.

 

images added for reference.

2 REPLIES 2
mdevaney
Super User
Super User

@sunilkumar 

Make a new SharePoint list (or Excel table) called UserTeams with two columns

 

  • UserEmail (text column)- stores the user's email
  • UserTeam (text column) - stores the user's team

 

Fill-in the table will people and their team like this:

 

UserEmail UserTeam
jenniferlee@yourcompany.com A
michaeljohnson@yourcompany.com A
kellygreen@yourcompany.com B

 

Now open up PowerApps and connect to the SharePoint list (or Excel table) you created.  Then put this code in the OnStart property of your app

 

// creates a variable to store information about the current user
Set(currentUser,
    {
        Name: User().FullName
        Email: User().Email
        Team: LookUp(UserTeams,UserEmail=User().Email, UserTeam)
    }
)

 

Creating the currentUser variable allows us to get information about the person who is using the app easily by using this code.  You can test each line separately in a label if you like to understand how this works.

currentUser.Name  // returns "Jennifer Lee"
currentUser.Email  // returns "jlee@yourcompany.com"
currentUser.Team // returns "A"

 

With the currentUser variable setup we can enable/disable columns in the form.  Put this code in the DisplayMode property of each card you want to enable for Team "A".

Switch(
    currentUser.Team
    "A", DisplayMode.Edit,
    "B", DisplayMode.Disabled
)

 

Oppositely, use this code in the DisplayMode property for fields to be completed by Team B.

Switch(
    currentUser.Team
    "A", DisplayMode.Disabled,  //you might choose to use DisplayMode.Visible here instead
    "B", DisplayMode.Edit
)

 

That's all it takes!  Please give it a try and let me know what questions you have.


***BONUS***
You could also hide the questions based on whose Team the user is on by using this code in the Visible property.

currentUser.Team = "A"  // show the column only for Team A
currentUser.Team = "B" // show the column only for Team B

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

i am already using a SharePoint to create existing form, based on your suggestion created a one more list for user email and team.

unfortunately, cannot able to connect second list on existing from, when i click view/data sources, it is just showing existing list connected one, and there no option to add new data sources. 

 

Can you please suggested me the reason and how to connect second list in existing form..?

 

in my from everyone granted the permission on share point as everyone one except external users, because since this form is going to using all the department in my organization. first half.

 

Later other metrology team going to fill remaining column very few people which i can able to use the email id who belongs to this team.

 

since, this request can submit any one in my organization hence other department people email i don't who will submit the request later.

 

hence, Can i use as everyone one except external users instead of email id for group A in my send share point list...?

 

PictureMail.png

 

 

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 (3,154)