Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Data are empty in database view

Preethi26
Tera Contributor

Hi Team,

I have applied database view to license_role and license_has_family table to get the mapping of application, subscription, role.

But the data in license has family is empty.

Iam keeping application field which is reference from both table as a key to join.

Kindly suggest whats wrong i have did.

8 REPLIES 8

Preethi26
Tera Contributor

I have tried to check in bgscript the name from license_role table returns undefined. Why it happens

var a=new GlideRecord('license_has_family');
a.addQuery('sys_id','0a7bb0201bb131105bfd54ab234bcb85');
a.query();
if(a.next())
{
var b=new GlideRecord('license_role');
b.addQuery('application',a.license_family);
b.query();
gs.print(b.name);
}

You're missing the while / if (b.next()) {}

Preethi26
Tera Contributor

Still it doesnt work Kindly suggest.

kriangkrai
Tera Guru

Hi @Preethi26 

 

The reason you're unable to join the tables because value of Application (application) field in license_role is application display_value while value of Application Entitlement (license_family) is sys_id.

 

You may try adding Application Entitlement [license_family] in the middle to solve this.

 

kriangkrai_0-1709107812186.png

 

Hope this help.

 

Regards,

Oat