ATF Test step config: Cannot read properties of undefined (reading 'message') Dynamic Date/Time

phillipross
Mega Contributor

I have made a config test step that should create a Dynamic Date/Time Value and Output it. The Value was created at some point (Calculated time 2024-10-21 15:22:07) but i cant use the value in the following step (Cannot read properties of undefined (reading 'message')). How do i fix this Issue?

 

Any help would mean a lot thank you.

  var gdt = new GlideDateTime();
    gdt.add(7500000);
    //gdt.toString();
    outputs.u_calculatedtime = eval('gdt');
	//outputs.u_calculatedtime = 'gdt';
	////outputs.u_calculatedtime = gdt;
    stepResult.setOutputMessage('Calculated time ' + outputs.u_calculatedtime);
    stepResult.setSuccess();
    return outputs.u_calculatedtime;

Bildschirmfoto_21-10-2024_151615_modn.snow.noris.de.jpeg

Bildschirmfoto_21-10-2024_15187_modn.snow.noris.de.jpeg

Bildschirmfoto_21-10-2024_151851_modn.snow.noris.de.jpeg

   

1 REPLY 1

Chidanand_VK
Tera Expert

Hi @phillipross.,

There is a very simple way to set the Date Dynamically.

Just use the script javascript:gs.daysAgo(X) in place of value, as shown in the below screenshot (sets Today's date).

Chidanand_VK_0-1736608087810.png

 

Replace the X in brackets with any Number.

For Past Days:  1, 2, 3......

For Today: 0

For Future Days: -1, -2, -3......

 

If my answer helped you in any way, please mark it as helpful or correct.
 
Regards,
Chidanand Kalmani