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.

How to Access form section field of record using business rule

Rohith2
Tera Contributor

How to Access form section field of record using business rule

8 REPLIES 8

Show what have you written

and show the form(the record)

and the related record form section is referencing to

 

-Anurag

Rohith2_0-1695820566867.png

Need to Glide company from general form section.

Thank you

The reference field is Company , no significance of the section t all

 

(function executeRule(current, previous /*null when async*/ ) {
var fc= new GlideRecord('core_company'); // this is the table yoru form section field points to
fc.addQuery('sys_id', current.<company field name>);  //add the right field name
fc.query();
if (fc.next()) {
//Do whatever
 }
})(current, previous);

 

-Anurag

RAMANA MURTHY G
Mega Sage

Hello @Rohith2 ,

I tried with background script, you can modify as Business rule according to your requirement, Please find code below

 

var gr = new GlideRecord('sys_ui_element');
gr.addQuery('sys_ui_section.name','incident');     // name should be table name
gr.addQuery('sys_ui_section.caption','Related Records');      // caption should be Section name which you want to access
gr.query();

while(gr.next()){
    gs.print(gr.element);
}

 

 

we have two OOB tables which are sys_ui_element, and sys_ui_sectionThese tables store elements, sections, and views of the forms. If u observe those tables, you will get some idea about your requirement

 

Please mark my answer helpful and correct, if it helps you

Thank you

 

 

Please mark my answer helpful  & correct if it helps you
Thank you

G Ramana Murthy
ServiceNow Developer