- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 11:06 AM
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';
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 12:23 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 12:25 PM
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';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 12:42 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 01:29 PM
Thanks. Even below worked.
if (current.cmdb_ci.name.indexOf('ALV') >-1) {
task.u_application = '58107c254f1e9700faa3ee6d0210c712'; // ALV/ULV
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 01:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 02:24 PM
No, i did not try that. Will let you know if something like that comes up in future.