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

Hi,

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';
}

When I tried on my PDI background script, I worked when modified as below.

Give it a try and let me know the result.

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

 

Objects should not be kept in quotations but it worked this way. Not sure why and how.

Thanks

Thanks. Even below worked. 

if (current.cmdb_ci.name.indexOf('ALV') >-1) {

task.u_application = '58107c254f1e9700faa3ee6d0210c712'; // ALV/ULV
}

This is something I was very sure about. Did the second approach work as well? Have you tried with that?

No, i did not try that. Will let you know if something like that comes up in future.