Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

is there any way to get all visible fields and visible variables on the form using a business rule

Alon Grod
Tera Expert


Hi,

I have a task record that being created using a record producer.

Is there any way to get all visible fields and all visible variables on the form using a business rule.
The goal is to make a pdf file and attach it to the record that will contains all visible fields and visible variables and there corresponding values

8 REPLIES 8

OlaN
Tera Sage

Hi,

What's the use of a PDF containing all the visible fields on the form ?
All the data is already there, visible on the form, then why the PDF ?

masonreed11
Tera Contributor

Yes, it’s possible, but a Business Rule can’t directly know the client-side visibility of fields. You can use GlideRecord and dictionary metadata for fields, and access the record producer variables separately.

I’d recommend having the Business Rule call a Script Include that collects the required label/value pairs, generates the PDF, and attaches it with GlideSysAttachment.

masonreed11
Tera Contributor

Yes, but not directly from a Business Rule. A Business Rule can read the record fields and variable values, but the form/UI controls visibility. You’ll need to reproduce the visibility logic server-side or use a suitable PDF/reporting approach to generate the attachment.

Ankur Bawiskar
Tera Patron

@Alon Grod 

what's the business requirement here?

In server side you won't know which variables are visible or not.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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