select "ON HOLD" option in state field in the form then it turn into progress after certain period

GOLLADASARS
Tera Contributor

 

Hello,

I Have been assigned to the task where I have field called state which is having choice like "ON HOLD" on the incident form. When I select the "ON HOLD" option it will ask me to update the "OFF HOLD Date/Time" which is another field on the form based on "ON HOLD" selection it should be visible to me. The "OFF HOLD Date/Time" should be mandatory field you should select a future date only. Now when the selected "OFF HOLD Date/Time" reached in the system like if suppose you selected the date as "18-08-2025 10:00:00" when the system reach same time the record should automatically change the state to "WORK IN PROGRESS"

 

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@GOLLADASARS 

it's an easy requirement.

I am sharing steps for each of your items.

1) create UI policy to show and make mandatory "OFF HOLD Date/Time" when State changes to ON HOLD

2) create another onChange client script on "OFF HOLD Date/Time" to allow only future date and restrict past date

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue === '') {
		return;
	}
	g_form.hideErrorBox('off_hold_date'); // give your field name here
	if (newValue != oldValue) {
		var RightNow = new Date().getTime();
		var end = new Date(g_form.getValue('off_hold_date')).getTime();  // give your field name here
		if (end < RightNow) {
			g_form.clearValue('off_hold_date');  // give your field name here
			g_form.showFieldMsg('off_hold_date', 'Off hold date must be after the today, 'error', true);  // give your field name here
		}
	}
}

3) then have a flow on incident table

a) Trigger Condition: State Changes to On Hold AND OFF HOLD Date/Time [IS NOT EMPTY]

b) Use Wait for Duration and make flow wait till that date reached

c) Once date reaches flow will proceed and you can use "Update Record" flow action to update the State to Work In Progress

check this which talks about the same, it uses catalog item variable but you can pick the OFF HOLD Date/Time instead of variable

Flow Designer : Making the flow wait until a specific date time based on a catalog variable 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@GOLLADASARS 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

GOLLADASARS
Tera Contributor

Hello, I am doing this task in PDI, so I could not see wait for duration condition in the flow designer. If you could explain me how to get that or else if any other approach exists please let me know.

Thanks