10.3 ECMAScript API

This section includes the following topics:

10.3.1 Form Action Script Methods

Unlike the ECMAScript that runs in other components of the workflow, form script executes on the Web browser, not the server. All directory access from within form script is handled by AJAX calls from the browser to the server.

This section lists all form action methods and properties supported by the ECMA expression builder. This section includes the following topics:

Form

Lets you work with Form methods. This section includes the following methods:

focus(fieldname)
form.focus(fieldname)

Sets the focus to the specified field. For list-based or choice-based controls, sets the focus to either the selected choice or when no selection is made, it sets the focus to the first choice. If a fieldname parameter is passed and that field is list or choice based, it sets the focus on the choices corresponding to the values parameter. If the value is an array, only the first value is used to determine on which check box or radio button to set focus. If the specified field is invisible or disabled, this method has no effect.

select(fieldname)
form.select(fieldname)

If no values parameter is passed in, this method sets the focus to the underlying text field. For list-based or choice-based controls, this method sets the focus to the selected choice or if no selection was made, to the first choice. If a values parameter is passed and the field is list or choice based it will set the focus on the choices corresponding to the fieldname parameter. This method has no effect on disabled or invisible fields.

activate(fieldname)
form.activate(fieldname)

A combination of setFocus() and select().

setRequired(fieldname, is-required)
form.setRequired("fieldname", is-required)

Sets the field to required if is-required is True or optional otherwise. A field that is required blocks the form submission if it is empty.

InterceptAction(actionname, order, function)
form.interceptAction("actionname", "order", "function")

Allows you to intercept the script attached to an action button. The function passed in is executed based on the order parameter.

Valid actionname values are SubmitAction and CancelAction.

The choices for actionname for an approval form are: ApprovalAction, RefusalAction, DenyAction, UpdateAction, CancelAction and CommentAction.Valid values for the advice parameter are:Before: The function is called before the script attached to the button executes.after: The function is called after the script attached to the button executes.around: The function is passed a parameter that allows you to decide whether to execute the script attached to the button The following example shows the submit action intercepted. The form is only submitted if the user replies Yes.

window.inv=function (invocation) { if (confirm( "Are you sure you want to submit ?")) { var result = invocation.proceed(); return result; }; };
form.interceptAction("SubmitAction", "around", window.inv);
getLocale()
form.getLocale()

Returns the current locale. Can be used as input for all methods that support a locale parameter.

getRBMessage()
form.getRBMessage(key)
form.getRBMessage(key, value[s])
form.getRBMessage(key, value[s], bundle)

This method tries to find an entry with key in the resource bundle with ID bId. The resourcebundle Java class should extend the java.util.ListResourceBundle.Parameter. The param can be used to pass in replacements for parameters ({0}, {1}, etc) in message "msg"; for example:

var msg = frm.getRBMessage ("mykey", ["value0", "value1"], "mybundle");
stringToDate()
form.stringToDate(date)
form.stringToDate(date, include-time)

Converts a date string to a Date. The format must correspond to the dateform for the current locale, as used in the DatePicker. The value of a DatePicker control can be converted with this method. Example:

form.showMsg("Date="+form.stringToDate(d,true));
dateToString()
form.dateToString(date)
form.dateToString(date, include-time)

Converts a date to a string that can be stored in the DatePicker, for example:

var d = form.dateToString(new Date(), true); 
form.setValues("hireDate", d);
isValidDate(date)
form.isValidDate(date)

Use this to validate the correct format for a date string.

isValidDate(date,include-time)
form.isValidDate(date, include-time)

Use this to validate the correct format for a date string.

alert(string)
form.alert("msg")

Displays a message in an alert box.

showMsg(string)
form.showMsg(msg, param, bId)

Adds a message to the status portion of the form. The msg string parameter can either contain the text of the message itself or it can contain a key pointing to an entry in the resource bundle bId. This method always tries to find an entry with the key msg in the resource bundle with the id bId.The param parameter can be used to pass in replacements for stakeholders ({0}, {1}, etc) in msg.

NOTE:If you want to add debugging messages to your script, it is better practice to use form.showDebugMsg().

Example:

