Workflow Activity Definition - what is evailable from the script code?

alexthunder
Kilo Explorer

Dear All,

I wonder if someone could point us in the right direction with our challenge.

We are new to ServiceNow development, and making our first attempts ot implement a new Application. We have reeached the Workflows Definition section.

In the Workflow Activity Definition we can see the "Script" part which looks like the source-code written on either Java or JavaScript and it looks like opening the endless possibilities, BUT the questions is - how do we discover what is available from the source code of the script?

Let's say I write "var x =" and then what? What are the functions that are available to be called, what classes are available for making new instance of, what is the content of "this", what is the way to access the record in the database that is the subject of Workflow for the thread of code currently executed, or what is the way to make queries to other database tables?

I gues the general question is - where is the source of knowledge for finding answers to all these questions?

Cheers!

Alex

Experieco

10 REPLIES 10

Michael Fry1
Kilo Patron

Are you referring to the Run Script Workflow Activity? If yes, you can click the arrow on the right of the script box and it will expose the code you can use. Hope that helps.



aa.jpg


Thank you Michael,


but no - I'm referring to Workflow Activity Definition, which is available under Workflow / Administration / Activity Definitions. I am attempting to create my own Activity which I would hope to be responsible for resolving the values for some data columns based on input provided in other columns of the same record.



In the Workflow Activity Definition form there is no button that you illustrated in your comment.



May be I am approaching it from the wrong angle though. Can you tell me how do I get to the form which is in your screenshot?



Thanks!


Alex


Hi Alex,



What version of the platform are you running on? I would recommend using Activity Designer instead of Activity Definitions. Activity Designer provides support for Application Scoping.



The right design patter for Application Development is to use Application Scoping.



Activity Designer allows you to easily create reusable activities with well defined inputs and outputs. Activities created with Activity Designer leverage the Databus. So when you orchestrate activities, you can see the data flow through the system on the live workflow context.



You wont need to think about the code as much in Activity Designer.   You have pre-processing scripts for validation of inputs and data transformation before the execution command is run. You have post processing for manipulation of data before outputs.


Thank you Rebecca,


we are using version "F" (Fuji) and   we can't seem to be able to find neither Activity Designer nor Application Scoping within the keywords exposed via UI.



Can you give us the tip on where do we click to get there?