Set active to False

Jeffce
Tera Expert

Is this a business rule? I have changes that are closed incomplete but still show active? Where is this flag set?

 

Thanks JJ

1 ACCEPTED SOLUTION

marcguy
ServiceNow Employee
ServiceNow Employee

very simple example, if phase is closed or withdrawn, then set state to closed:


condition: current.phase_state.changesTo('closed') || current.phase_state.changesTo('withdrawn')


script:



current.active=false;


if (current.phase_state.changesTo('closed'))


{current.state = 3;}


  if (current.phase_state.changesTo('withdrawn'))


  {current.state = 7;}


View solution in original post

11 REPLIES 11

zheil
Mega Expert

Check your 'Task Active State Management' business rule on the task table.


Tyler Hoge - Gl
Tera Guru

the 'TaskStateUtil' script include should get you in the right direction. There currently is an issue that we are having with setting the inactive states in the dictionary override and serviceNow has an open problem ticket for this.


Jeffce
Tera Expert

So here is my issue, When fruition helped us set up our change process they used u_status instead of the state field, Would it be better to add the status to what you mentioned above, or would you think it be better to write a script that if the status changes to this to set the state to closed? And how would i word something like this in either?


marcguy
ServiceNow Employee
ServiceNow Employee

we have a similar thing on change with phase and phase_state, we just wrote a business rule to synch state up with phase/phase state so that state updates when those fields are updated, we just kept state as is open,in progress, closed complete, it's not a visible field but just helps to keep active true/false.