0
Fixed

ContextNonUnique for synchronised entity returns entity with no duplicate context

Adrian Corston 4 years ago in UNIFYBroker/Plus updated by Beau Harrison (Senior Product Software Engineer) 4 years ago 7

When calling CheckFieldUniqueness in a synchronisation task the ContextNonUnique function returns an entity for which no duplicate context exists other than the synchronised entity itself.  I suspect it is failing to exclude itself from the check, and that no-one has noticed this before because most of the time CheckFieldUniqueness is called in a provisioning task and so the entity doesn't yet exist in the target entity space.

GOOD, I'M SATISFIED
Satisfaction mark by Adrian Corston 4 years ago
-1

Demonstrated the issue to Matt in a share session earlier today.

Under review

A patch has been provided for deployment which adds an optional parameter to the CheckFieldUniqueness function that prevents entities from being flagged as not unique if they already exist in the target context.

To enable this mode, provide $True as a third parameter ie:

$components.CheckFieldUniqueness('fieldName', $targetEntities, $True);

Thanks Beau.

Can you confirm that with the $True parameter it will still check each entity against other entities in the target context?  I still need it to make sure the value on each objects aren't duplicated on other objects.

Where you're written "prevents entities from being flagged as not unique if they already exist in the target context" it sounds a bit like it won't check for context duplicates at all if the object already exists in the target entity context.

Yeah sorry. That should be "prevents entities from being flagged as not unique if the only target context entity to share a value in the specified field is itself".

Awesome, that's perfect thank you.

I've checked this in the customer's TEST environment and it worked.  Thank you!