Auto Populate a list collector field

rachelconstanti
Mega Sage

I currently have a Service Catalog Item that does the following:

Catalog Item background

Host Name is a reference variable
System Owner is a reference variable

The System Owner auto populates based on the host name.

Workflow

The System Owner needs to approve the request.

This is all working however I have been asked if I can set this up so that multiple host names can be selected which will in turn auto populate the system owner and then send approvals.

I changed both variables to list collector but once the second host name is entered, it clears out the system owner.

Is this possible?
If not list collector, is there another field type or another recommendation for a solution?

7 REPLIES 7

suvro
Mega Sage
Mega Sage

You should add the values now while adding to the Service Owner field

 

g_form_setValue('service_owner', oldValue+","+NewAdditonalValue );

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

check my blog on how to set list collector dynamically onChange of variable

Enhance it as per your requirement

Dynamically set list collector on change of variable

Since you are sending list collector value which is comma separated sysIds update your query to use IN operator

Something like this; It's just an example

		recGrp.addQuery('user', 'IN' ,requester);

Regards
Ankur

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

@rachelconstantino 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

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