- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2020 10:55 PM
Is this a function that calls itself simultaneously?
I am concerned here with the syntax
We name the function and execute it directly without
transformEntry(); to need?
An using der Object Source?
answer = (function transformEntry(source) {
})(source);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2020 11:37 PM
that is the Self-executing function
A self-executing function is both declared and invoked within the same script field. Whenever writing a script that only needs to run in a single context, such as a transform map script, use this type of function. For functions that must run in multiple contexts, consider reusable functions instead.
answer is the OOB variable which is available and holds the value to be stored in the target field when used in field map script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2020 11:47 PM
Hello Meloper,
By enclosing your script in a self-executing function you can ensure that the script does not impact other areas of the product, such as by overwriting global variables. A self-executing function follows this format:
You can declare functions within the self-executing function. These inner functions are accessible only from within the self-executing function.
Refer below links, it may help you to solve your query.
https://community.servicenow.com/community?id=community_blog&sys_id=b4fca2a5dbd0dbc01dcaf3231f961902
https://docs.servicenow.com/bundle/madrid-application-development/page/script/general-scripting/concept/immediately-invoked-function-expressions.html
Kindly mark my answer correct & helpful; if it's useful to you.
Thanks & Regards,
Pooja Devkar
DxSherpa Technologies Pvt. Ltd