How to map a field from a record producer using scripts

Dhanya
Kilo Contributor

Hi i need help with a catalog client script. i'm trying to pass a value from the record producer to the incident based on value selected by the user. I understand we cannot use current to refer to the incident form,

if ((producer.team)== 'MAC'){
g_form.setValue('assignment_group','MAC-Support');}

i need this value to be mapped to the field in incident. But this is not working.

15 REPLIES 15

okay, thanks Mark.

hi  i'm using it on onSubmit.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

What is the reason for choosing Catalog Client Script? You could use the Record Producer script field for this. Or is for example the assignment_group field also a variable on your Record Producer? 

If going for Record Producer script, it could be as easy as:

if(producer.team == 'MAC') {
  current.assignment_group = "some_sys_id";
}

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

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

yes the field is there in the record producer but only a few of the list will be use so i gave that list in layman terms. Hence i need to map this through script.

if(producer.team == 'MAC') {
  current.assignment_group = "some_sys_id";
}

as to the above - the if condition doesnt seem to be working in the record producer script section.

i have used the sript section to pass a couple of variable values to  a multi-line text.let me try it there again.

 

thanks

Dhanya

Strange that the if condition doesn't work. So the variable you are after is "team" correct, and "team" is the actual value of this variable? Is the value also exactly "MAC"? Or is that the label, or a part of it?
Can you debug this?

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

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn