Using Glide Query in transform map script to retrieve values and update in target record

Geeta5
Giga Contributor

I have requirement where in transform map script(here Source table: staging table and target table : cmdb_ci) I have to check certain values(application_owner, application name)  from sc_req_item table based on a match of 'alert id' and get values from sc_req_item table and update in target table(cmdb_ci).

I have written below code in Transform map script but I am not able to fetch values from sc_req_item table.The if loop (line  19) is getting executed i.e condition evaluates true, but I am not able to get value of 'Application_owner' , 'application_name'(line 20,21 not returning value). Please suggest how to achieve this.

find_real_file.png

 

1 ACCEPTED SOLUTION

MrMuhammad
Giga Sage

Hi @Geeta

if application_owner and application_name are variables on sc_req_item table then update below lines as.

application_owner = gr_req.variables.application_owner;

application_name= gr_req.variables.application_name;

 

Thanks & Regards,

Sharjeel

Regards,
Muhammad

View solution in original post

14 REPLIES 14

H Sudhanshu,

 

Yes i have correct field name in target.u_application owner it is the field in my target table(cmdb_ci).

Also , here I am not able to fetch the value from sc_req_item table itself at the first place.( 20,21) though the if loop is true.

 

Yes,

Tell me on thing do you have any CI reference there in requested item as you are writing glidequery on ritm table?

If yes which field is that one?

Thanks

Sudhanshu

If these are catalog variables of RITM,

then 

gr_req.variables.variable_name;

Sagar Pagar
Tera Patron

Hello Geeta,

 

Try with logs.

gs.log(gr_req.application_owner);

gs.log(gr_req.application_name);

 

if(gr_req.next()){

application_owner = gr_req.application_owner;

application_name= gr_req.application_name;

}

target.application_owner= application_owner;

target.u_application_name = application_name;

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Hi Sagar,

 

I have applied logs and I am not getting value from sc_req_item table not usre why even if I am inside if loop.

Also, application_owner field is refrence field in both tables. Application_name is string field.