what does this mean "current.caller_id == gs.getUserID() && (current.incident_state.changesTo(6) || current.incident_state.changesTo(7))" ?

gangasatishgurr
Kilo Expert

Please explain the above the code

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Ganga,



Current.caller_id and gs.getUserID() returns the sys_id of the user.


Current.incident_state.changesTo(6)...It determines if the new value of the incident state is changed to the value 6.


http://wiki.servicenow.com/index.php?title=GlideElement



I hope this helps.


Kalaiarasan Pus
Giga Sage

Request you to go through basic ServiceNow scripting links and watch Technow videos. Attending a service now training would help better if it is feasible.


ayan_hc
Giga Contributor

Hi Ganga,



This is a condition, the condition here says that current.caller_id states that current value of caller id of a particular form is = gs.getUserID which is finding the user id of the person who is viewing the form or opened the instance, so it means that it will return true if both only if both the person who has opened a ticket and is viewing the incident record from his private session.



Now the second part, it checks current.incident_state.changesTo(6) or current.incident_state.changesTo(7), here 6 means resolved and 7 means closed if it is Out of Box, so if the state changes from current value which might be assigned or in-progress or pending to resolved or closed then it will return true and some action would be performed.



Just to let you know that what Kalai has said in the earlier post is what I believe you need to go through, it will help you.



Regards,


Ayan


chaitu5
Kilo Contributor

what does this mean "current.caller_id == gs.getUserID() && (current.incident_state.changesTo(6) || ...


Current.caller_id is the field on the table(incident) and it will give the sys_id of the caller.


gs.getUserID() will return the logged in sys_id of the logged in user.


current.incident_state.changesTo(6) and   current.incident_state.changesTo(7) will return true when state changes to 6 or 7.



(if sys_id of the caller and logged in user sys_id is same ) and the state of the incident changes to 6 or 7 code will execute..