To make your custom ID you'll use a microflow but first you need a several things ready
First have your enumerations look like these
This way we reduce some work. (Don’t worry captions are what we see on the front end)
Since Branch is a different entity, you’ll have to create objects of the Branch entity for each branch in your enum
Your Product_NewEdit page should have a Reference selector widget to make branches selectable (Drop-down won’t do)
Now change the save button’s On click to “Call a microflow”
Create a new microflow and name it “ACT_Product_Save” for example
It should look like this
*You can also utilize the auto number attribute type if you want. So instead of looking for similar products e.g. DREMUM1, DREMUM2, DREDEL1 …
You’ll have DREMUM1, DREMUM2, DREDEL3 ...
Can be done with a simpler microflow by concatenating the $ResultString with toString($AutoNum)
Make the ID unique through validation rules
You can do this in save product microflow. There create new string variable and perform substring as per your requirement to get product id.
In your case conside $ProductCategory – Dress , $Location = Mumbai and SerialNo – AutoNumber
In your create string variable activity, add like this:
substring($ProductCategory,0,2) + substring($Location,0,2) + SerialNumber
Assign this newly created variable to ProductID
The best way to do that would be in a microflow (MF) where you build up your ID string and use a auto number to keep your counter unique or just store a counter.
Also place validation on your ProductID that the attribute must be unique in the database. Please just use error handling in your MF that creates the ID
Hi, I followed the exact steps as mentioned above, and got the following error while adding more dress in the same branch!
Hi Tejas Mhaske,
In scenarios like this would have kept a unique Identifier differentiating the String and the number :
ex: DREMUM1001 → DREMUM_1001
With this approach, I can retrieve my last product with the help of created date from the database and then with the combination of the ‘Findlast’ and ‘subString’ function to find the integer and then increment it.
Now at last you can concatenate your String.
Hope it Helps!!