answer = (function transformEntry(source) { Syntax

Meloper
Kilo Sage

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);

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Meloper 

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

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

View solution in original post

15 REPLIES 15

Pranav Bhagat
Kilo Sage

Hi

you can simply use

 

answer = function(){

your code

}

 

Regards

Pranav

I only want to understand this function

these are self invoking function ,that means they will be invoked automatically the same way as business rules.

Regards

Pranav

Thank you