Use query from query builder in a fix script

JJ20
Kilo Guru

Is there any way to use the query/logic from a query builder script in a fix script?

 

1 ACCEPTED SOLUTION

Hi JJ,

Any follow up questions you have on my response, Else please mark the relevant response as correct and helpful so that this thread can be closed.

 

 

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

View solution in original post

5 REPLIES 5

Sulabh Garg
Mega Sage
Mega Sage

Hi JJ,

You can execute the CMDB query builder queries from fix script, Using the below steps

1) Go to cmdb query builder, select any of the saved queries, Run the query.

2)After query ran, it redirect the user to the "u_cmdb_qb_result" list view as shown below

3)You can copy the query in the filter and run in the fix script, or use SNUTIL extension to copy the gliderecord query and then directly run in the fix script.

Hope it helps!!

 

find_real_file.png

 

Please Mark Correct/helpful, if applicable, Thanks!! 
Regards
Sulabh Garg

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

Sulabh Garg
Mega Sage
Mega Sage

Hi JJ, I hope my response helped you, Do you have any follow up question on my response, If not, then please mark the response as helpful and correct, If applicable.

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

Hi - your answer is very exciting

 

Can you provide me a few more details regarding"3)You can copy the query in the filter and run in the fix script, or use SNUTIL extension to copy the gliderecord query and then directly run in the fix script."?

 

or even an example of a fix script with the cmdb query 'query' would be great.

 

Joanne

 

Below is the example I have used in the Fix script where I have used the Query Sys id in a fix script and its working.

 

var grUCQR = new GlideRecord('u_cmdb_qb_result_3c23bed62840ff99919d031b4a25b0b2855c1bd5');
grUCQR.addEncodedQuery("query=2c330e8f07901510d8effa7f7c1ed0d0");
grUCQR.orderBy('null');
grUCQR.setLimit(50);
grUCQR.query();
while (grUCQR.next()) {
    gs.info('u_business_application_1: ' + grUCQR.getValue('u_business_application_1'));
    gs.info('u_rel_business_application_1_information_object_1.type: ' + grUCQR.getValue('u_rel_business_application_1_information_object_1.type'));
    gs.info('u_information_object_1: ' + grUCQR.getValue('u_information_object_1'));
}

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg