The CreatorCon Call for Content is officially open! Get started here.

Function GlideTableDescriptor is not allowed in scoped applications

Community Alums
Not applicable

Hello.

 

I cloned a widget to run under a scoped application and I'm getting this:

How do I fix it? Any suggestion?

Issue: GlideTableDescriptor.get(data.table).getED().hasAttribute("glide.security.ui.filter")
1 ACCEPTED SOLUTION

Oleg
Mega Sage

I suppose you cloned Data Table [widget-data-table] widget. The code

GlideTableDescriptor.get(data.table).getED().hasAttribute("glide.security.ui.filter")

tests whether the table data.table has attribute with the name glide.security.ui.filter. No standart tables has the attribute. So you can just remove the part of code. If you do want to use the code, that you have to rewrite the fragment to get the same information about attributes of the table in alternative way.

I posted in my answer on the question the code of small function isTableAttributeEqualValue. The code shows how one can get attributes of table. You need just modify the last line of the code to use only return gr.next(). The resulting function will looks as following

function isTableHasAttribute (tableName, attributeName) {
	var gr = new GlideRecord("sys_schema_attribute_m2m");
	gr.addQuery("schema.name", tableName); // "Dictionary Entry"."Table"
	gr.addQuery("attribute.name", attributeName); // "Attribute"."Name"
	gr.query();
	return gr.next();
}

Then you can use isTableHasAttribute(data.table, "glide.security.ui.filter") instead of GlideTableDescriptor.get(data.table).getED().hasAttribute("glide.security.ui.filter").

View solution in original post

3 REPLIES 3

Priya Shekar
Giga Guru

Hi Rafael,

Please go through the  below threads, which might be helpful to you.

https://community.servicenow.com/community?id=community_question&sys_id=055b4721db9cdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=07a433e2dbd957003882fb651f96...

If my reply has helped you,Kindly click the Helpful button.
If my reply is the answer you were looking for, Kindly click the Accepted Solution button.

Thanks,
Priya

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Rafael,

please go through below links:

1. https://community.servicenow.com/community?id=community_question&sys_id=07a433e2dbd957003882fb651f9619bc

2. https://community.servicenow.com/community?id=community_question&sys_id=b3a00765db98dbc01dcaf3231f96198e

3. https://community.servicenow.com/community?id=community_question&sys_id=07a433e2dbd957003882fb651f96...

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Oleg
Mega Sage

I suppose you cloned Data Table [widget-data-table] widget. The code

GlideTableDescriptor.get(data.table).getED().hasAttribute("glide.security.ui.filter")

tests whether the table data.table has attribute with the name glide.security.ui.filter. No standart tables has the attribute. So you can just remove the part of code. If you do want to use the code, that you have to rewrite the fragment to get the same information about attributes of the table in alternative way.

I posted in my answer on the question the code of small function isTableAttributeEqualValue. The code shows how one can get attributes of table. You need just modify the last line of the code to use only return gr.next(). The resulting function will looks as following

function isTableHasAttribute (tableName, attributeName) {
	var gr = new GlideRecord("sys_schema_attribute_m2m");
	gr.addQuery("schema.name", tableName); // "Dictionary Entry"."Table"
	gr.addQuery("attribute.name", attributeName); // "Attribute"."Name"
	gr.query();
	return gr.next();
}

Then you can use isTableHasAttribute(data.table, "glide.security.ui.filter") instead of GlideTableDescriptor.get(data.table).getED().hasAttribute("glide.security.ui.filter").