Is it necessary to pass current object while calling script include from UI action condition?

Nick17
Giga Contributor

I am calling script include from UI action what will happen if i doesn't pass current object?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Nick,

it's not necessary to pass the current object since it is the same calling scope.

But it is recommended to pass the current object from the UI action to the script include function considering how objects are treated in javascript.

Refer below link for more explanation

https://snprotips.com/blog/2019/12/18/can-script-includes-use-the-current-variable

Just tested for Form button and it worked well without sending the current object in script include function and was able to print the incident number

Screenshots below

UI Action:

find_real_file.png

Script Include:

find_real_file.png

Output: Printing the current inc number

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Thanks Ankur

Very well explained

You are welcome.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader