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

Nikita Tajane
Kilo Expert

Hello Pooja ,

do you work on incident form??

Aman Singh_
Kilo Sage

Hi,

 

Follow the steps:

Open the record for the table and scroll down and click on Activity filter

find_real_file.png

Scroll down and click on Configure Available  fields.

Then select your required variable and put that in the selected bucket.

Hit Save.

find_real_file.png

Now whenever that field value will be updated you will see it in the worknotes.

Please mark reply as Helpful/Correct, if applicable. Thanks!

Aman

 

Hi @Aman Singh  -- by implementing this it will become a global change correct but I only want to implement this for a single catalog item , how I can do it for that ...

 

and the variable 'status change' will only be visible on RITM and not on the Form.

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