public interface WorkflowContext
You can get information about the object whose workflow is executing the script as follows:
systemLog.debug("object type is " + workflowContext.getObjectType()); systemLog.debug("object key is " + workflowContext.getObjectKey());
You can get the key of the workflow definition that contains the script being called as follows:
systemLog.debug("workflow definition key is " + workflowContext.getWorkflowDefinitionKey());
You can find out information about the user who invoked the workflow action that called a script as follows:
Note that this exact method (caller = workflowContext.getCallerSubject(); systemLog.debug("workflow caller is " + caller.getInputName());
caller.getInputName()
) may not work in Community Manager workflows
that do not use derivatives of the com.soa.auth.credential.NameCredential
Several classes of variables can be accessed through the WorkflowContext
.
Any extra <arg>
elements specified with the runScript
function can be accessed as follows:
systemLog.debug("runScript arg [myArg} is [" + workflowContext.getScriptArg("myArg"));
When the runScript
function is included in the <common-functions>
,
then the <arg>
elements specified with the <functions type="common" name="..."
common function invocation can be accessed as follows:
a script as follows:
systemLog.debug("common function call arg [myArg} is [" + workflowContext.getFunctionArg("myArg"));
Finally, the standard workflow variables such as ${service.key}
can be access
as follows:
Note that the surroundingsystemLog.debug("service key is [" + workflowContext.getVariable("service.key"));
${}
is optional. "service.key"
and
"${service.key}"
are equivalent.
You can also set workflow variables that can be accessed by other functions and conditions in the current workflow action as follows:
Again the surroundingworkflowContext.setVariable("currentDate", new Date().toISOString()));
${}
for the variable name is optional.
Also be careful to not include a period in the variable name since
this has special meaning to workflow that is not meaningful when
setting variables.Modifier and Type | Method and Description |
---|---|
Subject |
getCallerSubject()
Returns the
Subject of the user who invoked the current
workflow action. |
java.lang.String |
getFunctionArg(java.lang.String name)
Returns the value of one of the
<arg> elements
configured for the <function> element that called
this runScript function that was defined using a
<common-function> element, |
java.lang.String |
getObjectKey()
Returns the key of the object being processed by the workflow.
|
java.lang.String |
getObjectType()
Returns the type of object this workflow is processing.
|
java.lang.String |
getScriptArg(java.lang.String name)
Returns the value of one of the
<arg> elements
configured for the runScript <function>
element. |
java.lang.String |
getVariable(java.lang.String name)
Returns the value of a workflow variable that is located
using the standard OS Workflow variable resolution process.
|
java.lang.String |
getWorkflowDefinitionKey()
Returns the key of the Workflow Definition being executed.
|
java.lang.String |
setVariable(java.lang.String name,
java.lang.String value)
Sets the value of a workflow variable.
|
java.lang.String getWorkflowDefinitionKey()
java.lang.String getObjectKey()
java.lang.String getObjectType()
java.lang.String getScriptArg(java.lang.String name)
<arg>
elements
configured for the runScript <function>
element.name
- the case-sensitive name of the <arg>
value to retrieve.null
if it is not definedjava.lang.String getFunctionArg(java.lang.String name)
<arg>
elements
configured for the <function>
element that called
this runScript function that was defined using a
<common-function>
element,name
- the case-sensitive name of the <arg>
value to retrieve.null
if it is not definedjava.lang.String getVariable(java.lang.String name)
name
- is the name of the workflow variable to be retrieved.
The name can optionally be in the form of ${name}.null
if it is not definedjava.lang.String setVariable(java.lang.String name, java.lang.String value)
name
- is the name of the workflow variable to be retrieved.
The name can optionally be in the form of ${name}. Do not include
periods in the variable name.value
- is the value to be assigned to the workflow variable.?? 2022 Perforce Software, All rights reserved
This software is the confidential and proprietary information of Perforce, Inc. and is subject to copyright protection under laws of the United States of America and other countries. The use of this software should be in accordance with the license agreement terms you entered into with Perforce, Inc.