- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-16-2020 11:42 AM
Hi,
There is an OOB UI action condition as below:
current.canWrite() && (current.state!=ProblemTaskState.States.ASSESS)
where ProblemTaskState is a script include.
How can a script include be called without instantiating (no new keyword is used).
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-16-2020 12:54 PM
When you write a Script Include to create a Javascript class, it can have instance properties and static properties.
Normally you declare instance properties for methods (functions) and variables. You do this by declaring them inside the prototype definition. Methods declared in this fashion can use the "this" keyword to reference instance variables. In other words, the different methods within the Script Include can share data with each other.
However, you can also declare static functions and variables.
Notice the syntax used to declare ProblemTaskState.States
ProblemTaskState.States = { NEW: ProblemTaskStateSNC.NEW, ASSESS: ProblemTaskStateSNC.ASSESS, WORK_IN_PROGRESS: ProblemTaskStateSNC.WORK_IN_PROGRESS, CLOSED: ProblemTaskStateSNC.CLOSED };
Notice how it has been declared outside of the prototype definition. When functions and variables are declared in this manner, you can reference them without using the new keyword. The disadvantage is that functions declared in this manner do not have access to this. Static functions cannot share data with other functions in the Script Include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-16-2020 12:09 PM
At the very least, a call to a script include would contain parenthesis, like :
new ProblemTaskState().function().
This is simply comparing the value of the current (form) state field value to the ProblemTask.state value of 'ASSESS'.
This looks like a condition to execute a script.
Does this help?
-Chris

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-16-2020 12:54 PM
When you write a Script Include to create a Javascript class, it can have instance properties and static properties.
Normally you declare instance properties for methods (functions) and variables. You do this by declaring them inside the prototype definition. Methods declared in this fashion can use the "this" keyword to reference instance variables. In other words, the different methods within the Script Include can share data with each other.
However, you can also declare static functions and variables.
Notice the syntax used to declare ProblemTaskState.States
ProblemTaskState.States = { NEW: ProblemTaskStateSNC.NEW, ASSESS: ProblemTaskStateSNC.ASSESS, WORK_IN_PROGRESS: ProblemTaskStateSNC.WORK_IN_PROGRESS, CLOSED: ProblemTaskStateSNC.CLOSED };
Notice how it has been declared outside of the prototype definition. When functions and variables are declared in this manner, you can reference them without using the new keyword. The disadvantage is that functions declared in this manner do not have access to this. Static functions cannot share data with other functions in the Script Include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-17-2020 09:08 AM
Hi Giles, thank you for the detailed explanation.