cancel
Showing results for 
Search instead for 
Did you mean: 
sharepoint-aubu
Nintex Newbie

How can I use the last Item ID in a new form?

Jump to solution

I need to populate a field with a predefined title such as "CHG0001." The "1" being the ID for the item we are about to enter. So I believe I need to pull the ID from the newest item and add one to populate this field. 

Anyone have this before?

Reply
11 Replies
emha
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

have a look on this blog  

Reply
sharepoint-aubu
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

This is really good. However, these numbers aren't consecutive. 

How would I guarantee consecutive number?

Maybe, subtract 1 from the outcome? 

thoughts?

0 Kudos
Reply
courtney_shelto
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

Hmm, what is the use case that requires this to be populated on the form? Why not just not have this field appear on the "New" form and then you can set the field with workflow, and show the field in "Edit" and "Display" modes?

0 Kudos
Reply
sharepoint-aubu
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

I have thought about that. It would be easy just to build this field on create, but it's a requirement to have this show as a user is submitting the request. 

0 Kudos
Reply
pwarrak
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

Hi,

Create a field name "ToQuery" with default value "X".

Use the following formula in a calculated value:

Max(Lookup("ListName","ToQuery","X","ID",TRUE)) so you will get the max ID in the list.

TRUE is used to return multiple values in an array.

Am not aware of the strongly typed values.

Reply
emha
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

what you mean with they are not consecutive?

solution is based on by sharepoint generated item ID, which is definitely consecutive.

0 Kudos
Reply
emha
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

if this is the only reason, then I'd rather try to convince users/project owner that this is not the way how sharepoint works.

creating customized IDs just after an item is submitted is much simpler and straightforward solution.

Reply
sharepoint-aubu
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

the method you suggested causes the actual numbers to skip every other one. Because as you stated SharePoint generates the ID so with this method you create one to get the ID to the page, then you delete it. Therefore, you have a number on your page now (i.e.CHG1 ), but the one you are about to create is the next ID number (i.e. ID = 2). So when you create another request the new number generated for the page is the last ID + 1 making the new request number (i.e. CHG3). 1 and 3 are not consecutive.  

0 Kudos
Reply
sharepoint-aubu
Nintex Newbie

Re: How can I use the last Item ID in a new form?

Jump to solution

I will probably end up doing this, at least for now, but this is not a solution. Because it breaks the requirement.

0 Kudos
Reply