We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

How to make "Manage Attachment" Form button read-only only when "State" = "Approving" or "Pending"?

Aki17
Kilo Guru

I would like to make "Manage Attachment" Form button of OOTB table read-only only when "State" = "Approving" or "Pending".

I think it's not manageable by UI Policy, so could someone please advise on how to achieve this?

Best Regards,

Aki

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron

Hello

Use 

g_form.disableAttachments()

g_form.enableAttachments()

Write a onload client script that if state is approving or pending

g_form.disableAttachments()

Else

g_form.enableAttachments()

 

Please mark answer correct/helpful based on impact 

 

Thanks

 

Thanks

View solution in original post

4 REPLIES 4

Saurav11
Kilo Patron

Hello

Use 

g_form.disableAttachments()

g_form.enableAttachments()

Write a onload client script that if state is approving or pending

g_form.disableAttachments()

Else

g_form.enableAttachments()

 

Please mark answer correct/helpful based on impact 

 

Thanks

 

Thanks

Hi Saurav,

Thank you for your reply.

> g_form.disableAttachments()

I think it makes the UI button disappeared. What I would like to do is to make it just "read-only".

*Users can view the attachment files, but cannot delete/add.

Would it be possible?

Hello,

The above code will just hide the paperclip so that User cannot add new attachment but they can view/download existing attachment. Please see screenshot below:-

Form with out the code:-

find_real_file.png

 

 

find_real_file.png

 

Form with the code:-

find_real_file.png

 

 

find_real_file.png

 

Please mark answer correct/helpful based on impact.

Ankur Bawiskar
Tera Patron

Hi,

can you share screenshot for better understanding?

Regards
Ankur

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