How to increment numbers in a variable field in a request item?

Debbi L
Tera Expert

I think I may be making this more complicated than I should, so I'm throwing this out to the experts.

I have a request item that contains several variables that feed into a series of approvals. The first variable question is a string that we've called "IT Change Control Number." The business group who controls the workflow would like, instead of trying to maintain a separate list of available numbers, for the form to create an autofilled, generated number that is sequential and uninterrupted (for audit purposes). Which means that I can't set this up to auto-populate when the record is opened, because if the user abandons the request, that number will disappear. I want to fill the field on submit, which doesn't sound like it should be too difficult. I've created a table for it to pull from, containing the prefix (as a 3 character string, this will remain the same), the current year, and then the integer field, which we'll increment for each submitted request. The end result will appear thus: XXX2017-1001. And...I'm not sure where to go from here. I'm a scripting neophyte, if that tells you anything. Thank you in advance!!!

1 ACCEPTED SOLUTION

Mukesh Sharma
Giga Expert

Well I do not see a need to create a new table for this . but since you have created a table . and your first two things you are picking from that table (static string and year ) you can also create the third field to store the number. and after that



1. create on submit client script .


2. call an script include from on submit client script .


3. write a code in script include to get all three values from table and while retrieving the values . increment the third field value and save the record (so everytime when you create the request . you will pick the last field value and increment it by one and save it back ).


4, make your string with combining all 3 values and and return it to onSubmit client script .



Kindly let me know if I got your requirement correctly . There are other ways as well to do this requirement . which wont require any table.




Kindly mark helpful if it helps.


View solution in original post

8 REPLIES 8

Mukesh Sharma
Giga Expert

Hi Debbi,



yeah looks like you made it complicated . Can you please explain how you want that variable to be populated for each RITM ? Its too much text for me to get the actual requirement from it .


LOL, I should clarify - the *requirements* made it complicated, and then I have to make it work.



The variable is part of the form that creates the request. It is reportable, but not an actual RITM field.


find_real_file.png


find_real_file.png


Mukesh Sharma
Giga Expert

Yeah I got the point . So whats the requirement now ?   What functionality you want ?


Oh, I'm sorry. Currently, the IT Change Control Number is filled in manually. I need to auto-populate on submission of the request form with an incremented number that will be a string derived from a table with three fields: One is static, one changes automatically with the year, and the third is incremental.