Objects and Properties that You Can Specify in JavaScript Expressions

You can specify the following objects and properties in the JavaScript expressions that you use for the runtime values of the value attribute for the elements that you use as fields on forms. Typically, you specify these expressions in the following format: $(_.object.property). For example, to capture the runtime value of the logged in user completing the form in a request, specify $(_.user.firstName). You can also concatenate strings, as explained later in this topic.

Note: These variables apply for Form Designer forms only! They are similar but are not exactly the same as the objects and properties defined for CA Workflow in the topic Forms Variables. If you are using both Form Designer forms and CA Workflow forms, be careful to use the correct objects and properties for each type of form.

User

The user object contains an array of user properties that you can access using _.user. Each user object has the following properties: id, uuid, status (0 = active, 1 = inactive), firstName, lastName, middleName, commonName, alias, title, manager, delegate, description, phone (this is an array phone[0] = primary and phone[1] = secondary), mobile, fax, pager, email, timezone, localeLanguage, localeCountry, defaultRole, defaultDomain, location.uuid, location.name, location.city, location.state, location.country, location.postalCode, location.phone, location.fax, location.description, location.address[0-5], and roles.<domain>.

Business Unit

The business unit object contains an array of business unit properties that you can access using _.bu. Each business unit object has the following properties: id, name, type(business unit type where SP=service provider, ST=can have sub-business units, TE=cannot have sub-business units), singleAccountMode (true or false), status (0=inactive, 1=active), openedDate, description, timezone, federalTaxId, stateTaxId, taxRegion, currency, dateFormat, parent (parent bu id), email, website, primaryContact (contact userid), location.uuid, location.name, location.city, location.state, location.country, location.postalCode, location.phone, location.fax, location.description, location.address[0-5], data1, data2, data3, data4, and data5.

Request

The request object contains an array of request properties that you can access using _.request. Each request object has the following properties: id, name, requestedFor, requstedForAccountId, requestedBy, requestedByAccountId, description, priority, status, dateCreated, completionDate, dateRequired, and lastModified.

Service

The service object contains an array of services that you can access using _.service. Each service object has the following properties: id, bu, name, description, status(0=deleted, 1=available, 2=unavailable, 3=created, 4=cancelled, 5=total), website, code, version, dateAvailable, dateUnavailable, dateCreated, dateCancelled

Service Option Groups

The service option groups object contains an array of service options that you can be access using _.sog.name. Each service option group has the following properties: id, bu, name, description, status(0=deleted, 1=available, 2=unavailable, 3=created, 4=cancelled, 5=total), code, dateAvailable, dateUnavailable, dateCreated, dateCancelled.

Operators

The operators most commonly used for form design are described here. For complete details about standard operators, see the JavaScript standards reference that your organization uses, for example, www.developers.sun.com, or www.javascript.com.

You can specify all standard operators in your JavaScript expression except assignment operators. The assignment operators are as follows: =, +=, -=, *=, /= . For example $(var x = 1+2) is invalid because the = assignment operator is used.

Required Return Values

The JavaScript expressions used for the disabled, checked, and hidden attributes should return one of the following values:

If the expression returns any other value, <bcc> replaces it with a value of false. Therefore, if you specify $(_.user.firstName) for the disabled attribute of a text field, the field is not disabled unless the user’s first name is “true.”

Concatenation Operators

You can optionally concatenate two strings together, using the + operator, for example: $(‘Hello ‘ + _.user.firstName + ‘ ‘ + _.user.lastName) returns the text "Hello first-name last-name"; for example, "Hello John Doe" or "Hello Jane Smith."

Comparison Operators

You can optionally use the following comparison operators:

For examples used in the Form Designer, see How to Hide or Disable a Field Based on Request Status, Business Unit, Role or Other Criteria and How to Select or Clear Fields by Default Based on Request Status, Role, Business Unit, or Other Criteria.

Logical Operators

You can optionally use the following logical operators: and (&&), or (||), not (!)

For examples used in the Form Designer, see How to Hide or Disable a Field Based on Request Status, Business Unit, Role or Other Criteria and How to Select or Clear Fields by Default Based on Request Status, Role, Business Unit, or Other Criteria.