web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue with creating ne...
Power Apps
Unanswered

Issue with creating new Item number in sharepoint list for powerapps entry

(0) ShareShare
ReportReport
Posted on by 9

I have created PowerApp almost 1 year ago. Till today morning it was working well and suddenly today morning it started giving trouble.

 

Whenever new request is submitted from PowerApps, it creates one entry in Sharepoint list with unique Item Number. 

Example: If user "A" submits request his Item number will be 10. Later If user "B" submits request his Item number will be Previous item number + 1 (in this case, Item number for user "B" request will be - 11).

 

I have used below formula to read the last item number from SharePoint list and add + 1 to previous item number in sharepoint list to generate unique item number for each request. From today morning it was stopped creating new item number. All entries are getting created with duplicate item number same as previous one.

 

Refresh(NewITRequestList);
Set(
VarCaseID,
Last(NewITRequestList).Title + 1
);
Concurrent(
ForAll(
Cart_col,
Patch(
NewITRequest,
Defaults(NewITRequest),
{Title: VarCaseID},
{ItemName: ItemName},
{AssetCode: AssetCode},
{OrderType: OrderType},
{OrderedFor: OrderedFor},
{RequestorName: User().FullName},
{RequestorEmail: User().Email},
{Price: Price},
{ManagerName: Office365Users.Manager(User().Email).DisplayName},
{ManagerEmail: Office365Users.Manager(User().Email).Mail},
{CostCenter: CostCenter},
{AssetType:AssetType},
{Location:Location},
{RequestType:ReqType.Text},
{Status: {Value: "Pending Approval"}}
)
),
Patch(
NewITRequestList,
Defaults(NewITRequestList),
{
Title: VarCaseID,
Items: Ordereditems.Text,
CostCenter: CC.Text,
OrderType: OrderType.Text,
OrderedFor: OrderedFor.Text,
RequestorName: User().FullName,
RequestorEmail: User().Email,
ManagerName: Office365Users.Manager(User().Email).DisplayName,
ManagerEmail: Office365Users.Manager(User().Email).Mail,
OrderValue: TotalOrderValue.Text,
Status:"Pending Approval",
Location:bldg.Text,
Justification:Justification.Text
}
));
Navigate(ThankYou_1,ScreenTransition.Fade)

 

Can anyone suggest, what can be the issue.?

 

 

Categories:
I have the same question (0)
  • Verified answer
    Griffin_C Profile Picture
    125 on at

    I've created similar numbering functions in a couple of my apps, and have a couple tips that might help.

    First, you'll want to use:

    First(
     Sort(
     NewITRequestList,
     Title,
     Descending
     )
     ).Title + 1
    

    When setting your VarCaseID. This is because finding the last item in an unsorted list doesn't always give you the last number in a sequence, but rather the last thing that happens to be loaded in memory at that point. So instead, you want to sort the list descending so that the first item will always be the biggest number, no matter how much data is currently loaded. My guess is that your data exceeded the delegation limit, and can no longer find the true "last" item.

     

    Secondly, when doing this, I prefer to reference the ID column to find the largest unique number to patch to the Title column. Titles aren't always unique, but IDs will always be unique, so I find them more reliable. This isn't necessary if you trust your system, but if you want to try it, just replace "Title" with "ID" when setting the variable.

  • shreyasvkale Profile Picture
    9 on at

    Thanks @Griffin_C Sorting columns in descending order helped but I used different method.

     

    Set(varlastID,Value(First(SortByColumns('NewITRequestList',"Created",SortOrder.Descending)).Title));
    Set(
    VarCaseID,
    varlastID + 1

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard