We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Can we do GlideRecord or ACL Restriction on the Database View Record?

rahulrockkk
Tera Contributor

Hi Team,

 

Can we do GlideRecord to the Database view records so that i can copy and paste the record to the custom table? Or Can we write ACL restriction to the Database View Records?

 

Please check and provide your inputs.

 

@Ankur Bawiskar - Please provide your inputs for the above mentioned point.

14 REPLIES 14

Not write we want to create a Read ACL on the database view to restrict the risk data based on the entity Risk Champion and Division Director.

 

SohamTipnis
Kilo Sage

Hi @rahulrockkk ,

 

Yes, we can use GlideRecord to database view.

You can refer to this video:

https://www.youtube.com/watch?v=_JY462TmXxU

 

If you find my answer useful, please mark it as Helpful and Correct ‌😊


Regards,
Soham Tipnis
ServiceNow Developer ||  Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10

In this ServiceNow Tutorial, Aaron Elder gives a demo on creating and using a database view in ServiceNow. Create the database view. Role required: admin. Learn more: https://docs.servicenow.com/bundle/paris-platform-administration/page/use/reporting/task/t_CreateADatabaseView.html ...

yashkamde
Kilo Sage

Hello @rahulrockkk ,
Yes It's totally fine to use GlideRecord API on Database views.

There won't be any negative impacts.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0855795 

 

If my response helped mark as helpful and accept the solution.

its_SumitNow
Mega Sage

Yes, you can absolutely perform a `GlideRecord` query against a database view. A database view in ServiceNow is essentially a read-only table, a dynamic join of other tables, that can be queried just like any standard table. You can instantiate `GlideRecord` with the name of the database view as the parameter. Once you have the `GlideRecord` object populated with data from the view, you can iterate through the results and use the retrieved values to populate and insert new records into your target custom table. This is a common and valid integration pattern for data syndication or transformation within the platform.

Regarding your second query, Access Control Lists (ACLs) can indeed be applied to database views. When you create an ACL, you specify the object it applies to, which can be a table or a database view. You can create `read` ACLs on the database view's name (e.g., `u_my_database_view`) to control which roles or conditions permit a user to see the records within that view. The system will evaluate these ACLs at runtime whenever a query is made against the view, enforcing the security constraints you've defined. This allows for granular control over the visibility of the joined data presented by the view, without altering the permissions on the underlying source tables.

 

If my response helped, kindly mark it as helpful & Accept it as Solution 🙂

Regards

Sumit

Technical Consultant

Hi Sumit,

 

Thanks for the response. Whenever am trying to create a new Read ACL on the database view, unable to select my database view in the name column. Please check and provide your inputs.