GetNextNumber Use Case
In this example, we are looking at a webpart where you can enter a list name and select the ADD LIST button to create the list.
Below is the ADD LIST button process. First we check to see if a list with this name already exists. If the list does not exist, we then run the GetNextNumber service for the EC_List entity type. GetNextNumber will return a unique primary key for the EC_List entity type.
In our example, GetNextNumber returned a unique key for EC_List of LIST-10002808. We then run an insert into sql statement and use the GetNextNumber value to populate the ListId column in the EC_List table with the value of LIST-10002808.
Next time that the GetNextNumber service runs for the EC_List entity type. The value returned will iterate to the next number of LIST-10002809.
Here you can see that the only required input for GetNextNumber is the entity type of the entity you need a unique key for.
Below is the log data for this example. You can see here that GetNextNumber returned a unique key of LIST-10002808.
When the button process completes, you will see a confirmation message that the list was successfully created.
Finally, when you close the confirmation message, the List of lists will reload and you can view the new list you have created.