- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-07-2023 01:53 AM
Please help me this is my script for extend button, click on the button then directly open KB_knowledge list view page. please help me find the solution.
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-07-2023 03:52 AM
Hi,
Create like below:
Below is the script:
extendByYear(current);
function extendByYear(current){
	var nextDate = new GlideDateTime(current.valid_to);
	nextDate.addYearsUTC(1);
	current.valid_to = nextDate.getDate();
	current.update();
	action.setRedirectURL(current);
}
					
				
			
			
				Thanks
Anil Lande
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-07-2023 02:12 AM
Hi,
Can you please share where your UiAction should be visible?
What do you mean by extend by 1 year (from which date current valid_to date or from today?)
Thanks
Anil Lande
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-07-2023 02:51 AM
Task: extend KB for 1 year button
Description: Create a UI action button to extend the current KB record for 1 year
current Valid to date
how to achive that
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-07-2023 03:52 AM
Hi,
Create like below:
Below is the script:
extendByYear(current);
function extendByYear(current){
	var nextDate = new GlideDateTime(current.valid_to);
	nextDate.addYearsUTC(1);
	current.valid_to = nextDate.getDate();
	current.update();
	action.setRedirectURL(current);
}
					
				
			
			
				Thanks
Anil Lande
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-07-2023 04:30 AM
Thank you for help
