# Generate sequential Unique ID for property without any prefix

**URL:** <https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755>\
**Category:** User Experience\
**Tags:** 8-7, dev-designer-studio, system-administration, user-experience, case-management\
**Created:** [June 15, 2022, 10:45am UTC](https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755 "2022-06-15T10:45:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NirmalaJ2240](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@NirmalaJ2240](https://forums.pega.com/u/NirmalaJ2240)\
**Post date:** [June 15, 2022, 10:45am UTC](https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755/1 "2022-06-15T10:45:57Z")

</div>

Hi All,

I have a requirement to generate unique ID for one of the property in Case which should be increased by one on creating every new case. Please help me with the steps to generate unique Id for a property which should be sequential for every case creation.

For ex: On first case, it should be 100 and on next case it should be 101

Thanks,

Nirmala J

---

<div class="post-metadata">

**Author:** ![MarijeSchillern](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/marijeschillern/32/23321_2.png) [@MarijeSchillern](https://forums.pega.com/u/MarijeSchillern)\
**Post date:** [June 15, 2022, 11:09am UTC](https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755/2 "2022-06-15T11:09:47Z")

</div>

@NirmalaJ2240 Please see support article [Case IDs increase daily by 1000](https://community.pega.com/support/support-articles/case-ids-increase-daily-1000) (SA-103704)

Also review [SA-60811](https://community.pega.com/support/support-articles/pylastreservedid-counter-pcdatauniqueid-table-reset) :

You can manually reset PYLASTRESERVEDID values in the PC\_DATA\_UNIQUEID table for a number of impacted object IDs to the correct values for the corresponding objects.

You can also consider using the Market Place “Unique ID Generator for Pega Cases” :

**[Unique ID Generator for Pega Cases | Pega](https://community.pega.com/marketplace/components/unique-id-generator-pega-cases)**

The use of 'idGenerator/defaultBatchSize ’ is documented here:

**[Case ID generation mechanism | Support Center](https://collaborate.pega.com/discussion/case-id-generation-mechanism)**

**[Pegasystems Documentation](https://community.pega.com/knowledgebase/articles/whats-new-pega-platform/increase-performance-work-id-generation-83)**

You can disable it with the DSS setting or just keep it, which is what we recommend since it increases performance.

If you set the batchsize to be 1, then you’d get performance comparable to the legacy ID generation. We suggest clients to make a decision based on their usage, do you want performance for ID generation? Are you creating thousands of cases an hour? Then stick with higher value of batch size. If performance is not important to you then set batchsize to a small number.

The best practice here is to ignore IDs or the sequence in which IDs are generated. Clients should not rely on a smaller ID to indicate a case that was created prior to a case with higher ID. If client takes this advice, then there’s no need to set batchsize to 1; keep it at the default value of 1000

If you want the batch size to differ with case type, you could create another Dynamic System Settings (ex. idGenerator/P-/batchSize).

In a multi application environment, caseId generation depends upon database rather than application. For example, if we have two application namely App1 and App2 with case types as CTApp1 and CTApp2 respectively with same case prefix as ‘P’, the case ID’s being generated at App1 will be P-1001, P-1002 and in App2 will be P-1003 , P-1004 and so on, which explain that caseID generation depends on database rather than application.

Please see this documentation:

> **[Unique Id generation | Support Center](https://support.pega.com/question/unique-id-generation)**
>
> How to generate an unique id in Pega ? Plz explain step by step.

> **[Sequence of case IDs generated is incorrect | Pega](https://community.pega.com/support/support-articles/sequence-case-ids-generated-incorrect)**
>
> Summary When a user creates cases, the case IDs generated are not sequential. Example of the sequence of the case IDs generated: TAX-E 2001, TAX-E-9 and TAX-E-3145. Error Messages Not Applicable 

> **[Case ID generation mechanism | Support Center](https://support.pega.com/discussion/case-id-generation-mechanism)**
>
> Hi, In this post, I am sharing case ID generation mechanism and how it can be customized.   First of all, case ID consists of three parts - \[prefix\]-\[integer\]-\[suffix\] as shown below.

> **[Work Unique ID (pyLastReservedID) getting increased abruptly post upgrade to...](https://support.pega.com/question/work-unique-id-pylastreservedid-getting-increased-abruptly-post-upgrade-pega-83)**
>
> Hi All, Recently our pega7.3 application got upgraded to pega8.3. It is based on pega cloud and postgres DB. Post upgrade our application is behaving abruptly. The uniqueID (instance of Data-UniqueID) is getting increasing abruptly. That means, if...

> **[Case ID sequence Incorrect when case is created in Pega 8.3 | Pega](https://community.pega.com/support/support-articles/case-id-sequence-incorrect-when-case-created-pega-83)**

---

<div class="post-metadata">

**Author:** ![NirmalaJ2240](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@NirmalaJ2240](https://forums.pega.com/u/NirmalaJ2240)\
**Post date:** [June 16, 2022, 6:00am UTC](https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755/3 "2022-06-16T06:00:55Z")

</div>

Hi @MarijeSchillern,

Thanks for sharing detailed explanation. It is working.

What should be done in order to create unique sequential number starting from 1000 or five digit number instead of 1?

Thanks,

Nirmala J

---

<div class="post-metadata">

**Author:** ![AkshithReddyT](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/akshithreddyt/32/23910_2.png) [@AkshithReddyT](https://forums.pega.com/u/AkshithReddyT)\
**Post date:** [June 16, 2022, 10:10am UTC](https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755/4 "2022-06-16T10:10:41Z")

</div>

@NirmalaJ2240 Hi,

1. Use @pzGenerateUniqueID(tools, “prefix\_here”), to increment from 1. (A-3)
2. Then from this, use WhatComes function after “-” (3)
3. From that add require number, (103, if the no is 100)

And also this this will help u to get the random number but not sequential, **round(random(min,max))**

---

<div class="post-metadata">

**Author:** ![GAURAVTYAGI](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@GAURAVTYAGI](https://forums.pega.com/u/GAURAVTYAGI)\
**Post date:** [November 27, 2022, 6:39pm UTC](https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755/5 "2022-11-27T18:39:04Z")

</div>

@MarijeSchillern Hi, do we have any OOTB Pega Rest API exposed for this unique ID generator ? I want to use this for Payment Reference ID ,if possible.

Regards,

Gaurav Kumar Tyagi

---

<div class="post-metadata">

**Author:** ![MarijeSchillern](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/marijeschillern/32/23321_2.png) [@MarijeSchillern](https://forums.pega.com/u/MarijeSchillern)\
**Post date:** [November 28, 2022, 9:28am UTC](https://forums.pega.com/t/generate-sequential-unique-id-for-property-without-any-prefix/2755/6 "2022-11-28T09:28:05Z")

</div>

Hi @GAURAVTYAGI.

REST API documentation can be found [here](https://docs-previous.pega.com/data-management-and-integration/86/creating-rest-integration-using-create-rest-integration-wizard) and [here](https://docs.pega.com/bundle/platform-88/page/platform/data-integration/viewing-application-specific-rest-apis.html). There are some further details in the discussion [How to get the next auto-increment ID in Pega](https://support.pega.com/discussion/how-get-next-auto-increment-id-pega)

As this thread is closed and your question is different could I suggest to you that you Ask a [New Question](https://support.pega.com/node/add/question)?
