Needed to See RITM Approvals details in SCTASK

HarshithK
Tera Contributor

Hi Team,

 

Am thinking to bring or to see the details - approvals of RITM in SCTASK in one of our workflow so our organization Engineers will get easy navigations to see details of approvals in SCTASK itself. Lets us know how we can achieve this by creating a new related lists or other options.

 

Regards,

Har**bleep**h K.

5 REPLIES 5

Deepak Shaerma
Kilo Sage

Hi @HarshithK 

You can do it by creating one custom list type field referencing to user table on sc_task table and push the approvals in this field using Business Rule.

Sample Script:

var stbl = current.sysapproval.sys_class_name;
	var grAprvl = new GlideRecord(stbl);
	grAprvl.addQuery('sys_id', current.sysapproval);
	grAprvl.query();
	if(grAprvl.next()){
		if(grAprvl.u_approvers.nil()){
			grAprvl.u_approvers = current.approver;
		}
		else if(grAprvl.u_approvers.indexOf(current.approver) == -1){
			grAprvl.u_approvers += "," +current.approver;
		}
		//con
		if(current.u_approval_consultants!=""){
			if(current.u_approval_consultants.includes(",")){
				var con=current.u_approval_consultants.split(',');
				for(var i=0;i<con.length;i++){
					if(!grAprvl.u_approvers.includes(con[i])){
						grAprvl.u_approvers += "," +con[i];
					}
				}
			}else{
				grAprvl.u_approvers += ","+current.u_approval_consultants;
			}
		}//con
		//grAprvl.u_approvers="";
		grAprvl.update();
	}

here u_approvers is the custom field

If my response helped please mark it correct/helpful
Regards

Deepak Sharma

Ankur Bawiskar
Tera Patron
Tera Patron

@HarshithK 

you can use defined relationship on sc_task and bring approval records

I shared solution for this some years ago, it has all the details

How to get approvers name on SCT task and also Short and Detailed description on REQ. 

sharing here again

Steps on how to show Approvers related list on SC Task form

1) Left nav type relationships

2) Create new

3) Give some name

4) Applies to Table - sc_task

5) Queries from Table - sysapproval_approver

5) then use this script

(function refineQuery(current, parent) {

    // Add your code here, such as current.addQuery(field, value);
    
    current.addQuery('sysapproval', parent.request_item);

})(current, parent);

6) then save

7) now go on Catatog Task form

 Configure related lists

9) search this and add and save

AnkurBawiskar_1-1754976772711.png

 

AnkurBawiskar_2-1754976772723.png

 

AnkurBawiskar_3-1754976772703.png

 

AnkurBawiskar_4-1754976772628.png

 

Output:

RITM Approval:

AnkurBawiskar_5-1754976772622.png

 

Catalog Task Approval: Showing the same details on SC Task Form

AnkurBawiskar_6-1754976772637.png

 

 

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

@HarshithK 

Would you mind marking my response as correct as my solution worked for you?

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

HarshithK
Tera Contributor

Thanks Ankur 

The above script and steps worked and Thanks for your responses.

Regards,

Har**bleep**h K