How can I set the initial state of a new Change Request?

dschaefer
Mega Expert

When I create a new change request, its state is automatically set to "Pending" (integer value -5). The default value for table element change_request.state is "Awaiting Implementation" (integer value 1). Similarly, the default value for its parent, task.state, is 1. Somehow the state is being set to -5 when the Change Request is created. I'd just like to know where the state value is being set, because I'd like to set it to another value by default.

BTW: I searched through Business Rules and could find nothing. (I even used the business rule debugger to look for business rules I might not have seen in my search.)

Thanks,

Dan

4 REPLIES 4

Mark Stanger
Giga Sage

Have you checked to see if there's a dictionary override in place for the change request table?   That would be my first guess.



Dictionary Overrides - ServiceNow Wiki



You might also check to see if this happens for every change or just from the specific link you're clicking on.   If it's just for that particular link, it's probably in the link definition itself.


Thanks Mark,



I looked in the dictionary override and didn't see an entry for change_request. There was an override for task, but it was the same as the default. Regarding the link, I looked for values being set in the URL, but the only thing I could find was setting the "active" value to "true," which is its default anyway. :-S



I'll probably end up writing a special business rule and see if that works. (I may have to move its order up to a high number.)



Thanks again,


Dan


tonyshabani
Kilo Expert

Are you positive that "Awaiting Implementation" is the only choice within state that has a value of 1? Because it is shared by many tables it is possible that the state is being set to another choice with the same value. If this is not the case and you are positive that the debugger has not found any Business Rules setting the value, you may want to try creating your own.



I created a Business Rule in the demo environment that is working for me where upon insert I set the state:



DemoBR.PNG




Regards,



Tony


Thanks Tony,



Your solution works; however, I actually have to save the Change Request to get the Business Rule to kick in. But that's good enough for now.



I'll use this solution, but I'd just like to know how the default ended up being "Pending" in the first place. I never feel good about plastering over an unknown if I don't understand the root cause. But in the interest of time, I'll have to march forward and put this little mystery behind me. (It will have lots of company!)



To answer your question, "Awaiting Implementation" (integer = 1) is the only value for the state field when it's used within the Change Request table. Indeed, I've noticed that the same field is used in several tables, and it's interpretation can appear ambiguous. I learned to look at the identity of the table where it's used in order to get clarity on its meaning.



Anyway, your solution works, so I'm good to go on to the next challenge.



Thanks again to you and Mark.


-Dan