expect_cloudobject
expect_cloudobject looks for a specific cloudobject and creates one if not found. If an identifier is specified, expect_cloudobject will search for a cloud object with the given identifier. if none is found, then a new cloud object will be created and assigned the given identifier. Identifiers are stored in the object's "__id" value.
Only one cloudobject will be returned
If expect_cloudobject finds more than one object matching the given type (and identifier) it will return one of them
Constant strings are best!
You can pass any value for the type, but whenever possible, use a constant string (e.g. "Person") When you do so, Exotool is able to operate more efficiently and produce better, faster. more secure code.
Format:
expect_cloudobject(type,[identifier])
Parameters:
| Parameter | Type | Description |
|---|---|---|
| type | string | The type of of the object to search for. |
| identifier | string |  [Optional]An identifier to search for. The identifier is used to look for a specific cloudobject of the given type. |
Returned Value:
| Type | Description |
|---|---|
| cloudobject | Return value will be the cloudobject found or newly created |
Examples
configuration = expect_cloudobject("Configuration")
security_settings_for_department = expect_cloudobject("Settings",department)
settings = expect_cloudobject("Settings", user_id)
if (!settings.has_been_set_up) {
settings.default_location = "usa"
settings.has_been_set_up = true
}