Microflow to check for duplication

0
Hello every one,  I am using a Microflow to check for duplication as I creat and save a form. For example, if there is already a topic with the same title in the topic list (where 'topic' is an entity and 'title' is an attribute), an error message would be displayed: However, if I want to change an attribute in an existing topic (not creat) , such as the description, the error message appears again, which we do not want. This happens even though the title (T2) is already saved. In this situation, the title donot need to be changed and should not trigger a error. How can I avoid this issue? Thank you! 
asked
1 answers
1

There's two solutions here based on what you need:

First you can detect if the object has already been saved to the database with isNew(), which would allow your microflow to only check for duplicates before your item gets saved to the database.

Pair that with making the title field read-only (you can mark it as non-editable on that popup, or conditionally editable based on isNew()), and you should have a working solution.

 

The option I tend to go with is using xpath in your retrieve on the microflow. Something like:

[Topic_ID = $myobject/Topic_ID and id != $myobject]

This would fetch records which have a matching title, but which ARE NOT the object you're validating, whereas your method will fetch the object you're validating.

 

Additionally using XPath here means you don't need a loop: just check to see if the retrieved list is empty or not (if it's empty, no duplicates were found)

answered