RapidIdentity Product Guide

Flow Control Actions

Skip to the end of enclosing loop or section.

Property

Value

Description

label

expression, variable

the label of the loop or section to end (default: the nearest enclosing loop)

Example

# Should stop logging after 4
a = createArray()
i = 0
while (i > 10) {
    i = i + 1
    if (i == 5) {
        break ()
    } else {}
    log(i)
}

Clears the last error message and code, setting them to undefined, otherwise the last error message and code are available until another error occurs. This action does not include any properties.

Example

# The beginning of the Action Set
clearLastError()
forEach(record, records) {
    # Iteration logic
}
# The remainder of the Action Set

Close a closeable resource (e.g. connection or iterator.)

Property

Value

Description

closeable*

expression, variable

the closeable resource

Example

inputText = openDelimitedTextInput(...)
forEach(input,inputText) {
    log("The first name for this record is: " + input["fname"])
}
close(inputText)

Comment.

Property

Value

Description

comment

text

the comment

Example

# This is a comment
if(a == b) {
    # Comments can be placed anywhere in your Action Set
    log(a)
} else {
    # Even here
    log(b)
}

Go to the top of the enclosing loop

Property

Value

Description

label

expression, variable

the label of the loop to continue (default: the nearest enclosing loop)

Example

a = createArray()
i = 0
while(i > 10) {
    i = i + 1
    if(i == 5) {
        continue()
    } else {
        log(i)
    }
}

Iterate through each item in a collection.

Property

Value

Description

label

expression, variable

The label for the loop. May be referenced by break and continue actions.

variable*

expression, variable

the variable to assign to an item from the collection at the beginning of each loop iteration

collection*

expression, variable

the collection to iterate

do*

text, expression, variable

the actions to perform for each item in the collection

Example

inputText = openDelimitedTextInput(...)
forEach(input,inputText) {
    log("The first name for this record is: " + input["fname"])
}
close(inputText)

If available, returns the numeric error code associated with the last error message. Currently, only the Database, LDAP, and AD adapters provide numeric error codes.

Property

Value

Description

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

code = getLastErrorCode()

Returns the last error message sent to the log of the currently running Action Set (including messages sent by log() with a level of "ERROR").

Property

Value

Description

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

message = getLastErrorMessage()

Get the next item in this iterator.

Property

Value

Description

iterator*

expression, variable

the iterator

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

iterator = openGoogleAppsUserIterator(conn, true)
hasNext = hasNext(iterator)
while(hasNext) {
    next = getNext(iterator)
    log("next:" + next);
    hasNext = hasNext(iterator)
}
close(iterator)

Check if there are more items in this iterator.

Property

Value

Description

iterator*

expression, variable

the iterator

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

iterator = openGoogleAppsUserIterator(conn, true)
hasNext = hasNext(iterator)
while(hasNext) {
    next = getNext(iterator)
    log("next:" + next);
    hasNext = hasNext(iterator)
}
close(iterator)

Conditionally perform actions.

Property

Value

Description

condition*

expression, variable

The condition to evaluate.

then*

text, expression, variable

the actions to perform if the condition is true

else

text, expression, variable

the actions to perform if the condition is false

Example

outputText = openDelimitedTextOutput(...)
myRecord = createRecord()
setRecordValue(myRecord,"fname","Troy")
setRecordValue(myRecord,"lname","Moreland")
putResult = putTextOutputRecord(outputText,myRecord)
if(putResult) {
    log("Text record output successful!")
} else {
    log("Text record output failed!")
}
close(outputText)

End the action and return a value.

Property

Value

Description

value

text, expression, variable

the value to return from the action - may be assigned to the return variable specified by the caller

Example

return "Hello,World!"

A way to group multiple actions together.

Property

Value

Description

label

expression, variable

the label for the section - may be referenced by break and continue actions

suppressTrace

boolean, expression, variable

suppress detailed tracing of the actions in the section

do*

text, expression, variable

actions

Example

# Open Connections
{
    sessionAD = openADConnection(Global.adHost, Global.adPort,
        Global.adSSL, Global.adUser,<Password>)
    sessionGoogle =     defineGoogleAppsConnection(Global.googleDomain,
         Global.googleUser,<Password>)
    if(!sessionAD || !sessionGoogle) {
        # --- Error making connections. Terminating process.
        return null
    } else {
    }
}

Loop while the condition is true.

Property

Value

Description

label

expression, variable

the label for the loop - may be referenced by break and continue actions

condition*

expression, variable

the condition to evaluate at the beginning of eash loop iteration

do*

text, expression, variable

the actions to perform for each loop iteration

Example

i = 0
while(i < 10) {
    i = i + 1
}