How to Update the worknotes whenever the field value changes in Form

Pooja Khatri
Tera Contributor

Hello All,

I have a requirement , where I have one variable on my Form as 'Status change' which is a selectbox and it contains multiple option such as cancelled , on hold , waiting for resource etc , whenever User changes the value of the 'Status Change' variable from one field to another the worknotes should get updated.

For eg : Status was changed from <<old value >> to <<new value>>

Can anyone help me how I can configure this functionality in my Form .

 

 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Pooja Khatri 

you can write onChange Catalog Client Script on that variable for your catalog item

1) Applies on Requested Item

2) Script as this

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		return;
	}

	var str = 'Status was changed from ' + oldValue + ' to ' + newValue;
	g_form.setValue('work_notes', str);
	g_form.save();

}

Regards
Ankur

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

View solution in original post

9 REPLIES 9

Thank You ankur it helped 🙂 

Glad to help.

Please mark response helpful as well.

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

Community Alums
Not applicable

@Ankur Bawiskar Hope you are doing well,

 

I am also facing same issue!!

 

Using change request or change model we create equipment instance (configuration item) once created worknotes activities not updating 

 

It's just updating with older value even after new CI got created

 

Please help, that would be helpful 

 

Thanks 

Viny

 

Abbas_Ahamed
Tera Contributor

Hi @Ankur Bawiskar,

 

Since we use this for several variables, how can we make this work?

@Abbas_Ahamed 

request you to create a separate thread and tag me there as this is an old question.

please do share all the details there

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