global functions to use in workflows

Avatar

Avatar
Validate 1
Level 1
Ramaswami
Level 1

Likes

0 likes

Total Posts

100 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
Ramaswami
Level 1

Likes

0 likes

Total Posts

100 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile
Ramaswami
Level 1

28-07-2020

Hi Team, 

 

Is there a possibility so that i can store a global function in one place and call it from anywhere in Adobe workflow javascript. 

 

i have found there is a node under Administration>Javascript nodes. i have created a new namespace : "cust:new" and written a function in the javascript file -XXX() and i have called this function in one of the workflow javascript and it throws an saying "XXX()" is not defined. 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

28-07-2020

Hi,

 

Globals have been long considered undesirable due to the complexity and risk they create.

E.g. you may want to create a function called onStart() to run at the start of a workflow, except that's taken by the software's event handler and would collide and create unexpected behavior.

That said, just loadLibrary() your file and it'll install whatever's in the global namespace there to the entire workflow. This is best done at the workflow level, i.e. Properties dialog, to make it centralized and predictable.

 

Thanks,

-Jon

Answers (0)