"Unique" flow field attribute behavior



Hi there !

I have been using flows recently and I noticed a strange behavior about the “unique” field attribute.
In my opinion, the role of such an attribute is to prevent the field value to be duplicate among the entries. Then it should return an error when trying to create an entry using a field value that is already existing so the client can handle the fact that the value is already existing (not sure if I am understandable).
The current behavior seems to move the value from the old entry to the new one but without responding by any error.

In my case I want to generate an unique random code and associate it to an order entry so my customers can have a user-friendlier order code than the order id. But if the api does not return any error I can not know if the code was already existing.

Can you confirm the current behavior and what workaround could you propose ?

Thank you !


Hey @NeilujD :wave:

Thanks for raising this issue.

You are right in thinking that this is functionality is not working as intended. This is currently a known issue and is with our product team.

How are you currently generating your order reference? You could look at using a package like cuid in the meantime until this issue is resolved.

I’ll report back here once this bug has been fixed.


Thank you for the tip @jonathan !
cuid looks good but it is not short enough to me. The ideal result would be to have 6 length alpha-numerical upper string so my customers can give it to me with the least possible error.
I’ll try this out though !


Hi @NeilujD

With cuid you can call .slug() to get a smaller URL (between 7 - 10 chars) but they don’t recommend you use the short IDs for unique IDs. They do recommend against using this alone for unique IDs, I’ve used this method with prefixed URLs for blog article slugs.

You could make use of our integrations API that on product.created will perform a call back to the moltin API and get all products by created_at in descending order, and increment the number of the last product custom field entry.

That does involve writing your own serverless function, which may or may not be outside the scope of your project until we fix issue.

I hope this helps :smile:


So in your opinion @notrab could I consider this solution ?


Hi @NeilujD

Yeah that’ll work.

Take a look at Human readable Order ID's?

I hope this helps :smile:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.