Advanced Link Criteria
You can also create your own custom search criteria by checking the Build criteria with custom script check box. This presents you with a script editor to write your own Link Criteria expression. Not all Connectors support the Advanced Link Criteria, and the Connector documentation states whether Advanced Link Criteria is supported. See "Connectors" in Reference.
The search expression that you build must comply with the syntax expected by the underlying system. In order to pass your search expression to the Connector, you must populate the ret.filter object with your string expression.
A simple JavaScript example for an SQL Connector is:
ret.filter = " ID LIKE '" + work.getString("Name") + "'";
This custom Link Criteria assumes an example where the data source has an attribute called ID (typically a column name) that we want to match with the Name attribute in the Work entry.
Note:
- The first part of the SQL expression,
Select * from Table Where
, is provided by IBM® Security Verify Directory Integrator. - Single quotation marks have been added because
work.getString()
returns a string, while SQL syntax asks for single quotation marks around strings constants. - The special syntax with $ and @ is not used here.
Link Criteria errors
The most common error you get when using Link Criteria is:
ERROR> AssemblyLine x failed because
No criteria can be built from input (no link criteria specified)
This error occurs when you have a Link Criteria that refers to an attribute that cannot be found during the Lookup. For example, with the following Link Criteria:
uid equals $w_uid
Link Criteria setup fails if w_uid is not present in the Work entry. This might be because it is not read from the input sources (for example, not in an Input Map, or missing from the input source) or is removed from the Work entry
in a script. In other words, the function call work.getAttribute("w_uid")
returns NULL.
One way to avoid this is to write code in the Before Execute Hook of the Lookup, Delete, or Update mode Connector that skips its operation when the Link Criteria cannot be resolved due to missing attributes. For example:
if (work.getAttribute("w_uid") == null)
system.ignoreEntry();
Your business rules might require other processing, such as a skipEntry()
call instead of ignoreEntry()
, which causes the AssemblyLine to stop processing the current entry and begin from the top on a new iteration.
The ignoreEntry() function simply skips the current Connector and continues with the rest of the AssemblyLine.