form.showMsg("my message" {0},{1}", ["value0","value1"]);
showWarning(string)
form.showWarning(msg, param, bId)

Adds a warning to the status portion of the form.

The msg string parameter can either contain the text of the warning itself or it can contain a key pointing to an entry in the resource bundle bId. This method always tries to find an entry with the key msg in the resource bundle with the id bId. The param parameter can be used to pass in replacements for stakeholders ({0}, {1}, etc) in msg.

NOTE:If you want to add debugging messages to your script, it is better practice to use form.showDebugMsg() .

Example:

form.showWarning("my warning" {0},{1}", ["value0","value1"]);
showError(string)

showError(msg, param, bId);

Adds an error message to the status portion of the form.

The msg string parameter can either contain the text of the error itself or it can contain a key pointing to an entry in the resource bundle bId. This method always tries to find an entry with the key msg in the resource bundle with the id bId. The param parameter can be used to pass in replacements for stakeholders ({0}, {1}, etc) in msg.

NOTE:If you want to add debugging messages to your script, it is better practice to use form.showDebugMsg() .

Both normal and fatal errors block form submission. The distinction between a normal error and a fatal error is that normal errors get reset just before form validation occurs (because of a form submission). Fatal errors are remembered and therefore block the form submission unless you restart. A normal error only blocks submission if it is generated during the validation phase. If you add normal errors during onload or custom events, they are lost when the form is submitted.

NOTE:If you want to add debugging messages to your script, it is better practice to use form.showDebugMsg().

Example:

form.showError("my error" {0},{1}", ["value0","value1"]);
showFatal(string)

form.showFatal("my fatal" {0},{1}", ["value0","value1"]);

Adds a fatal error message to the status portion of the form.

The msg string parameter can either contain the text of the fatal error itself or it can contain a key pointing to an entry in the resource bundle bId. This method always tries to find an entry with the key msg in the resource bundle with the id bId. The param parameter can be used to pass in replacements for stakeholders ({0}, {1}, etc) in msg.

Both normal and fatal errors block form submission. The distinction between a normal error and a fatal error is that normal errors get reset just before form validation occurs (because of a form submission). Fatal errors are remembered and therefore block the form submission unless you restart. A normal error only blocks submission if it is generated during the validation phase. If you add normal errors during onload or custom events, they are lost when the form is submitted.

NOTE:If you want to add debugging messages to your script, it is better practice to use form.showDebugMsg().

Example:

form.showFatal("my fatal" {0},{1}", ["value0","value1"]);
enable(fieldname)
form.enable("fieldname")

Enables a field on a form.

disable(fieldname)
form.disable("fieldname")

Disables a field on a form.

NOTE:A disabled field still sends data back to the workflow engine. The content of a disabled field is validated when submitting the form or when calling the field.validate() method.

getValue(fieldname)
form.getValue("fieldname")

Returns the first value for the field. The type returned is always string, independent of the data type of the field. If the field does not have a value, the method returns an empty string if text can be entered into the field (like Text, TextArea, DatePicker, DNLookup) or it returns “undefined” if the control is choice-based (for example, StaticList, radio buttons, check boxes). For DN type controls, this method always returns the DN and never the display expression.

getValues(fieldname)
form.getValues("fieldname")

Returns a string array containing the values. If no values are found, the array is empty (size = 0). For DN type controls, this method always returns the DN and never the display expression.

setValues(fieldname)
form.setValues("fieldname", data-values, display values, KeepOldValues)

Sets a value. Supports multiple values. This method allows changing the available entries for list-based controls (for example, StaticList, MVCheckbox, PickList). By default, existing values are deleted unless the KeepOldValues parameter equals True. For non-list-based controls, the display values parameter is ignored.

If you want to set or change the initial value of a field, you should do so in an “onload” event.

NOTE:This method triggers the onchange event for the field.

Examples:

field.setValues("cn=jdoe,ou=users,ou=mysample,o=novell"); // for a DNLookupfield.setValues(["jdoe@novell.com", "test@novell.com"]) // for an MVEditorfield.setValues(["W","B"],["White","Black"],true); // for a StaticList

Field

Lets you work with Field methods. This section includes the following methods:

activate()
field.activate(value[s])

This method is a combination of field.focus() and field.select().

disable()
field.disable()

Disable the field.

NOTE:A disabled field still sends data back to the workflow engine. The content of a disabled field is validated when submitting the form or when calling the field.

enable()
field.enable()

Enable the field.

fireEvent()
field.fireEvent("eventname")

Fires a custom event. Passes the name of the custom event that is fired. To get the values of the event that is fired, use form.getValues(event.getOrigin()).

focus()
field.focus(value[s])

If no values parameter is passed in, this method sets the focus to the underlying text field. For list-based or choice-based controls, this method sets the focus to the selected choice if no selection was done to the first choice. If a values parameter is passed and if the field is list-based or choice-based, this method sets the focus on the choices corresponding to the values parameter. If the values is an array, only the first value is used to determine the check box or radio button to set focus. This method has no effect on disabled or invisible fields.

getLabel()
field.getLabel()

Gets the label associated with the field. If no label is found, this method returns the name of the field.

getName()
field.getName()

Gets the name of the field.

getValue()
field.getValue()

Returns the first value for the field. The type returned is always a string, independent of the data type of the field. If the field does not have a value, the method returns an empty string if text can be entered into the field (like Text, TextArea, DatePicker, DNLookup) or it returns “undefined” if the control is choice-based (for example, StaticList, radio buttons, check boxes). For DN type controls, this method always returns the DN and never the display expression.

hide()
field.hide()

Hides this field.

getValues()
form.getValues()

Returns a string array containing the requested values. If no values are found, the array is empty (size = 0). For DN type controls, this method always returns the DN and never the display expression.

show()
field.show()

Shows this field.

select()
field.select(value[s])

If no values parameter is passed in, this method sets the focus to the underlying text field. For list-based or choice-based controls, it sets the focus to either the selected choice or if no selection was made, it sets the focus to the first choice. If a values parameter is passed and if the field is list-based or choice-based it sets the focus on the choices corresponding to the values parameter. If the value parameter is an array, only the first value is used to determine which check box or radio button to set focus on. This method has no effect on disabled or invisible fields.

setRequired()
field.setRequired(is-required)

Sets the field to required if isRequired is True or optional otherwise. A field that is required blocks the form submission if it is empty.

setValues(fieldname)
field.setValues(data-values, display-values, KeepOldValues)

Sets a value. Supports multiple values. This method allows changing the available entries for list-based controls (for example, StaticList, MVCheckbox, PickList). By default, existing values are deleted unless the KeepOldValues parameter equals True. For non-list-based controls, the display values parameter is ignored.

If you want to set or change the initial value of a field, you should do so in an onload event.

NOTE:This method triggers the onchange event for the field.

Examples:

field.setValues("cn=jdoe,ou=users,ou=mysample,o=novell"); // for a DNLookupfield.setValues(["jdoe@novell.com", "test@novell.com"]) // for an MVEditorfield.setValues(["W","B"],["White","Black"],true); // for a StaticList
validate()
field.validate()

Triggers browser validation for the field. To validate the data entered in this field as soon as the user navigates to another field, call this method in the onchange event. Returns True if validation errors were detected, False otherwise.

Event

Lets you work with events. This section includes the following methods:

getEventName()
event.getEventName()

Returns the name of the event.

getOrigin()
event.getOrigin()

Returns the name of the field from which the event was triggered.

getValue()
event.getValue()

Returns a string that contains the first value in the event.

You should not use the value that is returned by this method, because it is possible that a user might have modified the data in the field since the event was triggered. Instead, you should use the value returned by the form.getValue method. For example, form.getValue(event.GetOrigin()). This ensures that you get the current value of the field. If you select event.getValue() from the pick list in the ECMA expression builder, form.getValue(event.GetOrigin()) is inserted.

getValues()
event.getValues()

Returns an array of strings that contains all values in the event.

You should not use the value that is returned by this method, because it is possible that a user might have modified the data in the field since the event was triggered. Instead, you should use the value returned by the form.getValues method. For example, form.getValue(event.GetOrigin()). This ensures that you get the current value of the field. If you select event.getValues() from the pick list in the ECMA expression builder, form.getValues(event.GetOrigin()) is inserted.

Lists

Lets you work with lists.

globalList(fieldname, key, locale)
IDVault.globalList("fieldname", "key", "locale")

Retrieves a global list from the directory abstraction layer, identified by the key of the global list. If the field name is specified, the result of the query is used to refresh the content of the field. To retrieve a list without storing the result in a field, use a null value for the fieldname parameter.The locale is optional. If locale is not specified, the locale in the HTTP request is used.

Example:

IDVault.globalList("dallist", "departments", "en");

Queries

Lets you work with queries.

globalQuery(fieldname, key, param)
globalQuery(fieldname, key, param)

Executes the predefined directory abstraction layer query key (see Queries General Properties). If the field name is specified, the result of the query is used to refresh the content of the field. To retrieve a list without storing the result in a field, use a null value for the fieldname parameter.The param parameter is used as input to the query. The parameter has the form {parname1:value,parname2:value}, in which the value can be an individual value or an array. The first column of the result list (always a DN) is used for the data value, the second column is used for the display label.

Example:

IDVault.globalQuery("canchangepwd", "getsites");  // query without a parameterIDVault.globalQuery("building", "getbuildings", {site:form.getValue("site")}); // query with one parameterIDVault.globalQuery("room", "getrooms", {site:form.getValue("site"), building:form.getValue("building")}); // query with two parameters

Container

Lets you work with containers.

containers(fieldname, rootdn, Search scope, Show DN)
IDVault.containers("test", rootdn, SearchScope, ShowDN)

Gets a list of containers, with the scope equal to “subtree” or the same level. The method returns an array with two entries, the first an array with the resulting DNs; the second entry an array with the display labels.

Table 10-11 Container Parameters

Parameter

Description

fieldname

If the field name is specified, the result of the query is used to refresh the content of the field. To retrieve a list without storing the result in a field, use a null value for the fieldname parameter.

rootdn

If the rootdn parameter is empty, the root container for the default entity is used.

scope

If the scope parameter is empty, one-level is used. Valid choices for scope are “o” (onelevel) and “s” (subtree).

showdn

If the parameter showDN is true, the full DN is used for the display label. Otherwise the naming part (for example, ou, dc) is displayed.

Example:

IDVault.containers("assetProp2", null, "o", true);  // set the entries in a StaticList to all containers directly under the root DN of the default entity

10.3.2 DOM Methods

This section lists all DOM-related methods and properties supported by the ECMA expression builder, including not only DOM-1 and DOM-2 extensions (defined by the relevant W3C standards), but also Designer’s own ECMAScript extensions. Extension methods are specifically noted as such in the text. DOM methods are displayed in the ECMA expression builder when you are working with expressions in the Integration activity.

This section includes the following topics:

Node

Lets you work with nodes. This section includes the following topics:

attributes

W3C DOM Level 1 Node property. This property returns a NamedNodeMap object of the attributes for the Node.

childNodes

W3C DOM Level 1 Node property. This property returns a NodeList object consisting of the immediate children of the Node.

firstChild

W3C DOM Level 1 Node property. This property returns the first child node of a Node object.

lastChild

W3C DOM Level 1 Node property. This property returns the last child node of a Node object.

nextSibling

W3C DOM Level 1 Node property. This property returns the next sibling node for a Node object.

nodeName

W3C DOM Level 1 Node property. This property returns the node name as a String object.

nodeType

W3C DOM Level 1 Node property. This property returns the node type as a short in with one of the following values:

  • 1 = Element
  • 2 = Attribute
  • 3 = Text
  • 4 = CDATASection
  • 5 = EntityReference
  • 6 = Entity
  • 7 = ProcessingInstruction
  • 8 = Comment
  • 9 = Document
  • 10 = DocumentType
  • 11 = DocumentFragment
  • 12 = Notation
nodeValue

W3C DOM Level 1 Node property. This property returns the node text data as a String.

ownerDocument

W3C DOM Level 1 Node property. This property returns a Document object.

parentNode

W3C DOM Level 1 Node property. This property returns the parent node object for a Node object.

previousSibling

W3C DOM Level 1 Node property. This property returns the previous sibling node for a Node object.

XML

Designer extension property. This property returns a string representing the DOM. Useful in Log actions for debugging components (for example, Input.XML).

appendChild(newChild)
Node appendChild(newChild)

W3C DOM Level 1 Node method. This method appends a node as the last child for a Node. The newChild parameter is of type Node.

cloneNode(deep)
Node cloneNode(deep)

W3C DOM Level 1 Node method. This method creates an unattached Node object. The deep parameter is of type Boolean.

createXPath(XPathType asPattern)
Object createXPath(XPathType asPattern)

ECMAScript extension method. Creates the XPath pattern. The XPath Type asPattern parameter only supports abbreviated XPath notation and explicit ordinals. XPath functions are not supported.

hasChildNodes()
boolean hasChildNodes()

W3C DOM Level 1 Node method. This method returns a Boolean indicating whether the node has children.

insertBefore(newChild, refChild)
Node insertBefore(newChild, refChild)

W3C DOM Level 1 Node method. This method inserts a node object into the parent node before the refChild node. The newChild parameter is of type Node. The refChild parameter is of type Node.

removeChild(oldChild)
Node removeChild(oldChild)

W3C DOM Level 1 Node method. This method removes a node from a parent and returns an unattached node. The oldChild parameter is of type Node.

replaceChild(newChild, oldChild)
Node replaceChild(newChild, oldChild)

W3C DOM Level 1 Node method. This method replaces one node with another node. The newChild parameter is of type Node. The oldChild parameter is of type Node.

getXML()
String getXML()

ECMAScript extension method. This property returns a string representing the DOM. Useful in Log actions for debugging components. Example:

Input.XPath("root/child").getXML()
ownerDocument

W3C DOM Level 2 modified Node property. Returns the Document object associated with this node. This is also the Document object used to create new nodes. Example:

someNodeObject.ownerDocument
namespaceURI

W3C DOM Level 2 Node property. Returns the namespace URI of this node, or null if the namespace URI is not specified. Example:

someNodeObject.namespaceURI
prefix

W3C DOM Level 2 Node property. Returns the namespace prefix of this node, or null if the namespace prefix is not specified. Example:

someNodeObject.prefix
localName

W3C DOM Level 2 Node property. Returns the local part of the qualified name of this node. Example:

someNodeObject.localName
normalize()
void normalize()

W3C DOM Level 2 modified Node method. Puts all Text nodes in the full depth of the subtree underneath this Node, including attribute nodes, into a “normal” form in which only structure separates Text nodes, (for example, elements, comments, processing instructions, CDATA sections, and entity references). In other words, there are neither adjacent Text nodes nor empty Text nodes.

hasAttributes()
boolean hasAttributes()

W3C DOM Level 2 Node method. Returns True if the node has any attributes; otherwise, returns False. Example:

Temp.XPath("A/B/C").item(0).hasAttributes()
isSupported(feature, version)
boolean isSupported(feature, version)

W3C DOM Level 2 Node method. Returns True if the specified feature is supported on this node; otherwise, returns False.

Table 10-12 Parameters of the IsSupported Method

Parameter

Features

feature

  • Core
  • XML
  • HTML
  • Views
  • Stylesheets
  • CSS
  • CSS2
  • Events
  • UIEvents
  • MouseEvents
  • MutationEvents
  • HTMLEvents
  • Range
  • Transversal

version

Specifies the version number of the feature to test. In Level 2, version 1, this is the string “2.0”. If the version is not specified, supporting any version of the feature causes the method to return True.

Example:

 aNodeObject.isSupported("Core","2.0")

Document

Lets you work with documents. This section includes the following topics:

doctype

W3C DOM Level 1 Document property. This property returns a DocumentType object reflecting the DTD for the document. A Document also has all the properties and methods of Node.

documentElement

W3C DOM Level 1 Document property. This property returns an Element object (the root element). A Document also has all the properties and methods of Node.

implementation

W3C DOM Level 1 Document property. This property returns a DOMImplementation object. A Document also has all the properties and methods of Node.

text

Designer extension property. This property returns a concatenated string of all the text nodes (content) under it.

createAttribute(name)
Attr createAttribute(name)

W3C DOM Level 1 Document method. This method returns an unattached Attr object. The name parameter is of type String. A Document also has all the properties and methods of Node.

createCDATASection(data)
CDATASection createCDATASection(data)

W3C DOM Level 1 Document method. This method returns an unattached CDATASection object. The data parameter is of type String. A Document also has all the properties and methods of Node.

createComment(data)
Comment createComment(data)

W3C DOM Level 1 Document method. This method returns an unattached Comment object. The data parameter is of type String. A Document also has all the properties and methods of Node.

createDocumentFragment()
DocumentFragment createDocumentFragment()

W3C DOM Level 1 Document method. This method returns an unattached DocumentFragment. A Document also has all the properties and methods of Node.

createElement(tagName)
Element createElement(tagName)

W3C DOM Level 1 Document method. This method creates an unattached Element. The tagName parameter is of type String. A Document also has all the properties and methods of Node.

createEntityReference(name)
EntityReference createEntityReference(name)

W3C DOM Level 1 Document method. Creates an unattached EntityReference. The name parameter is of type String. A Document also has all the properties and methods of Node.

createProcessingInstruction(target,data)
ProcessingInstruction createProcessingInstruction(target,data)

W3C DOM Level 1 Document method. This method returns an unattached ProcessingInstruction object. The target and data parameters are of type String. A Document also has all the properties and methods of Node.

createTextNode(data)
Text createTextNode(data)

W3C DOM Level 1 Document method. This method creates an unattached Text object. The data parameter is of type String. A Document also has all the properties and methods of Node.

getElementsByTagName(tagName)
NodeList getElementsByTagName(tagName)

W3C DOM Level 1 Document method. This method returns a NodeList object consisting of the tagname element nodes. The tagName parameter is of type String. A Document also has all the properties and methods of Node.

reset()
void reset()

W3C DOM Level 1 Document method. Clears the document.

setDTD(Node RootElementName, Object PublicName, Object URL)
setDTD(Node RootElementName, Object PublicName, Object URL)

ECMAScript extension method. Sets the DTD file for the document.

setValue(Object aValue)
setValue(Object aValue)

ECMAScript extension method. Sets the Value of a document from the passed objects. If the passed object is another document, then this method copies child nodes (elements and attributes). If the passed object is text, the text is parsed to create a DOM.

toString()
String toString()

ECMAScript extension method. Converts a DOM document to an XML formatted string.

Example:

Input.XPath("root/child").item(0).toString()
XPath(String asPattern)
NodeList XPath(XPathType asPattern)

ECMAScript extension method. XPathTypes can be of type NodeList, String, Number, or Boolean. Usually used to return a Nodelist matching the XPath pattern. Use brackets to select a particular node from the list. For example, Input.XPath("INVOICE/LINEITEM[1]") or Input.XPath("INVOICE/LINEITEM[last()]"). Use the @ symbol to select a node by attribute. For example, Input.XPath("INVOICE/LINEITEM[@myattr]") To select by attribute value: Input.XPath("INVOICE/LINEITEM[@myattr='abc']").

importNode(sourceNode, deep)
Node importNode(sourceNode, deep)

W3C DOM Level 2 Document method. Imports a node from a document to the current document. This method creates a new copy of the sourceNode. The sourceNode is not altered. A Document also has all the properties and methods of Node.

Table 10-13 Parameters for the ImportNode Method

Parameter

Description

sourceNode

The node to import.

deep

A Boolean. If True, recursively import the subtree under the specified node. If False, import only the node itself.

Example:

Temp.importNode(Input.XPath("A/B[2]"), false)
createElementNS(namespaceURI, qualifiedName)
Element createElementNS(namespaceURI, qualifiedName)

W3C DOM Level 2 Document method. Creates an Element of the given qualifiedName and namespaceURI. A Document also has all the properties and methods of Node.

Table 10-14 Parameters for the createElementNS Method

Parameter

Description

namespaceURI

A string representing the namespace URI that you want to create for the element.

qualifiedName

A string representing the name to create for the element. qualifiedName = namespaceprefix + : + localName

Example:

Temp.createElementNS("someURI","nsprefix:PRICE")
createAttributeNS(namespaceURI, qualifiedName)
Attr createAttributeNS(namespaceURI, qualifiedName)

W3C DOM Level 2 Document method. Creates an Attribute of the given qualifiedName and namespaceURI. A Document also has all the properties and methods of Node.

Table 10-15 Parameters for the createAttributeNS Method

Parameter

Description

namespaceURI

A string representing the namespace URI that you want to create for the attribute.

qualifiedName

A string representing the name to create for the attribute. qualifiedName = namespaceprefix + : + localName

Example:

Temp.createAttributeNS("someURI","nsprefix:PRICE")
getElementsByTagNameNS(namespaceURI, localName)
NodeList getElementsByTagNameNS(namespaceURI, localName)

W3C DOM Level 2 Document method. Returns a NodeList of all the Elements with a given localName and namespace URI, in the order in which they are encountered in a preorder traversal of the Document tree. A Document also has all the properties and methods of Node.

Table 10-16 Parameters for the getElementsByTagnameNS Method

Parameter

Description

namespaceURI

A string of the elements on which to match. The special value “*” matches all namespaces.

qualifiedName

A string of the elements on which to match. The special value “*” matches all local names.

Example:

Temp.getElementsByTagNameNS("someURI", "someName")
getElementById(elementId)
Element getElementById(elementId)

W3C DOM Level 2 Document method. Returns the Element for which the ID is given by elementId. If no such element exists, returns null. Behavior is not defined if more than one element has this ID. A Document also has all the properties and methods of Node.

Example;

Temp.getElementById("someId")
setSkipNameSpaces(abFlag)
void setSkipNameSpaces(boolean flag)

This method can be used to turn off usage of namespaces and match nodes without any prefixes, behaving like a wildcard match.

setEncoding(encoding)
void setEncoding(String encoding)

This method sets the character set encoding for the document.

Element

Lets you work with elements. This section includes the following topics:

tagName

W3C DOM Level 1 Element property. This property returns a String object containing the element name. An Element also has all the properties and methods of Node.

text

Designer extension property. This property returns the concatenated text of all the text nodes under it.

booleanValue()
boolean booleanValue()

ECMAScript extension method. Returns the Boolean value (True or False) of this object, if possible.

countOfElement(String propertyName)
Number countOfElement(String propertyName)

ECMAScript extension method. Returns a count of the named child.

doubleValue()
double doubleValue()

ECMAScript extension method. Returns a double value for this object if possible.

exists(String propertyName)
Boolean exists(String propertyName)

ECMAScript extension method. Checks for the existence of the named child.

getAttribute(name)
String getAttribute(name)

W3C DOM Level 1 Element method. This method returns a String consisting of the attribute value. The name parameter is of type String. An Element also has all the properties and methods of Node.

getAttributeNode(name)
Attr getAttributeNode(name)

W3C DOM Level 1 Element method. This method returns an Attr. The name parameter is of type String. An Element also has all the properties and methods of Node.

getElementsByTagName(name)
NodeList getElementsByTagName(name)

W3C DOM Level 1 Element method. Returns a NodeList of all elements with a specified name. The name parameter is of type String. An Element also has all the properties and methods of Node.

getIndex()
int getIndex()

ECMAScript extension method. Returns the current index.

getParent()
Node getParent()

ECMAScript extension method. Returns the parent element.

normalize()
void normalize()

W3C DOM Level 1 Element method. This method returns a void. An Element also has all the properties and methods of Node.

removeAttribute(name)
void removeAttribute(name)

W3C DOM Level 1 Element method. This method removes an attribute from an element. The name parameter is of type String. An Element also has all the properties and methods of Node.

removeAttributeNode(oldAttr)
Attr removeAttributeNode(oldAttr)

W3C DOM Level 1 Element method. This method removes an attribute from an element and returns an unattached Attr. The oldAttr parameter is of type Attr. An Element also has all the properties and methods of Node.

setAttribute(name,value)
void setAttribute(name, value)

W3C DOM Level 1 Element method. This method sets the value of an attribute node for an element. The name parameter is of type String. The value parameter is of type String. An Element also has all the properties and methods of Node.

setAttributeNode(newAttr)
Attr setAttributeNode(newAttr)

W3C DOM Level 1 Element method. This method attaches an attribute node to an element. The newAttr parameter is of type Attr. An Element also has all the properties and methods of Node.

setIndex(int aiIndex)
setIndex(int aiIndex)

ECMAScript extension method. Sets the iterator index value for this element.

setText(String asText)
setText(String asText)

ECMAScript extension method. Sets the text node associated with this element.

setValue(Object aValue)
setValue(Object aValue)

ECMAScript extension method. Sets the value of an element from the passed object. If the passed object is another element, then this method also copies child nodes (elements and attributes).

toNumber()
Number toNumber()

ECMAScript extension method. Gets the text node and converts it to a number.

toString()
String toString()

ECMAScript extension method. Gets the text node associated with this element.

XPath(XPathType asPattern)
NodeList XPath(XPathType asPattern)

ECMAScript extension method. The XPathType parameter can be of type NodeList, String, Number, or Boolean. Usually used to return a Nodelist matching the XPath pattern. Use brackets to select a particular node from the list. For example, Input.XPath("INVOICE/LINEITEM[1]") or Input.XPath("INVOICE/LINEITEM[last()]"). Use the @ symbol to select a node by attribute. For example, Input.XPath("INVOICE/LINEITEM[@myattr]"). To select by attribute value: Input.XPath("INVOICE/LINEITEM[@myattr='abc']").

getAttributeNS(namespaceURI, localName)
string getAttributeNS(namespaceURI, localName)

W3C DOM Level 2 Element method. Returns the Attr value as a string. An Element also has all the properties and methods of Node.

Table 10-17 Parameters for the getAttributeNS Method

Parameter

Description

namespaceURI

Specifies a string representing the namespace URI of the target Attr.

localName

Specifies a string of the localName of the target Attr.

Example:

Temp.XPath("A/B[0]").getAttributeNS("someURI", "someAttr")
setAttributeNS(namespaceURI, qualifiedName, value)
void setAttributeNS(namespaceURI, qualifiedName, value)

W3C DOM Level 2 Element method. Adds a new attribute. If an attribute with the same namespaceURI and localName is already present in the element, its prefix is changed to be the prefix part of the qualifiedName parameter, and its value is changed to be the value parameter. An Element also has all the properties and methods of Node.

Table 10-18 Parameters for the setAttributeNS Method

Parameter

Description

namespaceURI

The namespace URI of the attribute to create or alter.

qualifiedName

Specifies the qualified name of the attribute to create or alter.

HINT:qualifiedName = namespaceprefix + : + localName

value

Specifies the value to set in string form.

Example:

Temp.XPath("A/B[0]").setAttributeNS("someURI", "someAttrName", "someAttrvalue")
removeAttributeNS(namespaceURI, localName)
void removeAttributeNS(namespaceURI,localName)

W3C DOM Level 2 Element method. Removes an attribute by local name and namespace URI. If the removed attribute has a default value, it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix. An Element also has all the properties and methods of Node.

Table 10-19 Parameters for the removeAttributeNS Method

Parameter

Description

namespaceURI

Specifies the namespaceURI of the attribute to remove.

localName

Specifies the name of the attribute to remove.

Example:

Temp.XPath("A/B[0]").removeAttributeNS("someURI", "someAttrName") 
getAttributeNodeNS(namespaceURI, localName)
Attr getAttributeNodeNS(namespaceURI, localName)

W3C DOM Level 2 Element method. Retrieves an attribute node by local name and namespace URI. An Element also has all the properties and methods of Node.

Table 10-20 Parameters for the getAttributeNodeNS Method

Parameter

Description

namespaceURI

Specifies the namespaceURI of the attribute to retrieve.

localName

Specifies the name of the attribute to retrieve.

Example:

Temp.XPath("A/B[0]").getAttributeNodeNS("someURI", "someAttr"
setAttributeNodeNS(newAttr)
Attr setAttributeNodeNS(newAttr)

W3C DOM Level 2 Element method. Adds a new attribute. If an attribute with the same local name and namespace URI is already present in the element, it is replaced by the new attribute. If the newAttr attribute replaces an existing attribute with the same local name and namespace URI, the replaced Attr node is returned, otherwise null is returned. The newAttr parameter is a new attribute object. An Element also has all the properties and methods of Node.

Example:

Temp.XPath("A/B[0]").setAttributeNodeNS(newAttr)
getElementsByTagNameNS(namespaceURI, localName)
NodeList getElementsByTagNameNS(namespaceURI, localName)

W3C DOM Level 2 Element method. Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. An Element also has all the properties and methods of Node.

Table 10-21 Parameters for the getElementsByTagNameNS Method

Parameter

Description

namespaceURI

Specifies the namespaceURI of the elements on which to match. The special value “*” matches all namespaces.

localName

Specifies the localName of the elements on which to match. The special value “*” matches all local names.

Example:

Temp.XPath("A/B[0]").getElementsByTagNameNS("someURI", "someName")
hasAttribute(name)
boolean hasAttribute()

W3C DOM Level 2 Element method. Returns True when an attribute with a given name is specified for this element or has a default value. Otherwise, returns False. The parameter name is a string that specifies the attribute name for which to look. An Element also has all the properties and methods of Node.

Example:

Temp.XPath("A/B[0]").hasAttribute("someName")
hasAttributeNS(namespaceURI, localName)
boolean hasAttributeNS(namespaceURI, localName)

W3C DOM Level 2 Element method. Returns True when an attribute with a given local name and namespace URI is specified on this element or has a default value. Otherwise, returns False. An Element also has all the properties and methods of Node.

Table 10-22 Parameters for the hasAttributeNS Method

Parameter

Description

namespaceURI

Specifies the namespaceURI of the attribute for which to look.

localName

Specifies the localName of the attribute for which to look.

Example:

Temp.XPath("A/B[0]").hasAttributeNS("someURI", "someName")

Attribute

Lets you work with attributes. This section includes the following topics:

name

W3C DOM Level 1 attribute property. This property returns a String object indicating the tag name of the attribute. An attribute also has all the properties and methods of Node.

specified

W3C DOM Level 1 Attr property. This property returns a Boolean. An attribute also has all the properties and methods of Node.

text

Designer extension property. This property returns the text value of the attribute.

value

W3C DOM Level 1 Attr property. This property returns a String object representing the text value of the attribute. An attribute also has all the properties and methods of Node.

setValue(Object aValue)
setValue(Object aValue)

Designer extension method. Sets the value of an attribute from the passed object.

toString()
String toString()

ECMAScript extension method. Gets the text node associated with the attribute.

ownerElement

W3C DOM Level 2 Attr property. Returns the Element node to which this attribute is attached. Returns null if this attribute is not in use. An Attr also has all the properties and methods of Node.

Example:

attributeObject.ownerElement

CharacterData

Lets you work with character data. This section includes the following topics:

data

W3C DOM Level 1 CharacterData property. This property is of type String and represents the contents of the CharacterData object. CharacterData also has all the properties and methods of Node.

length

W3C DOM Level 1 CharacterData property. This property represents the length of the CharacterData object. CharacterData also has all the properties and methods of Node.

appendData(arg)
void appendData(arg)

W3C DOM Level 1 CharacterData method. This method appends text to the CharacterData object. The arg parameter is of type String. CharacterData also has all the properties and methods of Node.

insertData(offset, arg)
void insertData(offset, arg)

W3C DOM Level 1 CharacterData method. This method inserts text in the CharacterData object. The offset parameter is of type unsigned long. The arg parameter is of type String. CharacterData also has all the properties and methods of Node.

deleteData(offset, count)
void deleteData(offset, count)

W3C DOM Level 1 CharacterData method. This method deletes text in the CharacterData object. The offset and count parameters are of type unsigned long. CharacterData also has all the properties and methods of Node.

replaceData(offset, count, arg)
void replaceData(offset, count, arg)

W3C DOM Level 1 CharacterData method. This method replaces text in the CharacterData object. The offset and count parameters are of type unsigned long. The arg parameter is of type String. CharacterData also has all the properties and methods of Node.

substringData(offset, count)
String substringData(offset, count)

W3C DOM Level 1 CharacterData method. This method returns a substring of the CharacterData object. The offset and count parameters are of type unsigned long. CharacterData also has all the properties and methods of Node.

NodeList

Lets you work with node lists. This section includes the following topics:

length

W3C DOM Level 1 NodeList property. This property returns the number of nodes in a NodeList object.

avg('[NodeList]')
Number avg('[NodeList]')

ECMAScript aggregate extension method. Returns a number equal to the average value in the NodeList. The NodeList parameter is of type XPath. If no parameter is supplied, then the current NodeList/GroupName is used. The function argument should be in single quotes, and must be escaped for nested calls.

Example:

Input.XPath("rootElem/childElem").avg() 
count('[NodeList]')
Number count('[NodeList]')

ECMAScript aggregate extension method. Returns a number equal to a count of the nodes in the NodeList that have data. Nodes without data, or nodes with only child elements are not counted. To count all nodes, use the .length property on a nodeList object. The optional NodeList parameter is of type XPath. If no parameter is supplied (the usual case), then the current NodeList/GroupName is used. The function argument should be in single quotes, and must be escaped for nested calls.

Example:

Input.XPath("rootElem/childElem").count()
item(index)
Node item(index)

W3C DOM Level 1 NodeList method. This method returns the indicated Node from the NodeList. The index parameter is of type unsigned long. The Index is 0-based.

min('[NodeList]')
Number min('[NodeList]')

ECMAScript aggregate extension method. Returns a number equal to the lowest value in the NodeList. The NodeList parameter is of type XPath. If no parameter is supplied, then the current NodeList/GroupName is used. The function argument should be in single quotes, and must be escaped for nested calls.

Example:

Input.XPath("rootElem/childElem").min() 
max(['NodeList]')
Number max('[NodeList]')

ECMAScript aggregate extension method. Returns a number equal to the highest value in the NodeList. The NodeList parameter of type XPath. If no parameter is supplied, then the current NodeList/GroupName is used. The function argument should be in single quotes, and must be escaped for nested calls.

Example:

Input.XPath("rootElem/childElem").max()
sum('[NodeList]')
Number sum('[NodeList]')

ECMAScript aggregate extension method. Returns a number equal to the sum of the values in NodeList. The NodeList parameter is of type XPath. If no parameter is supplied, then the current NodeList/GroupName is used. The function argument should be in single quotes, and must be escaped for nested calls.

Example:

Input.XPath("rootElem/childElem").sum() 
where(XPathType asPattern)
NodeList where(String asPattern)

ECMAScript extension method. Gets a NodeList of nodes matching the XPath pattern.

toNumber()
toNumber()

Converts the data of the first instance in the NodeList to an ECMAScript Number object. Any alphabetic characters or embedded spaces in data return NaN. Leading and trailing spaces are permitted.

Example:

var myNum = Input.XPath("Invoice/Amount").toNumber()

NamedNodeMap

Lets you work with named node maps. This section includes the following topics:

length

length W3C DOM Level 1 NamedNodeMap property. This property returns the number of nodes in a NamedNodeMap.

getNamedItem(name)
Node getNamedItem(name)

W3C DOM Level 1 NamedNodeMap method. This method returns all selected Nodes of the indicated name. The name parameter is of type String.

getNamedItemNS(namespaceURI, localName)
Node getNamedItemNS(namespaceURI, localName)

W3C DOM Level 2 NamedNodeMap method. Returns a node specified by local name and namespace URI.

Table 10-23 Parameters for the NamedNodeMap Method

Parameter

Description

namespaceURI

Specifies the namespaceURI of the node to retrieve.

localName

Specifies the localName of the node to retrieve.

Example:

Temp.XPath("A/B").item(0).getAttributes() .getNamedItemNS("someURI", "anAttrName")
item(index)
Node item(index)

W3C DOM Level 1 NamedNodeMap method. This method returns the indicated Node from the NamedNodeMap. The index parameter is of type unsigned long. The index is 0-based.

removeNamedItem(name)
Node removeNamedItem(name)

W3C DOM Level 1 NamedNodeMap method. This method removes the indicated node from the NamedNodeMap and returns an unattached node. The name parameter is of type String.

removeNamedItemNS(namespaceURI, localName)
Node removeNamedItemNS(namespaceURI, localName)

W3C DOM Level 2 NamedNodeMap method. Removes and returns the node specified by namespace URI and local name.

Table 10-24 Parameters for the removeNamedItemNS Method

Parameter

Description

namespaceURI

Specifies the namespaceURI of the node to remove.

localName

Specifies the localName of the node to remove.

Example:

Temp.XPath("A/B").item(0).getAttributes() .removeNamedItemNS("someURI", "anAttrName")
setNamedItem(arg)
Node setNamedItem(arg)

W3C DOM Level 1 NamedNodeMap method. This method returns a Node. The arg parameter is of type Node.

setNamedItemNS(Node arg)
Node setNamedItemNS(arg)

W3C DOM Level 2 NamedNodeMap method. If the new Node replaces an existing node, the replaced Node is returned, otherwise null is returned.

Example:

var item = Temp.XPath("A/B").item(0);
item.getAttributes().setNamedItemNS(aNodeObject)

Text

Lets you work with text.

splitText(offset)
Text splitText(offset)

W3C DOM Level 1 Element method. This method removes the text up to the offset and creates an unattached text node with the removed text. The offset parameter is of type unsigned long. A Text also has all the properties and methods of CharacterData.

DocumentType

Lets you work with document types. This section includes the following topics:

name

W3C DOM Level 1 DocumentType property. This property returns a String representing the document type name.

entities

W3C DOM Level 1 DocumentType property. This property returns a NamedNodeMap of the entities defined in the document.

internalSubset

W3C DOM Level 2 DocumentType property. This property returns a String representing the internal subset as a string.

notations

W3C DOM Level 1 DocumentType property. This property returns a NamedNodeMap of the notations defined in the document.

publicId

W3C DOM Level 2 DocumentType property. This property returns a String representing the public identifier of the external subset.

systemId

W3C DOM Level 2 DocumentType property. This property returns a String representing the system identifier of the external subset.

DOMImplementation

Lets you work with DOM implementations. This section includes the following topics:

createDocument(namespaceURI, qualifiedName, doctype)
Document createDocument(namespaceURI, qualifiedName, doctype)

W3C DOM Level 2 DOMImplementation method. Creates an XML Document object of the specified type with its document element.

Table 10-25 Parameters for the DOMImplementation Method

Parameter

Description

namespaceURI

Specifies the namespaceURI of the document element to create.

qualifiedName

Specifies the qualified name of the document element to create. qualifiedName = namespaceprefix + : + localName

doctypei

Specifies the type of document to create, or null.

createDocumentType(qualifiedName, publicID, systemID)
DocumentType createDocumentType(qualifiedName, publicID, systemID)

W3C DOM Level 2 DOMImplementation method. Creates an empty DocumentType node. Parameters: qualifiedName is a string of the name of the document type to create. publicID is the external subset public identifier. systemID is the external subset system identifier. Note: qualifiedName = namespaceprefix + : + localName

Table 10-26 Parameters for the createDocumentType Method

Parameter

Description

qualifiedName

Specifies the qualified name of the document element to create. qualifiedName = namespaceprefix + : + localName

publicID

Specifies the external subset public identifier.

systemID

Specifies the external subset system identifier.

hasFeature(feature, version)
boolean hasFeature(feature, version)

W3C DOM Level 1 DOMImplementation method. This method returns a Boolean. The feature parameter is of type String. The version parameter is of type String.

Notation

Lets you work with notation. This section includes the following topics:

publicId

W3C DOM Level 2 This property returns a String representing the public identifier of the external subset.

systemId

W3C DOM Level 2 property. This property returns a String representing the system identifier of the external subset.

Entity

Lets you work with entities. This section includes the following topics:

publicId

W3C DOM Level 2 property. This property returns a String representing the public identifier of the external subset.

systemId

W3C DOM Level 2 property. This property returns a String representing the system identifier of the external subset.

notationName

W3C DOM Level 1 Entity property. This property is of type String. An Entity also has all the properties and methods of Node.

ProcessingInstruction

Lets you work with processing instructions. This section includes the following topics:

target

W3C DOM Level 1 ProcessingInstruction property. This property is a String representation of the target part of a Processing Instruction.

data

W3C DOM Level 1 ProcessingInstruction property. This property is a String representation of the data part of a Processing Instruction.

10.3.3 ECMAScript Core

This section lists all ECMAScript core methods and properties supported by the ECMA expression builder. This section includes the following topics:

Array Object

Lets you work with arrays. This section includes the following topics:

Array(item0, item1, . . .)
Array()

Constructor

join(separator)
Array join(separator)

The elements of the array are converted to strings, and these strings are then concatenated, separated by occurrences of the separator. If no separator is provided, a single comma is used as the separator.

length

Array length. The length property of this Array object

reverse()
reverse()

The elements of the array are rearranged so as to reverse their order. The operation is done in-place, meaning that the original array is modified.

sort(comparefn)
Array sort()

The elements of this array are sorted. The sort is not necessarily stable. If comparefn is supplied, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y.

toString()
Array toString()

The elements of this object are converted to strings, and these strings are then concatenated, separated by comma characters. The result is the same as if the built-in join method were invoked for this object with no argument.

Boolean Object

There is seldom a need to use the object version of Boolean in place of True/False literal values. This object is provided for completeness. It is specified in ECMA-262.

This section includes the following topics:

Boolean()
Boolean( [true/false] )

Constructor. Optionally takes either True or False as an argument.

toString()
Boolean toString()

If this Boolean value is True, then the string “true” is returned. Otherwise, this Boolean value must be false, and the string “false” is returned.

valueOf()
Boolean valueOf()

Returns this Boolean value.

Date Object

Lets you work with dates and times. This section includes the following topics:

Date()
Date()

The constructor of the Date can have various signatures. The date constructor format can accept up to seven parameters, in the following format: new Date(year,month,date,hrs,mins,secs,ms). This date must be a java.util.Date object and not an ECMAScript Date object if you intend to use it with the Identity Manager User Application workflow system.

getDate()
getDate()

Returns DateFromTime(LocalTime(t)).

getDay()
getDay()

Returns WeekDay(LocalTime(t)). The days of week are numbered from 0-6. The number 0 represents Sunday and 6 represents Saturday.

getFullYear()
getFullYear()

Returns YearFromTime(LocalTime(t)).

getHours()
getHours()

Returns HourFromTime(LocalTime(t)).

getMilliseconds()
getMilliseconds()

Returns msFromTime(LocalTime(t)).

getMinutes()
getMinutes()

Returns MinFromTime(LocalTime(t)).

getMonth()
getMonth()

Returns MonthFromTime(LocalTime(t)). The months are returned as an integer value from 0-11. The number 0 represents January and 11 represents December.

getSeconds()
getSeconds()

Returns SecFromTime(LocalTime(t)).

getTime()
getTime()

Returns a number, which is this time value. The number value is a millisecond representation of the specified Date object.

getTimezoneOffset()
getTimezoneOffset()

Returns (t * LocalTime(t)) / msPerMinute. The difference is in minutes between (GMT) and local time.

getUTCDate()
getUTCDate()

Returns DateFromTime(t).

getUTCDay()
getUTCDay()

Returns WeekDay(t). The days of week are numbered from 0-6. The number 0 represents Sunday and 6 represents Saturday.

getUTCFullYear()
getUTCFullYear()

Returns YearFromTime(t). There is no getYearUTC method, so this method must be used to obtain a year from a UTC Date object.

getUTCHours()
getUTCHours()

Returns HourFromTime(t).

getUTCMilliseconds()
getUTCMilliseconds()

Returns msFromTime(t).

getUTCMinutes()
getUTCMinutes()

Returns MinFromTime(t).

getUTCSeconds()
getUTCSeconds()

Returns SecFromTime(t).

getYear()
getYear()

Returns YearFromTime(LocalTime(t))—1900. The function getFullYear() is preferred for nearly all purposes because it avoids the year 2000 problem.

parse(string)
parse(string)

Applies the ToString operator to its argument and interprets the resulting string as a date; it returns a number, the number which is a UTC time value corresponding to the date. The string is interpreted as a local time, a UTC time, or a time in some other time zone, depending on the contents of the string.

setDate(date)
setDate(date)

Sets the day of the month, using an integer from 1 to 31, for the supplied date according to local time.

setFullYear(year[,mon[,date]])
setFullYear(year[,mon[,date]])

Sets the [Value] property of this value to UTC ECMAScript.Date. Returns the value of the [Value] property of this value.

setHours(hour[,min[,sec[,ms]]])
setHours(hour[,min[,sec[,ms]]])

Sets the [Value] property of this value to UTC time. Returns the value of the [Value] property of this value. When entering a value for hours, an hour value greater than 23 is added to the existing hour value, not set.

setMilliseconds(ms)
setMilliseconds(ms)

Computes UTC from argument and sets the [Value] property of this value to TimeClip(calculatedUTCtime). Returns the value of the [Value] property of this value.

setMinutes(min[,sec[,ms]])
setMinutes(min[,sec[,ms]])

Sets the [Value] property of this value to UTC time. Returns the value of the [Value] property of this value.

setMonth(mon[,date])
setMonth(mon[,date])

Sets the [Value] property of this value to UTC ECMAScript.Date. Returns the value of the [Value] property of this value. If the [Value] property of this exceeds 11, the [Value] property for this is added to the existing month, not set.

setSeconds(sec [, ms ] )
setSeconds(sec [, ms ] )

Sets the [Value] property of this value to UTC time. Returns the value of the [Value] property of this value.

setTime(time)
setTime(time)

Sets the [Value] property of this value to TimeClip(time). Returns the value of the [Value] property of this value. The [Value] property of this is a millisecond value that is converted by the TimeClip(time) method.

setUTCDate(date)
setUTCDate(date)

Sets the [Value] property of this value to ECMAScript.Date. Returns the value of the [Value] property of this value. If the [Value] property of this exceeds 30 or 31, the [Value] of this is added to the existing date value, not set.

setUTCFullYear(year[,mon[,date]])
setUTCFullYear(year[,mon[,date]])

Sets the [Value] property of this value to ECMAScript.Date. Returns the value of the [Value] property of this value.

setUTCHours(min[,sec[,ms]])
setUTCHours(min[,sec[,ms]])

Sets the [Value] property of this value to time. Returns the value of the [Value] property of this value. When entering a value for hours, an hour value greater than 23 is added to the existing hour value, not set.

setUTCMilliseconds(ms)
setUTCMilliseconds(ms)

Sets the [Value] property of this value to time and returns the value of the [Value] property of this value.

setUTCMinutes(min[,sec[,ms]])
setUTCMinutes(min[,sec[,ms]])

Sets the [Value] property of this value to time. Returns the value of the [Value] property of this value.

setUTCMonth(mon[,date])
setUTCMonth(mon[,date])

Sets the [Value] property of this value to ECMAScript.Date. Returns the value of the [Value] property of this value. If the [Value] property of this exceeds 11, the [Value] property for this is added to the existing month, not set.

setUTCSeconds(sec [, ms ] )
setUTCSeconds(sec [, ms ] )

Sets the [Value] property of this value to time. Returns the value of the [Value] property of this value.

setYear(year)
setYear(year)

Sets the [Value] property of this value to UTC ECMAScript.Date. Returns the value of the [Value] property of this value.

toLocaleString()
toLocaleString()

Returns a string value. The contents of the string are implementation-dependent, but are intended to represent the Date in a convenient, human-readable form appropriate to the geographic or cultural locale.

toString()
toString()

Returns this string value. The contents of the string are implementation-dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone.

toUTCString()
toUTCString()

Returns a string value. The contents of the string are implementation-dependent, but are intended to represent the Date in a convenient, human-readable form in UTC.

UTC()
UTC()

This method can accept a number of different arguments. The UTC function differs from the Date constructor in two ways: it returns a time value as a number, rather than creating a Date object, and it interprets the arguments in UTC rather than as local time.

valueOf()
valueOf()

Returns a number, which is this time value. The valueOf() function is not generic, so it generates a runtime error if the object is not a Date object.

Function Object

Used to work with the Function Object. This section includes the following topics:

Function(p1, p2, . . . , pn, body)

Function Constructor. The last argument specifies the body (executable code) of a function; any preceding arguments specify formal parameters.

length

The value of the length property is usually an integer that indicates the “typical” number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function.

toString()
String toString()

An implementation-dependent representation of the function is returned. This representation has the syntax of a FunctionDeclaration. The use and placement of whitespace, line terminators, and semicolons within the representation string is implementation-dependent.

Global

ECMAScript provides certain “top-level” methods and properties, so-called because they are available from any context: They are not parented by any particular object.

This section includes the following topics:

escape(string)
String escape()

The escape function computes a new, URL-legal version of a string in which certain URL-illegal characters have been replaced by hexadecimal escape sequences.

eval(x)
eval()

When the eval function is called with one argument x, the following steps are taken:

  1. If x is not a string value, return x.

  2. Parse x as an ECMAScript Program. If the parse fails, generate a runtime error.

  3. Evaluate the program from Step 2.

  4. If Result(3) is “normal” completion after value “V”, return the value V.

  5. Return undefined.

Infinity

A special primitive value representing positive infinity.

isFinite(number)
isFinite()

Applies Number( ) to its argument, then returns false if the result is NaN (Not a Number), +*, or **; otherwise, returns True.

isNaN( value )
isNan()

Returns True if the argument evaluates to NaN (Not a Number”); otherwise, returns False

NOTE:Any form of logical comparison of NaN against anything else, including itself, returns false. Use isNaN() to determine whether a variable (or a return value, etc.) is equal to NaN.

NaN

The primitive value NaN represents the set of IEEE standard Not-a-Number values.

parseFloat(string)
number parseFloat()

Produces a floating-point number by interpretation of the contents of the string argument. If the string cannot be converted to a number, the special value NaN (see NaN) is returned.

parseInt(string, radix)
number parseInt()

Produces an integer value dictated by interpretation of the contents of the string argument, according to the specified radix.

unescape(string)
String unescape()

Computes a new version of a string value in which escape sequences that might be introduced by the escape function are replaced with the character they represent.

Math Object

All of the Math object’s properties and methods are static, which means you should prepend “Math” to the property or method name in your code. For example, use “Math.PI,” not simply “PI.”

This section includes the following topics:

E

The number value for e, the base of the natural logarithms, which is approximately 2.7182818284590452354.

LN10

The number value for the natural logarithm of 10, which is approximately 2.302585092994046.

LN2

The number value for the natural logarithm of 2, which is approximately 0.6931471805599453.

LOG2E

The number value for the base-2 logarithm of e, the base of the natural logarithms; this value is approximately 1.4426950408889634. The value of Math.LOG2E is approximately the reciprocal of the value of Math.LN2.

LOG10E

The number value for the base-10 logarithm of e, the base of the natural logarithms; this value is approximately 0.4342944819032518. The value of Math.LOG10E is approximately the reciprocal of the value of Math.LN10.

PI

The number value for *, the ratio of the circumference of a circle to its diameter, which is approximately 3.14159265358979323846.

SQRT1.2

The number value for the square root of 1/2, which is approximately 0.7071067811865476. The value of Math.SQRT1_2 is approximately the reciprocal of the value of Math.SQRT2.

SQRT2

The number value for the square root of 2, which is approximately 1.4142135623730951.

abs(x)
Number abs(x)

Returns the absolute value of the argument x; in general, the result has the same magnitude as the argument but has positive sign. The input value x can be any number value.

Example:

Math.abs(-123.23940) = 123.23940
acos(x)
Number acos(x)

This function returns an implementation-dependent approximation to the arc cosine of the argument. The result is expressed in radians and ranges from +0 to +PI(3.14159...) radians. The input value x must be a number between -1.0 and 1.0.

Example:

PI/4 = 0.785 Math.acos(0.785) = 0.6681001997570769
asin(x)
Number asin(x)

This function returns an implementation-dependent approximation to the arc sine of the argument. The result is expressed in radians and ranges from -PI/2 to +PI/2. The input value x must be a number between -1.0 and 1.0.

Example:

PI/4 = 0.785 Math.asin(0.785) = 0.9026961270378197
atan(x)
Number atan(x)

This function returns an implementation-dependent approximation to the arc tangent of the argument. The result is expressed in radians and ranges from -PI/2 to +PI/2. The input value x can be any number.

Example:

3PI/4 = 2.355 Math.atan(2.355) = 1.169240427545485
atan2(x,y)
Number atan2(x,y)

This function returns an implementation-dependent approximation to the arc tangent of the quotient y/x of the arguments y and x, where the signs of the arguments are used to determine the quadrant of the result. It is intentional and traditional for the two-argument arc tangent function that the argument named y be first and the argument named x be second. The result is expressed in radians and ranges from -PI to +PI. The input value x is the x-coordinate of the point. The input value y is the y-coordinate of the point.

Example:

PI/2 = 1.57 Math.atan2(1.57,-1.57) = 2.356194490192345
ceil(x)
Number ceil(x)

This function returns the smallest (closest to -infinity) number value that is not less than the argument and is equal to a mathematical integer. If the argument is already an integer, the result is the argument itself. The input value x can be any numeric value or expression. The Math.ceil(x) function property is the same as -Math.floor(-x). Example:

Example:

Math.ceil(123.78457) = 123
cos(x)
Number cos(x)

This function returns an implementation-dependent approximation to the cosine of the argument. The argument must be expressed in radians.

exp(x)
Number exp(x)

This function returns an implementation-dependent approximation to the exponential function of the argument (e raised to the power of the argument, where e is the base of the natural logarithms). The input value x can be any numeric value or expression greater than 0.

Example:

Math.exp(10) = 22026.465794806718
floor(x)
Number floor(x)

This function returns the greatest (closest to +infinity) number value that is not greater than the argument and is equal to a mathematical integer. If the argument is already an integer, the result is the argument itself. The input value x can be any numeric value or expression.

Example:

Math.floor(654.895869)=654
log(x)
Number log(x)

This function returns an implementation-dependent approximation to the natural logarithm of the argument. The input value x can be any numeric value or expression greater than 0.

Example:

Math.log(2) = 0.6931471805599453
max(x,y)
Number max(x,y)

This function returns the larger of the two arguments. The input values x and y can be any numeric values or expressions.

Example:

Math.max(12.345,12.3456)= 12.3456
min(x,y)
Number min(x,y)

This function returns the smaller of the two arguments. The input values x and y can be any numeric values or expressions.

Example:

Math.min(-12.457,-12.567)= -12.567
pow(x,y)
Number pow(x,y)

This function returns an implementation-dependent approximation to the result of raising x to the power of y. The input value x must be the number raised to a power. The input value y must be the power to which x is raised.

Example:

Math.pow(2,4) = 16
random()
Number random()

This method takes no arguments and returns a pseudo-random number between 0 and 1. The number value has approximately uniform distribution over that range, using an implementation-dependent algorithm or strategy. This function takes no arguments.

Example:

Math.random()=0.9545176397178535
round(x)
Number round(x)

This function returns the number value that is closest to the argument and is equal to a mathematical integer. If two integer number values are equally close to the argument, then the result is the number value that is closer to +infinity. If the argument is already an integer, the result is the argument itself. The input value x can be any number.

Example:

Math.round(13.53) = 14
sin(x)
Number sin(x)

This function returns an implementation-dependent approximation to the sine of the argument. The argument is expressed in radians. The input value x must be an angle measured in radians.

sqrt(x)
Number sqrt(x)

This function returns an implementation-dependent approximation to the square root of the argument. The input value x must be any numeric value or expression greater than or equal to 0. If the input value x is less than zero, the string “NaN” is returned. (NaN stands for Not a Number.)

Example:

Math.sqrt(25) = 5
tan(x)
Number tan(x)

This function returns an implementation-dependent approximation to the tangent of the argument. The argument is expressed in radians. The input value x must be an angle measured in radians.

Number Object

Lets you work with numeric values. The Number object is an object wrapper for primitive numeric values.

This section includes the following topics:

MAX_VALUE

The largest positive finite value of the number type (approximately 1.7976931348623157e308).

Example:

Number.MAX_VALUE 
MIN_VALUE

The smallest positive nonzero value of the number type (approximately 5e-324).

Example:

Number.MIN_VALUE 
NaN

The primitive value NaN represents the set of IEEE Standard Not-a-Number values.

Example:

Number.NaN 
NEGATIVE_INFINITY

The value of negative infinity.

Example:

Number.NEGATIVE_INFINITY
Number()
Number()

The constructor of Number has two forms: Number(value) and Number().

POSITIVE_INFINITY

The value of positive infinity.

Example:

Number.POSITIVE_INFINITY 
toString(radix)
toString()

If the radix is the number 10 or is not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation-dependent. The toString function is not generic; it generates a runtime error if this value is not a Number object. Therefore, it cannot be transferred to other kinds of objects for use as a method.

valueOf()
valueOf()

Returns this number value. The valueOf function is not generic; it generates a runtime error if its value is not a Number object. Therefore, it cannot be transferred to other kinds of objects for use as a method.

Object

Used to work with objects. Object is the primitive JavaScript object type. All ECMAScript objects are descended from object. That is, all ECMAScript objects have the methods defined for object.

This section includes the following topics:

Object( )

Constructor for object.

toString()
Object toString()

When the toString method is called on an arbitrary object, the following steps are taken:

  1. Get the [[Class]] property of this object.

  2. Compute a string value by concatenating the three strings “[object “, Result(1), and “]”.

  3. Return Result(2).

valueOf()
Object valueOf()

The valueOf method for an object usually returns the object; however, if the object is a wrapper for a host object, as might be created by the Object constructor, the contained host object should be returned.

String Object

Used to work with String Objects. This section includes the following topics:

String(x)
String(x)

The constructor of the string.

charAt(pos)
charAt(pos)

Returns a string containing the character at position pos in the string resulting from converting this object to a string. If there is no character at that position, the result is the empty string. The result is a string value, not a string object.

charCodeAt(pos)
charCodeAt(pos)

Returns a number (a nonnegative integer less than 2^16) representing the Unicode code point encoding of the character at position pos in the string resulting from converting this object to a string. If there is no character at that position, the result is NaN.

fromCharCode(char0, char1, . . .)
fromCharCode(char0, char1, . . .)

Returns a string value containing as many characters as the number of arguments. Each argument specifies one character of the resulting string, with the first argument specifying the first character, and so on, from left to right. An argument is converted to a character by applying the operation ToUint16 and regarding the resulting 16-bit integer as the Unicode code point encoding of a character. If no arguments are supplied, the result is the empty string.

indexOf(searchString, pos)
indexOf(searchString, pos)

If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the right of the specified position, then the index of the leftmost such position is returned; otherwise, -1 is returned. If position is undefined or not supplied, 0 is assumed, in order to search all of the string.

lastIndexOf(searchString, pos)
lastIndexOf(searchString, pos)

If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the left of the specified position, then the index of the rightmost such position is returned; otherwise, -1 is returned. If position is undefined or not supplied, the length of the string value is assumed, in order to search all of the string.

length

Returns the length of the String.

match(RegExp)
String match(RegExp)

Takes a regular expression object as argument. It returns an array of matches; otherwise, returns null.

replace(RegExp, String)
String replace(RegExp, String)

Takes a regular expression and a replacement string. It returns the original string with replacements accomplished.

search(RegExp)
String search(RegExp)

Takes a regular expression as the sole arg and returns the offset of the first substring that matches, or -1 on no match.

split(separator)
split(separator)

Returns an Array object, into which substrings of the result of converting this object to a string have been stored. The substrings are determined by searching from left to right for occurrences of the given separator; these occurrences are not part of any substring in the returned array, but serve to divide the string value. The separator may be a string of any length.

substring(start, end)
substring(start, end)

Returns a substring of the result of converting this object to a string, starting from character position start and running to the position end of the string. If the second parameter is not present, the end position is considered the end of the string. The result is a string value, not a string object.

toLowerCase()
toLowerCase()

Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a string object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 lowercase equivalent, in which case the lowercase equivalent is used instead. The canonical Unicode 2.0 case mapping must be used, which does not depend on implementation or locale.

toString()
toString()

Returns this string value. When concerned with the placement and use of whitespace line terminators and semicolons within the representation, the string value is implementation-dependent.

toUpperCase()
toUpperCase()

Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a string object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. The canonical Unicode 2.0 case mapping must be used, which does not depend on implementation or locale.

valueOf()
valueOf()

Returns this string value. The valueOf() function is not generic, so it generates a runtime error if the object is not a String object.

10.3.4 Global Functions

Global functions in ECMAScript are functions that are independent of any particular object.

The Expression Builder supports the following Global functions:

getEnvironmentCountry

getEnvironmentCountry()

Function returns a 2-character string (for example, US) that represents the location that is currently selected on the user’s computer.

getEnvironmentLanguage

getEnvironmentLanguage()

Function returns a 2-character string (for example, EN) that represents the input language that is currently selected on the user’s computer.

10.3.5 IDVault Functions

This section lists functions that are used with IDVault data.

DNCompare

DNcompare(String dn1, String dn2)

Performs a case-insensitive comparison of DNs from the Identity Vault. Returns True if the DNs are the same.

A DN encapsulates a Distinguished Name (an LDAP name with context). The syntax of the DNs must conform to that specified in RFC 2253, which describes the String representation of DNs. The following DNs are all valid for use with DNCompare (and would return True if compared):

cn=jdoe,ou=users,ou=idmsample,o=acmeCN=jdoe,ou=users,ou=idmsample,o=acmecn=JDOE,ou=users,ou=idmsample,o=acme

For more information about RFC 2253, see RFC 2353.

Example:

if ( IDVault.DNcompare(flowdata.get('Activity3/CardRequest/Candidate'),recipient )) true; else false ;

get()

get()
get(fieldname)
get(fieldname,dn)
get(fieldname,dn,entity-type)
get(fieldname,dn,entity-type,attribute)

This corresponds to the IDVault.get() function of the workflow script engine. Retrieves the value(s) of the attribute for the given entity. The result result is an array of values.If the field parameter is specified the result of the query result is used to refresh the content of the field. If not, result is up to the form developer to use the result of the query. Example:

IDVault.get("assetProp",dn,"user","LastName");

execService()

IDVault.execService(service)
IDVault.execService(service, param)
IDVault.execService(service, param, locale)

Executes an AJAX service, the result will used to refresh the content of the field. The service must be registered in the UI control registry.The first column of the result list result is used for the display value, the second one for the data value. Example :

var r=IDVault.execService("dnlookup2",params);var res=r?r["_data"]["raw"][dn]["value"]:"error encountered";
field.setValues("IDVault.execService(\"dnlookup2\") :"+res);