How do I set a UI action condition for when a date passes?

Bushra Syed
Tera Contributor

Hi, I want to have a UI action that appears when a hardware asset's warranty has expired. What would the condition for this be?

10 REPLIES 10

find_real_file.png

find_real_file.png

Its not working for some reason

Muhammad Khan
Mega Sage
Mega Sage

Hi Bushra,

 

Use the following in condition of UI Action;

current.warranty_expiration.getDisplayValue()<gs.now()

 

Hopefully this will resolve your problem.

 

Regards,

Muhammad Khan

Im not sure why that isnt working.

 

find_real_file.png

 

Hi Bushra,

 

If still your problem is not resolved then you need to check whether the condition field is returning true or false by logging it as follows;

1. UI Action's Condition: gs.info('Result of UI Action Condition: ' + (current.warranty_expiration.getDisplayValue()<gs.now()).toString())

2. Open two records (one expired and one not expired) of alm_hardware table.

3.  Navigate to System Logs > System Log > All, and look for the records as follows;

4. Make sure to check these log results/records properly to the corresponding records of alm_hardware table which you had opened.

 

Note: Above steps are basically used to debug your problem, then move towards the solution, if possible in my capability.

 

Regards,

Muhammad Khan

Allen Andreas
Administrator
Administrator

Hi,

You can try using:

new GlideDate(current.warranty_expiration) < new GlideDate()

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!