Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

CMDB CI Display value

dvelloriy
Kilo Sage

Hi All,

I have created a UI action to convert existing incident record to ENHC (enhancement record).

I want to map the value of cmdb_ci field on INC form to Application field on ENHC form.

The problem is we have many to one mapping here. We can have several servers in cmdb_ci field which we have to map with a particular application field on ENHC.

I have written below script but it doesnot seem to work. Please let me know what i am doing wrong here.

if ((current.cmdb_ci.getDisplayValue().indexof('ABC')) || (current.cmdb_ci.getDisplayValue().indexof('DEF')) >-1) {
task.u_application = '58107c254f1e9700faa3ee6d0210c712'; 
}

 

1 ACCEPTED SOLUTION

Archana Reddy2
Tera Guru

Hi,

Two mistakes I saw in your code is:

1. Missing >-1 at first indexof

2. Replace indexof with indexOf. O should be capital.

Hope this helps!

Thanks,

Archana

View solution in original post

9 REPLIES 9

Mike Patel
Tera Sage

you can do something like 

current.cmdb_ci.nameLIKEABC

 

Is there anything wrong with this code? This is written in an UI action and is not working.

if (current.cmdb_ci.nameLIKEALV) {
task.u_application = '58107c254f1e9700faa3ee6d0210c712';
}

dvelloriy
Kilo Sage

This is not working.

Archana Reddy2
Tera Guru

Hi,

Two mistakes I saw in your code is:

1. Missing >-1 at first indexof

2. Replace indexof with indexOf. O should be capital.

Hope this helps!

Thanks,

Archana