Add state to closed states

Tim94
Giga Contributor

Hi,

 

I want to add the new state (invalid/Junk - Value = 😎 on the incident table to the closed states. If the state is choosen, the active flag should be false, if the state is changed again (e.g. to new) then the active flag should be true again.

 

Best regards, Tim

10 REPLIES 10

nullreturned
Kilo Guru

Tim,


        What you'll have to do here depends on your goal.   Out of the box, the ACL for being able to write to the Incident record is that the state (and subsequently the incident_state) doesn't equal 7... which is closed.   Once those values equal 7, the record is in read-only mode.   It actually has nothing to do with the active flag.   So, this Invalid/Junk record has some things to think about.



This will produce a record marked as "inactive" but not read-only:


1.) Add state (and incident_state) of Invalid/Junk which has a value of 8


2.) Modify the "mark closed" business rule that is against the Task table to accommodate for this value.   The best way would be to change it to the Incidents table, set the condition to "current.state.changesTo(8)", and strip down the script to just mark the record as inactive.   Make sure to Insert, rather than Save or Update.


3.) Create another business rule, using the previous one as a template, with a condition "current.state.changesFrom(8)", and the script setting active = true.



Once again, this will not make the record read-only, only marked as inactive.   If you want to make the whole record read-only, except for maybe a button that can turn it back to a "New" state, that will require more programming and a bunch of ACL changes/additions.



Hope this helps,


Damian


Hi,



thanks for the reply, I only want to set the active flag, but I was of the opinion that there is a OOB functionality to do so.



Best regards, Tim


Rather than edit out-of-box rules, you can add the "close_states" attribute to the dictionary "collection" variable for your chosen table, then add a semi-colon separated list of the state numbers that you wish to be made inactive.



Dictionary Attributes - ServiceNow Wiki - Scroll down to the close_states attribute in the dictionary.



TaskStateUtil - ServiceNow Wiki - Section 1.2 demonstrates how this attribute affects the behavior of the TaskStateUtil Script Include.


Tim94
Giga Contributor

Hi,



I tried this way, and I would prfer it. But right now it ´s not working on Incident table. Do you have any Idea what could block this behavior?



Best regards, Tim