cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ck25415
Level 8

Hide item in gallery when a new item is created out of it

Hello,

 

I have a gallery that displays items from a sharepoint list, there is button on each gallery item which opens a new form for the user to create an item in a different list. How do i disable or hide that item in gallery for that particular user when a new item is created based off it. The item should be disabled or hidden everytime the app is accessed by that user.

 

Thanks,

4 REPLIES 4
Super User
Super User

Re: Hide item in gallery when a new item is created out of it

Hi @ck25415,

It looks like you want everyone other than the user who created a new item in a second list to see everyone elses items.  If that is so, go into SharePoint, add a column to your list called NewItem and with the Column Type "Yes/No".  Set the default to "No".  In the OnSuccess property of your new form add the following 

Patch(YourSharepointlist,Lookup(YourSharepointList,ID= Gallery1.Selected.ID,{NewItem:true}))

Where YourSharepointlist is the list in the Items property of the gallery and Gallery1 is the name of the gallery with the button.

Filter the Items property of the Gallery for the logged in user with User(). and for items that have already been added to the second list as follows: (You will get a delegation warning but you can ignore it if your list is <2000 items.)

Filter(YourSharepointList,User().FullName <> 'Modified By'.DisplayName && NewItem=true)

Your gallery should only show the Item if a user other than the one who modified the item is looking at the list. If you put a toggle in the gallery with the Default property of NewItem.  It will show that a item has been added to the new list. You could also hide the button if the item has already been added to the new list by someone else if you set the Visible property of the button to !NewItem.  

 

I may be misunderstanding your requirements.  If you want the item in the gallery to be invisible to everyone once a new item is added to a second list, the Filters would be different. 

 

ck25415
Level 8

Re: Hide item in gallery when a new item is created out of it

Hello @Drrickryp,

 

Thanks for the quick reply. Sorry for not posting the question clearly. In the second list I want only the user to see and edit his item so I will be suing the sharepoint default read and create-edit access option. I will need that item level permission as I want to enable the user to view and edit only his item in a edit form on a different screen. Also, the  list may contain more than 2000 items and I want to avoid delegation error by making sharepoint do the filter rather than me using filter option in powerapps.

 

Once a user creates a new item in second list, the item in gallery should be invisible to this particular user as other users will be creating new items based on the gallery item.

 

Thanks,

Community Support Team
Community Support Team

Re: Hide item in gallery when a new item is created out of it

Hi @ck25415,

 

Did you mean that you want the user to be able to edit the record when first time loading the app, but disable editing when user finish updating one record? If so, then you could set below formulas for this app:

Screen1.OnStart=Set(V,true)
Gallery1.Visible=V
Button1(Submit Button for the Edit Form).OnSelect=SubmitForm(EditForm1);Set(V,false)

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
ck25415
Level 8

Re: Hide item in gallery when a new item is created out of it

Hello @v-monli-msft,

 

Thanks for the reply, I want the gallery to be in edit mode even after the user create/updates one record. Below image shows the gallery, user clicks on create next to first item and a new form opens to create a record in a different list. After submitting the form, user comes back to gallery and I want the first item in the gallery to be hidden or dsiabled to this particular user.

 

gallery.JPG

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 430 members 5,842 guests
Please welcome our newest community members: