Performs a lookup in the relationship table in the relationship database based on the foreign key of the source business object, adding a new relationship instance in the foreign relationship table if the foreign key does not exist.
Syntax
public static void foreignKeyXref(String relDefName, String appParticpntDefName, String genParticpntDefName, BusObj appSpecificBusObj, String appForeignAttr, BusObj genericBusObj, String genForeignAttr, CxExecutionContext map_ctx)
Parameters
Return values
None.
Exceptions
RelationshipRuntimeException
Notes
The foreignKeyXref() method performs a foreign key lookup on the relationship table for the AppParticpntDefName participant; that is, it checks the foreign relationship table for a relationship instance that matches the value in the foreign key of the appSpecificBusObj business object. If this lookup fails, the foreignKeyXref() method adds a new relationship instance for the application-specific key to the foreign relationship table; it does not just set the foreign key in the destination business object to null (as the foreignKeyLookup() method does). This method can be used in both inbound and outbound maps.
The foreignKeyXref() method performs the following validations on arguments that are passed in:
If any of these validations fails, foreignKeyXref() throws the RelationshipRuntimeException exception.
Once the arguments are validated, the action that foreignKeyXref() takes depends on the following information:
The foreignKeyXref() method handles all of the basic adding of relationship instances in the foreign relationship table for the appropriate combination of calling context and verb. For more information on the actions that foreignKeyXref() takes, see "Using the Foreign Key Cross-Reference function block".. Table 89 and Table 90 provide the actions for each of the calling contexts.
Examples
On the Clarify_SFAQuote to Order map, the CustomerId field is a foreign key lookup. This is because Sales Order Processing Collab calls Customer Wrapper.
if (ObjSAP_OrderLineItem.get("SAP_OrderLineObjectIdentifier[0]") != null) { if (ObjSAP_OrderLineItem.getString( "SAP_OrderLineObjectIdentifier[0].ObjectQualifier").equals("002")) { BusObj temp = ObjSAP_OrderLineItem.getBusObj( "SAP_OrderLineObjectIdentifier[0]"); if (temp.isNull("ItemId")) { logWarning(5003, "SAP_OrderLineItem.SAP_OrderLineObjectIdentifier[1].ItemId"); } else { try { IdentityRelationship.foreignKeyXref( "Item", "SAPMbasc", "CWItba", temp, "ItemId", ObjOrderLineItem, "ItemId", cwExecCtx); } catch (RelationshipRuntimeException re) { logWarning(re.getMessage()); } if (ObjOrderLineItem.get("ItemId") == null ) { logError(5009, "OrderLineItem.ItemId", "SAP_OrderLineItem.SAP_OrderLineObjectIdentifier.ItemId", "Item", "SAPMbasc", strInitiator); throw new MapFailureException("ForeignKeyXref() failed"); } } } }
See also