How to add Group Approval tab on a custom application record related list.

Puneet4418
Tera Contributor

Hi,

 

I am working on a custom application and I want to add Group Approval in the related list of the record. I tried to create a new relationship that "Applies to table" my custom table and "Queries from table" is the Group Approval(sysapproval_group).

Post applying this to my custom record, I am getting all RITM approval records under the group approval tabs.

 

Why all RITM approvals records are visible here and please help me to fix this.

5 REPLIES 5

Voona Rohila
Kilo Patron
Kilo Patron

Hi @Puneet4418 

You can add below related list instead of creating relationship.

VoonaRohila_0-1739426914615.png

 

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Ankur Bawiskar
Tera Patron
Tera Patron

@Puneet4418 

then it means you didn't give correct script and query condition.

share the configuration

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,

 

I am using below query:

 

current.addQuery('source_table', parent.getTableName());
    current.addQuery('document_id', parent.sys_id);

@Puneet4418 

try this.

var groupApprovalSysId = '';
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("document_id", parent.sys_id);
gr.addEncodedQuery('groupISNOTEMPTY');
gr.query();
if (gr.next()) {
    groupApprovalSysId = gr.group.sys_id;
}
current.addQuery('sys_id', groupApprovalSysId);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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