Catalog Item | Multiple Choice / Radio button | Dynamic choice

Sylvain12
Tera Contributor

Hello,

I'm working on a catalog item which has a Multiple Choice Variable with 2 choices:

- Current Year

- Next Year

 

I would like to make the choices dynamic, for example today the choices would be -2022 and -2023, and on 01/01/2023 choices would become -2023 and -2024.

I didn't find information on that, and I would like to know if this is possible to do ?

 

Thank you very much in advance for your feedback.

 

Kr,

Sylvain

 

1 ACCEPTED SOLUTION

Abhijit4
Mega Sage

If I understood correctly, you would like to show current year and next year value in drop down option in catalog item variable. If so please use below script :

 

Create On Load Catalog Client script:

 

var currentYear=new Date().getFullYear();
var nextYear=currentYear+1;
g_form.addOption('yourFieldNameHere', currentYear, currentYear,1);
g_form.addOption('yourFieldNameHere', nextYear, nextYear,1);

 Please mark answer as Correct or Helpful based on impact.

View solution in original post

5 REPLIES 5

Hello Abhijit,

 

Just tried it, works perfectly !

 

Thank you very much for your support !

 

Sylvain