How to Remove Value from field

chanikya
Tera Guru

Hi All,

kindly help me on below one

there are two List type fields PR Parent, PR Child

if Parent value removed from PR Parent then that Parent related Child values should be removed from PR Child.

find_real_file.png

 

PR Details table designed like this.

find_real_file.png

17 REPLIES 17

Hi Aman,

as of now In PR Child we are adding manually.

please see below screenshot, if you removed """"A""" in parent ,  then "A" of child record """AAAAA"""" should be removed from child field.

find_real_file.png

 

 

Sagar Pagar
Tera Patron

Hi,

Write a on change client script as -

field - PR Parent

 

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

	if (newValue == ""){
		g_form.clearValue('pr_child'); // add your field name here
	}
}

Thanks,

Sagar Pagar

The world works with ServiceNow

Hi Sagar,

I m not asking to clear total filed . 

please see below screenshot, if you removed """"A"""  ,  then "A" of child record """AAAAA"""" should be removed from child field.

find_real_file.png

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I assume both list fields refer to same table.

If yes then why are you allowing the same value to be selected in PR Child

Why not add reference qualifier on PR child

javascript: 'sys_idNOT IN' + current.u_pr_parent;

Regards
Ankur

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

Hi @Ankur Bawiskar 

kindly check below screenshot

First level :

B, A in Parent manually selected

 AAAAA, BBBBB selected manually in child .

 

Request : Second level :

If I deselect "A" from Parent list.  then Parent "A" related any Childs already added in Child LIST field ,that values should be deslected automatically using with Onchange activity ("AAAAA") .

Is it possible ? .

find_real_file.png