Define calculated values
Calculated Values are field values that will be automatically set during synchronization if certain conditions are met. For example, you can define a rule that, when the connection creates a new story, its Tested value will be set to "false”.
You add a calculated value in the Connection Rules window.
To add a calculated value:
- In the Connection Rules window, choose a type and click Add Type Rule.
- In the Connection Type Rule dialog box, select the Calculated Values tab for either the Target or Master.
Click the Add Calculated Value button. The Add Calculated Value window opens:
Specify the When query. The When query determines the condition that an asset must meet in order for the calculated value to be applied. For details on specifying the When query, see Add projects and rules to a connection.
Note: If you do not specify a When query, then the Calculated Value will always be applied when an asset is synchronized.
In the Set Field drop down, choose the field whose value you want to set.
In the To Value field, specify the value that you want to assign to the field. Use one of the following options:
- Type a static value ("123"), or choose a value from the dropdown list ("Open").
- For reference fields, you can set the value using one of the Find functions. These functions will discover the item according to the criteria you specify. Enter a function and define a From query. For a list of available functions, see Functions.
- For date fields, you must use the long date format with an offset specifier:
For example, 2016-01-01T00:00:00+00:00. Other formats will result in an error.
If you entered a function in the To Value field, define a From query. For details, see Add projects and rules to a connection.
Click OK to save.
Synchronize reference fields
You can use Micro Focus Connect to synchronize reference fields, by creating linkage to the referenced entity.
For example, suppose you are synchronizing a Jira project with an ALM Octane workspace. The Jira bugs and ALM Octane defects have a Release field. In ALM Octane, the Release field is a reference field, meaning that its value is linked to a release entity in the workspace. When creating a defect in ALM Octane, Micro Focus Connect can populate the Release field with the appropriate value, and also link the value to an existing release entity in ALM Octane.
To create a link between reference fields in the Set Field section, you can use the FindFirst functions. These functions search for an item in the product's database that matches the criteria defined in the From section. For details, see Functions.
To find the matching release, you must refer to the field value in the item being synchronized. To do so, use the
My->fieldNameto refer to the product for which you are creating the calculated value—target or master.
Other->to refer to the product on the other end of the synchronization.
fieldName, specify the field's system name—not the field's label.
The following example demonstrates synchronizing the Release field in an ALM Octane defect:
For other examples using functions and variables, see Calculated value examples.
Assign items to a default user
You can use calculated fields to set user fields, such as Assigned to and Detected by to a different user, other than the one set in the starting endpoint.
For example, at one endpoint, users 1,2,3, and 4 detected defects and assigned them to users 5, 6, 7, and 8. When you migrate the defects to another endpoint, you want to assign all of them to user 9.
To assign the defects to another user:
Open the Add Calculated Value screen. For details, see Add a calculated value.
Set a calculated value for the target. For example:
Set field: Assignee
To value: Person # 9 Display Name
In this example, defects will always be assigned to a specific default user, Person #9 Display name in Jira, regardless of who created the defect, or who it was assigned to in ALM/QC.
Tip: This strategy can be used for any user field, such as the Jira reporter field .
You can dynamically set field values using functions. Functions are usually used in combination with values or variables in the From area.
|Max(type, property)||The largest of a set.|
|Min(type, property)||The smallest of a set.|
|FindFirst(type)||The first in a set that satisfies the find criteria.|
|FindAll(type)||Returns all in a set that satisfy the find criteria.|
|FindFirstOrThrow(type)||The first in a set that satisfies the find criteria. Returns an error if not found.|
|FindAllOrThrow(type)||Returns all in a set that satisfy the find criteria. Returns an error if not found.|
|FindFirstInProperty(syncItemProperty)||The first in a set that satisfies the find criteria, looking only at the SyncItems in the given property.|
|FindAllInProperty(syncItemProperty)||Returns all in a set that satisfy the find criteria, looking only at the SyncItems in the given property.|
|FindFirstInPropertytOrThrow(syncItemProperty)||The first in a set that satisfies the find criteria, looking only at the SyncItems in the given property. Returns an error in not found.|
|FindAllInPropertyOrThrow(syncItemProperty)||Returns all in a set that satisfy the find criteria, looking only at the SyncItems in the given property. Returns an error if not found.|
|csv(type)||A comma-separated string of the values.|
Example of a uni-directional mapping
This section provides an example of a uni-directional mapping of an ALM Octane (Master) List field to a target string field
Create a calculated value for the target of the connection, such as Jira, ALM/QC, and so forth. For details, see Add a calculated value.
Follow the format shown in the image below, where the ALM Octane Detected in Build field is mapped to the target’s string field.
Set a calculated value for the target. In this example:
Set fields: Custom String Detected in Build (Jira or ALM/QCfield)
To value: Other -> Detected in Build.label