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

Check if user has created an Sharepoint list item

Hello there,

 

I want to know if a the current user has created a Item in the list.

If it did, it would say "You can't add 2 items", if the user didn't it would say "Create an item now".

How can i achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Check if user has created an Sharepoint list item

Hi @Field ,

Does the user has enough permission to the SP List?

How many records stored in your SP list? More than 2000 records?

 

I assume that the user has enough permission to the SP list. I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the "Submit" button to following formula:

If(
   IsBlank(LookUp('YourSPList', 'Created By'.Email = User().Email)),
   SumitForm(EditForm1);Notify("Create an item now", NotificationType.Success),
   Notify("You can't add 2 items", NotificationType.Error)
)

 

In addition, you could also consider set the OnVisible property of the Edit screen to following:

If(
   IsBlank(LookUp('YourSPList', 'Created By'.Email = User().Email)),
   Notify("Create an item now", NotificationType.Success),
   Notify("You can't add 2 items", NotificationType.Error)
)

Set the DisplayMode property of the "Submit" button to following:

If(
   EditForm1.Mode = FormMode.New && !IsBlank(LookUp('YourSPList', 'Created By'.Email = User().Email)),  /* <-- EditForm1 represents the Edit form in your app */
   DisplayMode.Disabled,
   DisplayMode.Edit
)

Above LookUp formula may cause a Delegation warning issue, if the amount of your SP List records is not more than 2000, you could ignore this warning issue. Please consider set the "Data row limit for Non-delegable queries" option within the Advanced settings of App settings of your app to maximum value -- 2000. Then you could process 2000 records in your app locally at most.

More details about the Delegation in PowerApps, please check the following article:

Delegation

If the amount of your SP List is more than 2000, please check and see if the alternative solution mentioned within the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/Pulling-in-large-ish-SQL-tables/m-p/243777#M7...

Set the OnStart property of the App control to following (I assume that there are 10000 records in your SP list):

Concurrent(
    ClearCollect(col1, Filter('YourSPList', ID >= 1 && ID <= 2000)),
    ClearCollect(col2, Filter('YourSPList', ID >= 2001 && ID <= 4000)),
    ClearCollect(col3, Filter('YourSPList', ID >= 4001 && ID <= 6000)),
    ClearCollect(col4, Filter('YourSPList', ID >= 6001 && ID <= 8000)),
    ClearCollect(col5, Filter('YourSPList', ID >= 8001 && ID <= 10000))
);
ClearCollect(MergedCollection, col1, col2, col3, col4, col5)

Then modify above formula as below:

If(
   IsBlank(LookUp(MergedCollection, 'Created By'.Email = User().Email)),   /* ues MergedCollection as data source instead of Original SP List */
   SumitForm(EditForm1);Notify("Create an item now", NotificationType.Success),
   Notify("You can't add 2 items", NotificationType.Error)
)

...

 

then re-load your app, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User
Super User

Re: Check if user has created an Sharepoint list item

Hi @Field 

 

Can you try using the below expression:
 
If(IsEmpty(Filter(TestList123,'Created By'.Email = User().Email)),"Create an Item Now","You can't add 2 Items")
 
This is a sample snippet that can be put on a label, please replace TestList123 with the actual name of your DataSOurce.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Field
Level 8

Re: Check if user has created an Sharepoint list item

I have tried this, and it doesn't work. He won't check the list.

Super User
Super User

Re: Check if user has created an Sharepoint list item

Hi @Field 

 

are you getting any error?Can you share a screenshot. 
Community Support Team
Community Support Team

Re: Check if user has created an Sharepoint list item

Hi @Field ,

Does the user has enough permission to the SP List?

How many records stored in your SP list? More than 2000 records?

 

I assume that the user has enough permission to the SP list. I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the "Submit" button to following formula:

If(
   IsBlank(LookUp('YourSPList', 'Created By'.Email = User().Email)),
   SumitForm(EditForm1);Notify("Create an item now", NotificationType.Success),
   Notify("You can't add 2 items", NotificationType.Error)
)

 

In addition, you could also consider set the OnVisible property of the Edit screen to following:

If(
   IsBlank(LookUp('YourSPList', 'Created By'.Email = User().Email)),
   Notify("Create an item now", NotificationType.Success),
   Notify("You can't add 2 items", NotificationType.Error)
)

Set the DisplayMode property of the "Submit" button to following:

If(
   EditForm1.Mode = FormMode.New && !IsBlank(LookUp('YourSPList', 'Created By'.Email = User().Email)),  /* <-- EditForm1 represents the Edit form in your app */
   DisplayMode.Disabled,
   DisplayMode.Edit
)

Above LookUp formula may cause a Delegation warning issue, if the amount of your SP List records is not more than 2000, you could ignore this warning issue. Please consider set the "Data row limit for Non-delegable queries" option within the Advanced settings of App settings of your app to maximum value -- 2000. Then you could process 2000 records in your app locally at most.

More details about the Delegation in PowerApps, please check the following article:

Delegation

If the amount of your SP List is more than 2000, please check and see if the alternative solution mentioned within the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/Pulling-in-large-ish-SQL-tables/m-p/243777#M7...

Set the OnStart property of the App control to following (I assume that there are 10000 records in your SP list):

Concurrent(
    ClearCollect(col1, Filter('YourSPList', ID >= 1 && ID <= 2000)),
    ClearCollect(col2, Filter('YourSPList', ID >= 2001 && ID <= 4000)),
    ClearCollect(col3, Filter('YourSPList', ID >= 4001 && ID <= 6000)),
    ClearCollect(col4, Filter('YourSPList', ID >= 6001 && ID <= 8000)),
    ClearCollect(col5, Filter('YourSPList', ID >= 8001 && ID <= 10000))
);
ClearCollect(MergedCollection, col1, col2, col3, col4, col5)

Then modify above formula as below:

If(
   IsBlank(LookUp(MergedCollection, 'Created By'.Email = User().Email)),   /* ues MergedCollection as data source instead of Original SP List */
   SumitForm(EditForm1);Notify("Create an item now", NotificationType.Success),
   Notify("You can't add 2 items", NotificationType.Error)
)

...

 

then re-load your app, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 205 members 3,541 guests
Please welcome our newest community members: