cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

How to auto populate title field in gallery tied to SharePoint list.

Hello,

 

Scenario:

 

I want to auto populate the title field in a new "edit" form The source is a SharePoint list. I want this number to increment ever time the new submit form is navigated to.

 

Title number text looks like this:     Job-000001

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

@ShadowTech 

Firstly, I'd create a Helper column in SharePoint that holds the numeric part of your Job number and set it as Type Number.

 

You can then get the last / highest number in your list using

 

Set(vLastJobNum, First(Sort(yourListName, helperColumnName, Descending)).helperColumnName)

 

Note: this may throw a Delegation warning but you can ignore this because you are only getting one record.

 

Then, on Navigation to your Form screen (or the OnVisible property) use this:

 

Set(vNewJobNum, Concatenate("Job-", Text(Value(vLastJobNum)+1, "00000")))

 

 

Then inside your Form on the Title datacard use the variable vNewJobNum as the Default value/property.

 

Depending on your App's flow ie how it functions, you may need to run both of the above formulas at the same time, it just depends really.

 

EDIT: I forgot to mention, you will need to update the helperColumn somehow. My suggestion would be to add the DataCard for the HelperColumn into your Form, set it's Default to Value(vLastJobNum)+1, then set it's Visibile to false. Then, when your Form is Submitted, it will update with the latest Numeric value of your Job Number.

View solution in original post

7 REPLIES 7
Highlighted
Super User II
Super User II

@ShadowTech 

Firstly, I'd create a Helper column in SharePoint that holds the numeric part of your Job number and set it as Type Number.

 

You can then get the last / highest number in your list using

 

Set(vLastJobNum, First(Sort(yourListName, helperColumnName, Descending)).helperColumnName)

 

Note: this may throw a Delegation warning but you can ignore this because you are only getting one record.

 

Then, on Navigation to your Form screen (or the OnVisible property) use this:

 

Set(vNewJobNum, Concatenate("Job-", Text(Value(vLastJobNum)+1, "00000")))

 

 

Then inside your Form on the Title datacard use the variable vNewJobNum as the Default value/property.

 

Depending on your App's flow ie how it functions, you may need to run both of the above formulas at the same time, it just depends really.

 

EDIT: I forgot to mention, you will need to update the helperColumn somehow. My suggestion would be to add the DataCard for the HelperColumn into your Form, set it's Default to Value(vLastJobNum)+1, then set it's Visibile to false. Then, when your Form is Submitted, it will update with the latest Numeric value of your Job Number.

View solution in original post

Highlighted

@Eelman 

 

Where am I inputting this?

 

Set(vLastJobNum, First(Sort(yourListName, helperColumnName, Descending)).helperColumnName)

 

And can you please explain about running them at the same time?

 

Thanks again for your help.

Highlighted

@ShadowTech 

re: Where am I inputting this?

That depends. Say you have a Gallery where users can see options to select that take them to your Form screen, you can add this code before the Navigate() function ... or ... you can use it in the OnVisible property of your Form screen.

 

If you don't want to do either of these, you can just have a button/icon/label and set the OnSelect property to this code. It really depends on the flow of your app.

 

By 'Running at the same time' I mean join the code together. For example, if you decided to place the code before your Navigate() function (my first option above) then you would add both code blocks before the Navigate function ie 'Run them together', if that makes sense?

Highlighted

@ShadowTech 

Just checking in to see if you managed to solve your issue? I'm happy to help further if you are still stuck, just let me know.

Highlighted

@Eelman 

 

So It populates the field but with the value that's in the helper column. A change it a bit around:

 

Title number increments : JOB-900001, JOB-900002, JOB-900003...

 

In the helper column which is a number type I put 90000. It populates the Title field but only with the number in that field...90000.

 

HomeScreen button that navigates to the new form screen:  

 

Set(vLastJobNum, First(Sort(ARSC, AutoPopHelper, Descending)).AutoPopHelper); NewForm(Form2_2);Navigate(SubmitNewScreen)

 

OnVisible (New form screen):

 

Set(vNewJobNum, Concatenate("JOB-", Text(Value(vLastJobNum)+1, "[$-en-US]90000")))

 

Thanks in advance.

Highlighted

@Eelman 

 

Its only incrementing what's in the helper column not what's in the title column. So the number never changes when navigating to the new form screen.

Highlighted

@Eelman 

 

Figured it out. Forgot to add the variable to the helper column. Works now.

 

Thanks for your help!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,092)