cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tapesh
Post Prodigy
Post Prodigy

ID not generated properly : Too much duplication & how can you grant permission to selected users only

Hi all,

 

I started to work on application, the thing i started to note now is, 

my power apps application is not generating new Id for every entry or form being updated, where as it is creating alot of duplications. I want the ID to be Unique and only One for each Item being updated 

 

Please see the Screen shot. If you can suggest will be helpful. Thanks 

 

Also I want to know that how can i only allow user to see the list and not edit or do something else, but he should be able to .

update and edit the items from power apps not sharepoint. Is this possible ?

 

Display.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Tapesh ,

Yes, that maybe the reason.

If multiple people are editing the list at the same time, it will lead to data duplicated.

 

 

Best regards,

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

View solution in original post

8 REPLIES 8
eka24
Super User
Super User

I gave a similar solution on this platform. The idea is to check if the Number does not exist before it allows you to Submit the form or Patch the record. Knowing your Submit Formula would help but even before that follow this structure :
If(CountRows(Filter(TableName, Value(ID)=Value(DataCardValue.Text))) > 0,Notify("Number Exist",Notification.Error),SubmitForm(Form1)))
Thus, if exist give warning, else allow submission.

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution

v-yutliu-msft
Community Support
Community Support

Hi @Tapesh ,

Q1:

Do you mean that many duplicated ID value is updated by using powerapps?
Could you tell me which field represents  ID your list? Customer ID?

In sharepoint, there's already an unique field that will never be updated with duplicated value, which is called ID.

It will not display by default. You need to choose it to display.

3603.PNG

3604.PNG

 

What's more, if you want to make one field with unique value, you could set it:

3605.PNG

 

Q2:

Do you want to make user can only edit/create data from powerapps and only view data in sharepoint list?
Yes, this is possible.

Firstly, you can not set user's permission about the list because the site permission will work not only in sharepoint but also in powerapps.

For example, if you set one user's permission to be unable to edit, then he will be unable to edit records both in sharepoint and powerapps.

So I suggest you consider how user edit data in sharepoint.

Two places:

1)quick edit

2)sharepoint form

To disable the first one, you could set it in list settings->Advanced settings.

3606.PNG

 

3607.PNG

 

3608.PNG

 To disable the second one, I suggest you create a sharepoint custom form.

3609.PNG

 

Then set SharePointIntegration's OnNew:

ViewForm(SharePointForm1)

OnEdit: 

ViewForm(SharePointForm1)

OnEdit: 

ViewForm(SharePointForm1)

delete the formulas in OnSave and OnCancel.

3600.PNG

 

Then save and publish this form.

 

You will be unable to edit/save data in sharepoint list.

 

 

Best regards,

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

Thanks @v-yutliu-msft 

 

 The Sp List settings solutions looks good and accepeted as well, but the first is still not clear, i know that as you said Sharepoint has its unique ID filed, but that is not reset to 1 if the records are empty or null, this always keeps on Increasing even if recordsa re created, deleted or updated, which is why im using the cutsomerID column which is custom generated column. 

 

now the thing and issue here is, when the user logs in with different account, the customerID is generated as 1 if he is first time user, where as in the List there are already 4 records, which in result then should be 5, then 6 and so on, where as it is not. 

 

the cutomerID column in my power apps, generates the new ID for every new user/customer. 

 

Say im one User if i submit form that will be 1, then 2, and 3 and 4 and so on,

 

now say you are second user, 

even then the app generates the new ID which will be 1, and when you submit next time will be 2, and 3 and 4 and so on, 

 

 

where as the result here should be, 

1, 2, 3 , 4 , 5 ,6 no matter what, or how many users comes and go, 

 

also if they suppose updates 1 then id should be not changed, it should remain 1 the data can be changed. 

 

 

hope you got the thing now. 

 

have any solutions to this? 

 

Hi @Tapesh ,

Yes, the sharepoint system ID field indeed has the disadvantages that you said.

Could you show me

1)the date type of the customer ID field?

2)your settings of the custom generated column?

3)the updated formula of the custom generated column?

Maybe you just need to make a little change on your original settings.

What's more, have you set the field like I said to "enforce unique value"?
This could make this field value unique.

392.PNG

 If it is a calculated field or a generated automatically field, I'm afraid it's not supported to control it in powerapps. This kind of field is read-only in powerapps.

You could only change its settings in sharepoint.

If it is a field that could could be updated in powerapps, you could use this kind of formula to get the Id value that you should update with:

If(IsEmpty(LookUp(list,Employee.Email=User().Email)),
   Last(list).customerID+1,
   LookUp(list,Employee.Email=User().Email,customerID)+1
  )

 

 

 

Best regards,

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

hi @v-yutliu-msft 

 

Please see the details below: 

filed data type is: Text

Formula on CustomerId  Id: 

 

if(Edit_Emp_Form.Mode = New, First(
   Sort(
      'Petty Cash',
      CustomerID,
      Descending
   )
)
.CustomerID+ 1, ApplicationRecordsGallery.Selected.CustomerID)

 

Settings are default are i@m using the power apps customize mode. 

Hi @Tapesh ,

Is 'Petty Cash' the sharepoint list name?

Please set the customer ID field textinput's Default:

If(Edit_Emp_Form.Mode = New, First(
   Sort(
      'Petty Cash',
      CustomerID,
      Descending
   )
)
.CustomerID+ 1, ApplicationRecordsGallery.Selected.CustomerID)

 I've made a similar test.

In my test, 'Petty Cash' is the list name, not the view name. If you set the textinput's default to this formula, the generated customerid will not be duplicated.

 

 

Best regards,

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

Yes i have the same formula on my default, still having that issue i dont know why? is it something that, while im giving access to the people of my sharepoint list, they also become the member, which is why i guess this may be result. 

 

 

Any idea? 

 

@v-yutliu-msft 

Hi @Tapesh ,

Yes, that maybe the reason.

If multiple people are editing the list at the same time, it will lead to data duplicated.

 

 

Best regards,

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

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,916)