When user click the Resolve button, valid to field value needs to be updated automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 09:55 AM
Hi team,
When the user clicks the Resolve button, the "valid to" field value needs to be updated automatically.
re-publishing that and the revised "valid to" date should be for another 6 months time (i.e. 180 days from the date of re-publishing the KBA).
Regards,
Mahesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 10:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 11:46 AM
Hi Aman,
When the user clicks the republish button and valid date needs to be updated automatically.
for example:
Valid date: 2023-08-01
Needs to be updated as valid to 2024-02-17 (180 days from the date of re-publishing the knowledge article).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 12:38 PM
Hello @maheshch18,
To update the “valid to” field value automatically when the user clicks the Resolve button, you will need to create a business rule that runs on the kb_knowledge table when the state changes to Resolved. The business rule should calculate the new date by adding 180 days to the current date, and then set the “valid to” field value to that date. You can use the GlideDateTime API to manipulate dates in ServiceNow.
Here is an example of a business rule script that you can use or modify for your purpose:
// Get the current record
var gr = current;
// Check if the state is Resolved
if (gr.state == 'Resolved') {
// Get the current date
var gdt = new GlideDateTime();
gdt.setValue(gr.sys_updated_on);
// Add 180 days to the current date
gdt.addDays(180);
// Set the "valid to" field value to the new date
gr.valid_to = gdt;
}
Hope this helps.
Kind Regards,
Swarnadeep Nandy