pub.synchronization.xref:getNativeId
WmPublic. Retrieves the native ID of a resource record associated with a canonical key.
Input Parameters
appId | String A unique identifier for the resource from which you want to retrieve the native ID associated with the provided canonical key. |
canonicalKey | String The canonical key for which you want to obtain the corresponding native ID. |
objectId | String A unique identifier for the object or process being synchronized. Typically, the objectId field is set to the name of the business process for which you are performing synchronization, such as "order" or "customer." |
Output Parameters
nativeId | String A unique identifier for the resource record associated with the provided canonical key. If the requested nativeId cannot be found in the cross-reference table, an empty string is returned. |
Usage Notes
You can use the getNativeId service on the target side of a synchronization to determine if the record in the target resource needs to be inserted or just updated.
If the native ID does not exist (the
nativeId field contains an empty string) and you specified the correct input values, then the record does not exist in the resource. You will need to insert the record in the resource to generate the native ID. Then use the
pub.synchronization.xref:insertXReference service to insert a cross-reference between the native ID and the canonical key.
If the native ID exists (the
nativeId field contains a value), then a cross-reference between the canonical key and the record already exists. The record already exists in the resource and only needs to be updated.
After you insert or update the record in the resource, make sure to use
pub.synchronization.latch:closeLatch to close the latch for the record to prevent circular updates (echoes).
For more information about using the getNativeId service in synchronizations, see the Publish-Subscribe Developer’s Guide.
See Also