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

Harsh Vardhan
Giga Patron

can you add the log before the line number 18.

check the row count 

 

gs.log('Row Count is '+ gr_req.getRowCount())

 

Note: if you are on scoped app use gs.info()

Thanks Harshvardhan, Yes I changed  the encodedquery to addQuery and then it returned rowCount as 1. Now it worked by also adding 'variables' while fetching the value. 

glad it has solved.

 

Kindly mark @muhammad solution as correct because he caught the exact issue. i just guided you to add logs so you can do some further troubleshoot, you can mark other user solution as helpful here, everyone has contributed well. 

 

 

Sudhanshu Talw1
Tera Guru

Just run the code 11 to 22 in the fix script & put some logs to check whether you are able to fetch the record.

 Also target.field name should be the table field name rather then what I am looking it seems the column of source.Check this oiut as well.

Thanks

Sudhanshu