cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

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. 

 

Highlighted
Post Patron
Post Patron

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,

Highlighted
Community Support
Community Support

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
Post Patron
Post Patron

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,917)