Auto populate Configuration item field based on Service offering field on incident form

Lion Kesler
Tera Contributor

Hi,

I wont to Auto populate Configuration item field based on Service offering field on incident form

for example

if selected Service offering - SAP-A  ---> show me in Configuration item field  SAP-A-1 and SAP-A-2

 

LionKesler_0-1696544053286.png

3 REPLIES 3

AnveshKumar M
Tera Sage
Tera Sage

Hi @Lion Kesler 

For this you can use an advanced reference qualifier, where you need to call a Client Callable ScriptInclude which takes in Service Offering value and returns the sys_ids of CI' which are children of the selected offering.

 

For example you have created a script include with the name CustomCIRefUtils and the method for returning the Child CIs is getChildren which accepts a parameter, i.e. Service Offering and queries the cmdb_rel_ci for all it's children and children of children and returns the sys_ids as a comma seperated string. Your reference qualifier looks like this,

 

javascript: "sys_idIN" + new CustomCIRefUtils(). getChildren(current.service_offering);

 

replace : in the above line to :

 

Please mark my answer helpful and accept as solution if it helped you 👍

Thanks,
Anvesh

Harish KM
Kilo Patron
Kilo Patron

Hi @Lion Kesler 

The CI field on incident table comes from Task table. So you need to do dictionary Override and CI field is dependent on Company field in task table. you need to change this dependent to Service Offering field. Refer below screenshot to do the change.

HarishKM_0-1696563300372.png

Your reference qualifier will be like below

javascript:new getDate().getCis(current.service_offering); // new ScriptIncludeName().functionName(current.service_offering);

 

then create a script include

Script:

    getCis: function(so) {    
        var getCiArr = [];
        if (so) {
            var gr = new GlideRecord('cmdb_rel_ci');
            gr.addQuery('parent', so);
            gr.query();
            while (gr.next()) {
                getCiArr.push(gr.child.sys_id);
            }
                return "sys_idIN" + getCiArr.join(',');
        }

    },
Regards
Harish

Hi @Harish KM  , 
I tried implementing your script Include and reference qualifier condition. But when I am adding your reference qualifier solution. It is not getting updated into the Configure dictionary table.
Could you please guide me on this?