Is there a way to restrict the attachment on ritm to only for requester and assignment group

Appu
Tera Guru

Hello Experts,

 

Is there a way to restrict the attachment on RITM so that it is visible only to the requester and the assignment group

If possible can anybody help with the method or the script.

1 ACCEPTED SOLUTION

Hi,

Steps

1) Elevate your role to security_admin

2) Then create new Table level READ ACL on sys_attachment

3) Advanced checkbox true

4) Condition as table name -> sc_req_item

5) Script below

answer = checkCondition();

function checkCondition(){

	var isRequestedFor = false;
	var ritmSysId = current.table_sys_id;
	var rec = new GlideRecord('sc_req_item');
	rec.get(ritmSysId);

	if(gs.getUserID() == rec.request.requested_for){
		isRequestedFor = true;
	}

	var isMember = gs.getUser().isMemberOf('Group ABC');

	return (isRequestedFor ||isMember) ? true : false;
}

find_real_file.png

Regards
Ankur

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

View solution in original post

9 REPLIES 9

Hi,

Steps

1) Elevate your role to security_admin

2) Then create new Table level READ ACL on sys_attachment

3) Advanced checkbox true

4) Condition as table name -> sc_req_item

5) Script below

answer = checkCondition();

function checkCondition(){

	var isRequestedFor = false;
	var ritmSysId = current.table_sys_id;
	var rec = new GlideRecord('sc_req_item');
	rec.get(ritmSysId);

	if(gs.getUserID() == rec.request.requested_for){
		isRequestedFor = true;
	}

	var isMember = gs.getUser().isMemberOf('Group ABC');

	return (isRequestedFor ||isMember) ? true : false;
}

find_real_file.png

Regards
Ankur

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

@appu 

Hope you are doing good.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

If not, please let us know if you need some more assistance.

Thanks!
Ankur

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

@appu 

Hope you are doing good.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

Thanks!
Ankur

 

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

Hi @Ankur Bawiskar , what i need to modify if this need to visible only requested_for, approval_user and how contain ROLEA.

 

please help me on this

Hi @Ankur Bawiskar , Is this working for you ?

It's not working for me when i replicating the same for me on incident table.