Initializing parent objects for data mapping
Ensure that all the parent objects of a property exist to prevent an error from
occurring at run time.
About this task
When mapping data to or from complex parameters with graphical data mapping, you can make sure
all the parent objects are initialized in the following ways:
- Author the mapping by selecting variables or properties with graphical data mapping.
- For the input mapping source, you can select a variable or a property in a variable. The runtime maps the value as null if the property's parent variable is not initialized.
- For the input mapping target, you can choose an input variable to map the data to. The runtime automatically initializes the parent input object before it maps the value to a property.
- For the output mapping source, you can choose an output variable to map the data from. The runtime maps the value as null if the property's parent output is not returned from the call.
- For the output mapping target, you can select a variable or a property in a variable. The runtime automatically initializes the parent variable object before it maps the value to a property.
- Convert the mapping from JavaScript to select the variable or properties by using graphical data mapping.
-
Open the Data Mapping dialog and go to the existing mapping. Existing mappings are specified using JavaScript mode display JS icon and a JavaScript expression. If a JavaScript expression refers to a single local variable or a property, click Select a variable to select a new value to replace the existing mapping.
-
When mapping data to or from complex parameters without graphical data mapping, you can make sure
that the parent object exists in the following ways:
- Define the default value for local variables that are used as a source or target of data mapping that is specified with JavaScript.
- Assign an object that is returned from an earlier activity to a variable. Then, use that variable or its properties as an input mapping source for a later activity.
- Add JavaScript before activity with input mapping.
- Define a variable of a complex type in the Variables tab.
- Place a script activity before the activity with the data mapping in the flow.
- In the script activity, write JavaScript to initialize the variable and set its properties.
- Use that variable or its properties as a source of input mapping for a later activity.
- Add JavaScript after activity with the output mapping.
- Define a variable of a complex type using Variables tab.
- In the data mapping, map the output to the variable.
- Place a script activity after the activity with the data mapping in the flow.
- In the script activity, write JavaScript to check that the variable exists and assign the property values to other variables as required by the process logic.