The new "Save object properties" workflow activity allows access to much more object information from within a script activity.
Excerpt from SDK below.
Active Roles workflow provides the Save Object Properties activity type for saving properties of a particular object at workflow execution time. The properties are saved in the workflow data context, and can be retrieved by other activities before or after the object has changed. In a workflow that includes an activity of the Save Object Properties type, you can use the SavedObjectProperties method to retrieve object properties saved by that activity.
SavedObjectProperties method
Syntax
$workflow.SavedObjectProperties(activityName).get(attributeName)
$workflow.SavedObjectProperties(activityName).getEx(attributeName)
Arguments
activityName
[in] Required. String. Identifies the name of the Save Object Properties activity.
You should specify the display name of the Save Object Properties activity that exists in the workflow; otherwise, the method returns no value.
attributeName
[in] Required. String. Identifies the LDAP display name of the attribute you want to retrieve.
You should specify the name of one of the attributes listed in the "Target properties" setting of the Save Object Properties activity; otherwise, the method returns no value.
Return value
The attribute value or values as of the time of executing the Save Object Properties activity.
$workflow.SavedObjectProperties(activityName).get(attributeName) returns a single value in case of a single-value attribute or an array of values in case of a multi-value attribute.
$workflow.SavedObjectProperties(activityName).getEx(attributeName) returns an array of values for a single-value or multi-value attribute. In case of a single-value attribute, the array contains a single element.
Example
In a workflow that starts upon deletion of an object and uses a Save Object Properties activity to save the object's properties before the object is deleted, you can use the following script function to retrieve the object's display name after the object is deleted. This example assumes the name of the activity that saves object properties in the workflow is "Save Object Properties 1".
Function SavedDisplayName($Request)
{
return $workflow.SavedObjectProperties("Save Object Properties 1").get("displayName")
}
Another example demonstrates how to process the values of a saved multi-value attribute:
Function onPostDelete($Request)
{
$OtherHomephones = $workflow.SavedObjectProperties("Save Object Properties 1").GetEx("otherHomePhone")
foreach($homeNum in $OtherHomephones)
{
#
# Your code goes here that uses the retrieved $homeNum
#
}
}