Secondary Object Bind

Business rules can use the Secondary Object bind in conjunction with the Matching, Linking, and Merging functionality when there is a need for binding another object in addition to the Current Object. A number of the golden record match action handlers require access to two objects (for example, two golden records in merge and split cases).

For example, a business action selected in the matching algorithm's match action when merging two golden records could work on the two golden records to be merged using the Current Object and Secondary Object binds.

Note: Secondary Object binds are only valid for matchers. For more information, refer to the Matching Algorithms and Match Expressions topic in the Matching, Linking, and Merging documentation here.

The bind can be found within the 'Binds to' dropdown, as shown below.

Configuration

To use any bind:

  1. Create a business rule as defined in the Creating a Business Rule, Function, or Library topic.

  2. Edit the business rule as defined in the Editing a Business Rule or Function topic.

  3. In the Edit Operation dialog, add the bind to a business rule, as defined in the Adding a Bind topic in the Resource Materials online help documentation.

  4. In the Edit Operation dialog, optionally add Messages, as defined in the Localized Messages for JavaScript Business Rules topic.

  5. In the Edit Operation dialog, add JavaScript to call the bind.

Example

The following is an example JavaScript that uses this bind.

Important: Example scripts should not be used as-is without thorough testing, including updating the script to match object and link types that exist on your system. JavaScript variable names are case-sensitive.

A simple merge action deletes the enrichment object for a golden record that is to be deleted as the consequence of a merge.

Copy
function hasRefToObjectOfType(source, refType, objectTypeID) {
grRefsList = source.getReferences(refType);
for (var i = 0; i < grRefsList.size(); i++) {
if (grRefsList.get(i).getTarget().getObjectType().getID() == objectTypeID) {
return true;
}
}
return false;
}
function deleteERForGR(gr, grRefType, erObjectTypeID) {
grRefsList = gr.getReferences(grRefType);
for (var i = 0; i < grRefsList.size(); i++) {
if (grRefsList.get(i).getTarget().getObjectType().getID() == erObjectTypeID) {
var er = grRefsList.get(i).getTarget();
try {
grRefsList.get(i).delete();
er.delete();
}
catch(e) {
throw e.getMessage();
}
return;
}
}
}
var soObjectTypeID = "ExternalItem";
var erObjectTypeID = "ExternalItemEnrichmentRecord";
var aStays = hasRefToObjectOfType(goldenRecordA, grRefType, soObjectTypeID);
var bStays = hasRefToObjectOfType(goldenRecordB, grRefType, soObjectTypeID);
if (aStays && bStays) {
throw "Something is wrong. Both GRs to be merged have references to source objects.";
}
if (aStays) {
deleteERForGR(goldenRecordB, grRefType, erObjectTypeID);
}
if (bStays) {
deleteERForGR(goldenRecordB, grRefType, erObjectTypeID);
}
*/
erFunctions.deleteERForGR(goldenRecordB, grRefType, erObjectTypeID);
}