- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 12:36 PM
I have a script in my workflow that I want to make globally usable by other workflows. So, I added the script contents to the "Script Includes" table. Now I want to replace the script from the workflow with the newly created "Script Include", lets call it "global script". How do I replace the contents of my workflow's script and replace it with an include/call to "global script"?
Does this make sense. Any help or thoughts are appreciated!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 01:00 PM
From your workflow, I'm assuming you're using a "Run Script" activity, you need to initialize your script include that you created. Like so...
var scriptInclude = new scriptIncludeNameGoesHere();
Now that you've initialized your script include, you need to determine what function/method you want to trigger within the script include. It would look something like this..
var trigger = scriptInclude.functionNameGoesHere(//insert parameters here if you need to. If there aren't any, leave the parenthesis empty);
This line will trigger the method within your script include where you've moved your functionality and in your workflow, now you'd only have 2 lines of code and the Server side would be doing all of the lifting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2018 01:34 PM
I have an IF workflow activity where i need to determine if a person is a director level or above. the code in my IF is as follows:
The name of the script include is "directorAndAbove" and the function inside the include is "isYes". I pass the title and "true" or "false" is returned depending on if the regex matches.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 05:06 PM
Just as a side note, it seems that the only place you can call script includes on a workflow are the Script activities.
The same code just does not run calling it from the code area on an approval activity for example.
The solution was to load the script include on a Script activity and dump the values on the scratchpad and then call these from whenever you need.