function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Peter Russell 9Peter Russell 9 

if field = X, update field with X formula on large scale


Hi there

I am looking to create a flow that updates a coupon code field with a coupon code based upon a sales price field.

There are 700 coupon codes and I need to create a formula or some flow that will update the coupon code field with the correct code based upon the value in the sales price field.

SAMPLE:

 Coupon value Coupon code
 £         100.00  u01ya
 £         110.00  qujrz
 £         120.00  44i77
 £         130.00  l4kua
 £         140.00  wdxk1
 £         150.00  5hotf

could someone help me with creating the formula logic to update a flow variable with the coupon code or advise on the best way to get this to work?  I tried process builder but it gets very flow and unusable as the size grows.
RD@SFRD@SF
Hi Peter,

If this is a one-time thing I suggest you use a data upload to do this, you can use excel vlookup function to map the coupon codes based on the coupon value.

Hope it helps
RD
Peter Russell 9Peter Russell 9
Thanks for the quick reply RD.

I need this to be done whenever a record is updated as the coupon code forms part of a custom URL for an online checkout which is sent to the customer.
Ravi Dutt SharmaRavi Dutt Sharma
Keep the coupon values and coupon code in a custom setting. Write a before insert/ before update trigger on that object and check  the coupon value. Then get the correct coupon code from the custom setting and assign it to the coupon code field.
Peter Russell 9Peter Russell 9
Hi Ravi

Could you explain in a bit more detail how that would work?