Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Auto Expire Standard change templates after 12 months

Harry Campbell2
Mega Guru

Hello All,

I want to be able to automatically expire standard change templates after 12 months, currently working on this using a workflow with a timer activity on the Standard Change Template table.

The issue I am having is when someone modifies the template using the 'Modify Standard Change Template' record producer. This just creates a new template version but ideally I would like it to reset the timer on the overall Standard Change Template workflow.

Can anyone think of a way this would be possible?

Thanks

Harry

1 ACCEPTED SOLUTION
6 REPLIES 6

Harry Campbell2
Mega Guru

Ok, I am a man with a plan.



My thinking is to add a date field on the std_change_record_producer   run a workflow script on the std_change_producer_version table that sets the expiry date to 265 days from today.



I can then run a daily scheduled job to mark them as inactive.



Next question, how can I set a date field via script to 365 days from today?


Henry,


Thats a great plan.


Check this link to add days to date



Add Days to Date Field


Check the addDays() function


GlideDateTime - ServiceNow Wiki


Thanks Aakash, that worked perfectly.