I need to populate the current date and time in the below attached variables when perform restart im

Archana23
Tera Contributor

I need to populate the current date and time in the below attached variables when perform restart immediately is checked. Please suggest 

 

Archana23_1-1710439134721.png

 

1 ACCEPTED SOLUTION

Deepak Shaerma
Kilo Sage

Hi @Archana23 
 

Please Create a new Catalog Client Script or do modifications in your catalog client script as I mentioned below, This will solves your Query:

Create a Catalog Client Script

Name : 
Applies to : A Catalog Item
UI Type : Desktop/ All
Type: onChange

Catalog Item: Select your Catalog Item

Variable name: Perform Restart Immediately

Applies on Catalog Item View : Tick

if(newValue === 'true') {
var now = new Date();
var fDT = now.toISOString();

g_form.setValue('variable1name' , fDT);
g_form.setValue('variable2name' , fDT);
}

//change variable name according to your current variable name.


Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will helps us a lot.
Thanks & Regards 
Deepak Sharma

View solution in original post

7 REPLIES 7

Hi @Archana23,

 

Looking at your script, line 11, the 1st parameter within the g_for.setValue() method required quotes around it. 

Assuming restart_at is the field name you're setting, line 11 should be exactly as below (including the single quotes)

 

g_form.setValue('restart_at', dateTime_str);
 
The reason you don't need quotes around the second parameter is becuase you've already declared the variable and the type.
 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

 
 

Deepak Shaerma
Kilo Sage

Hi @Archana23 
 

Please Create a new Catalog Client Script or do modifications in your catalog client script as I mentioned below, This will solves your Query:

Create a Catalog Client Script

Name : 
Applies to : A Catalog Item
UI Type : Desktop/ All
Type: onChange

Catalog Item: Select your Catalog Item

Variable name: Perform Restart Immediately

Applies on Catalog Item View : Tick

if(newValue === 'true') {
var now = new Date();
var fDT = now.toISOString();

g_form.setValue('variable1name' , fDT);
g_form.setValue('variable2name' , fDT);
}

//change variable name according to your current variable name.


Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will helps us a lot.
Thanks & Regards 
Deepak Sharma

Hello Deepak,

 

Thanks for sharing in detail, it is working as expected.