Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Hide icon attachment

Diana Yazmin
Tera Contributor

Hello experts,

 

Is there an option to hide the attachment icon depending on the option on the form?

 

DianaYazmin_0-1728514449679.png

Regards

 

 

1 ACCEPTED SOLUTION

Akash4
Kilo Sage

Hi Diana,

You can achieve this via Catalog Client Script. You can apply it onChange, sample script lines are:

function onChange() {
var reqFor = g_form.getValue('requested_for'); //or use newValue based on Field selection in CS
if (reqFor == 'TargetUsersysID') { //edit here
var attachIcon = document.querySelector('sp-attachments'); 
if (attachIcon) {
attachIcon.style.display = 'none';
}
}
}

 

 

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

View solution in original post

2 REPLIES 2

Akash4
Kilo Sage

Hi Diana,

You can achieve this via Catalog Client Script. You can apply it onChange, sample script lines are:

function onChange() {
var reqFor = g_form.getValue('requested_for'); //or use newValue based on Field selection in CS
if (reqFor == 'TargetUsersysID') { //edit here
var attachIcon = document.querySelector('sp-attachments'); 
if (attachIcon) {
attachIcon.style.display = 'none';
}
}
}

 

 

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

SyamPrasanM
Tera Expert

Hi @Diana Yazmin 

Hope this answere is useful to your Question

 

you can hide the attachment icon based on a form option by using UI policies or client scripts.

Using UI Policies

  1. Create a UI Policy:

    • Go to System UI > UI Policies.
    • Click on New to create a new UI policy.
    • Set the conditions for when the attachment icon should be hidden (e.g., based on a specific field's value)
  2. Add UI Policy Actions:

    • In the UI Policy record, go to the UI Policy Actions related list.
    • Click on New.
    • Set the Field Name to Attachments.
    • Set the Action to Set Visible and uncheck the Visible checkbox to hide it.

       

  3. Save the UI Policy.

Using Client Scripts

  1. Create a Client Script:

    • Navigate to System Definition > Client Scripts.
    • Click on New to create a new client script.
    • Set the type to onChange or onLoad, depending on when you want the script to run.
    • Use the following example code to hide the attachment icon:

       

      function onChange(control, oldValue, newValue) {

      if (newValue === 'hideOption') {

      g_form.setDisplay('attachments', false);

      }

      else {

      g_form.setDisplay('attachments', true);

      }

      }

       

  2. Save the Client Script.

Regards,

Mule Syam Prasanna 

PRAVAL-LOGO.png