The CreatorCon Call for Content is officially open! Get started here.

How to make a Ui action dissapear after 30 days of task closure

kartikey
Tera Contributor

Hi Everyone,

I want to make my Ui action unavailable after 30 days when a task gets closed.
How should i achieve this?

Thanks,
Kartikey

9 REPLIES 9

Mark Manders
Mega Patron

What is the UI action? What is your current condition?
Something like this should work:

(current.closed_at == '' || gs.daysAgo(current.closed_at) <= 30)


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi,

This is not working, as soon as i close the task, the UI action is getting dissapeared.

Thanks,
Kartikey

NaveenGN
Tera Expert

Hi,

Try to build a condition using glide date time API so that it return true or false in a script include and call this function from UI action condition field.

 

 

Giving a sample code try to build this using the Script include and call the same from UI action condition.
var gdt = new GlideDateTime("2024-04-20 00:21:01");
var gdt1 = new GlideDateTime();
var dur = GlideDateTime.subtract(gdt, gdt1);
var diff = dur.getDayPart();
if(diff > 30){
gs.info("false")
}
If my answer helped you please mark it markfull.

 

udaysingh16
Tera Contributor

Hi,

 

There is one condition field on UI action form -

udaysingh16_0-1716292999405.png

I have highlighted it, in this you have to pass the condition for the visibility.

 

Either you can add the condition directly -

( current.closed_at == '' || gs.daysAgo(current.closed_at) <= 30 ) 

or add the condition in the function within script include or directly add there.