Performs a lookup in a foreign relationship table based on the foreign key of the source business object, failing to find a relationship instance if the foreign key does not exist in the foreign relationship table.
Syntax
public static void foreignKeyLookup(String relDefName, String appParticpntDefName, BusObj appSpecificBusObj, String appForeignAttr, BusObj genericBusObj, String genForeignAttr, CwExecutionContext map_ctx)
Parameters
Return values
None.
Exceptions
RelationshipRuntimeException
Notes
The foreignKeyLookup() 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 foreignKeyLookup() method just sets the foreign key in the destination business object to null; it does not insert a row in the foreign relationship table (as the foreignKeyXref() method does). This method can be used in both inbound and outbound maps.
Examples
On the Clarify_PartRequest to Requisition object, the VendorId field is a foreign key lookup. This is because Purchasing does not call Vendor Wrapper. We do not use the foreignKeyXref() method here because we do not want to insert a row if the lookup fails.
if (ObjCustomerRole.isNull("RoleId")) { logError(5003, "OrderAssociatedCustomers.RoleId"); // throw new MapFailureException("OrderAssociatedCustomers.RoleId // is null"); } try { IdentityRelationship.foreignKeyLookup("Customer", "SAPCust", ObjSAP_OrderPartners, "PartnerId", ObjCustomerRole, "RoleId", cwExecCtx); } catch (RelationshipRuntimeException re) { logWarning(re.getMessage()); } if (ObjSAP_OrderPartners.get("PartnerId") == null) { logError(5007, "SAP_OrderPartners.PartnerId", "OrderAssociatedCustomers.RoleId", "Customer", "SAPCust", strInitiator); throw new MapFailureException("ForeignKeyLookup failed"); }
See also