Attachment - make read-only or disable to edit

Brook3
Giga Expert

Hi, how to make attachment to read-only or not-editable?

Table name: sn_hr_core_case_talent_management

 

1 ACCEPTED SOLUTION

Megha Padale
Giga Guru

Hi Brook,

You can achieve this using g_form.disableAttachments() method, like the below code:

if (condition)  

{

g_form.disableAttachments();

}

Check the below links, it might help you:

https://docs.servicenow.com/?title=GlideForm_%28g_form%29#disableAttachments&gsc.tab=0

https://community.servicenow.com/community?id=community_question&sys_id=50d687a5db1cdbc01dcaf3231f96...

If my answer helped you in any way, mark answer as helpful and correct.

Thanks and regards,

Megha.

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So are you saying you want to disable the attachment i.e. hide the paper-clip icon based on some condition

Do you want the attachments itself to be hidden for few users or for some conditions

you can use below code in client script to disable the paper-clip icon; but it would show the existing attachments

g_form.disableAttachments();

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

@Ankur Bawiskar 

Does this g_form.disableAttachments() works on the portal as well when used from catalog client script ?

 

Thanks!

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Brook,

 

1. Please refer Attachment administration

2. You can use enableAttachments()/GlideForm - disableAttachments() method to enable or disable the attachment based on condition via Client Script.

https://developer.servicenow.com/dev.do#!/reference/api/orlando/client/c_GlideFormAPI

 

- Pradeep Sharma

Megha Padale
Giga Guru

Hi Brook,

You can achieve this using g_form.disableAttachments() method, like the below code:

if (condition)  

{

g_form.disableAttachments();

}

Check the below links, it might help you:

https://docs.servicenow.com/?title=GlideForm_%28g_form%29#disableAttachments&gsc.tab=0

https://community.servicenow.com/community?id=community_question&sys_id=50d687a5db1cdbc01dcaf3231f96...

If my answer helped you in any way, mark answer as helpful and correct.

Thanks and regards,

Megha.