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

AshishKM
Kilo Patron
Kilo Patron

Hi @Archana23 ,

 

Write onChange client script on checkbox ( catalog client script for catalog item ) and set current date to these two variable using g_form.setValue(<fieldName>, <fieldValue> );

 

Try this code in client script

var date = new Date();
var dateTime_str = formatDate(date, g_user_date_time_format);
alert(dateTime);

 

-Thanks,
AshishKM

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Archana23_0-1710481429950.png

Can you please let me know where I am missing here

alert is giving expected result or not ? 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

No, the alert is not displaying in the form.