The CreatorCon Call for Content is officially open! Get started here.

UI Policy to change the other fields value

Mr_Blue
Tera Expert

Hello Guys,

I have a form, In this form I got 2 drop downs [ 'Department','Gender' ]

*Values in Department [ 'IT', 'FIN', 'COMM' ] & values in Gender [ 'M','F','T' ]

#what i want to do here is, >>> When i select "IT" value from Department, Gender drop down should automatically set its value to ' M '

I know that UI policy is only used when we need to make field [ mandatory, hide, read-only ], But is it possible to do this via UI policy advance script ?

 

Can SomeOne please help me here, show me how to write script to change the drop down value of Gender.

 

Thank You .... 

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Indeed you can use the run scripts, execute if true:

function onCondition() {

	g_form.setValue('gender', 'M');
	
}

Maybe slightly have to change, depending on the exact value names you have.

This of course + a normal condition on the Department field. Department is IT or something 🙂

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

2 REPLIES 2

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Indeed you can use the run scripts, execute if true:

function onCondition() {

	g_form.setValue('gender', 'M');
	
}

Maybe slightly have to change, depending on the exact value names you have.

This of course + a normal condition on the Department field. Department is IT or something 🙂

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hey Thanks a lot Mark, it worked.. 🙂