The CreatorCon Call for Content is officially open! Get started here.

How to modify TaskStateUtil script include?

Naga23
Giga Expert

Hi All,

 

We have a custom application and that is extended to task table. The issue here is when records of custom application is marked as resolved/closed we need tomake task active false. for that I wanted to modify the TaskStateUtil script include. I want to include custom state values of application . below is the default states which are mention in the script include

 

SYSTEM_DEFAULT_CLOSE : 3, // task closed complete state
SYSTEM_DEFAULT_WORK : 2, // task work in progress state
SYSTEM_INACTIVE_STATES : [3, 4, 7], // task default inactive/close states

 

Please suggest me here how to add my custom application states to that Script include

1 ACCEPTED SOLUTION

ChrisBurks
Giga Sage

I believe you don't need to modify the script to apply your own closed states. Since your table extends task that script is already being applied and it will check the overrides attribute to see if you defined any new closed states.

What you need to do is go to your table and follow these steps:

  1. right click on State
  2. Choose Configure Dictionary
  3. Scroll down and click on the Dictionary Overrides tab
  4. If there isn't an override record listed for your table select New or if there is a record click on it
  5. For the table field make sure your table is selected
  6. Check the Override Attributes checkbox
  7. The Attributes field should now be visible
  8. In that field define your closed/in progress parameters like the following using your values:
    1. close_states=3;7;207,default_close_state=207,default_work_state=18 .  (notice close states are separated by semi-colons)
  9. Click update/save

Now the next time one of your custom records change to one of the states defined it will set the Active field to false making the record inactive or closed. In the example above the record would be considered inactive if the state's value is either 3,7 or 207. And the default closed state is 207

find_real_file.png

View solution in original post

5 REPLIES 5

ChrisBurks
Giga Sage

I believe you don't need to modify the script to apply your own closed states. Since your table extends task that script is already being applied and it will check the overrides attribute to see if you defined any new closed states.

What you need to do is go to your table and follow these steps:

  1. right click on State
  2. Choose Configure Dictionary
  3. Scroll down and click on the Dictionary Overrides tab
  4. If there isn't an override record listed for your table select New or if there is a record click on it
  5. For the table field make sure your table is selected
  6. Check the Override Attributes checkbox
  7. The Attributes field should now be visible
  8. In that field define your closed/in progress parameters like the following using your values:
    1. close_states=3;7;207,default_close_state=207,default_work_state=18 .  (notice close states are separated by semi-colons)
  9. Click update/save

Now the next time one of your custom records change to one of the states defined it will set the Active field to false making the record inactive or closed. In the example above the record would be considered inactive if the state's value is either 3,7 or 207. And the default closed state is 207

find_real_file.png

Thank you mate 🙂

Is this info available in the docs site? If not, why not?!?!?!?!

It is in the documentation. You can find it under Now Platform Administration > Table Administration > Data Dictionary Tables > Dictionary Attributes

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/reference-pages/concept/c_DictionaryAttributes.html