Generating next available SKU depending on product category

Topic Labels: Scripting
483 1
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Hey. I need some help scripting to generate next available SKU when adding a new product through an Interface.

My table is called PRODUCT MASTER and my column is SKU. Depending if product category (column category) is Software, Subscription or Hardware, it should look for and create the next available SKU number in the 100000, 200000 or 300000 range. 

And how can I add this automation to the Interface form that I have created? Or do I need to add the automation to a button? 

Appreciate any help! 🙂

1 Reply 1

A non-scripting option could be:

1. Create a table to contain the product categories and use a rollup with "MAX(values)" to find the current SKU
2. Create a formula field that will generate the next SKU number for each product category by adding one to the value from the previous step (or however you generate SKUs)
3. Create a lookup field in your product table to display the value from the field in Step 2
4. When a new product record is created, link it to the appropriate product category record
5. Have an automation that triggers when a product record is linked to a product category record but does not have an SKU.  Its action will be to paste the value from the lookup field in Step 3 into the "ID" field

Best of luck with the scripting stuff though!