
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 03:55 PM
Hello experts,
Is there an option to hide the attachment icon depending on the option on the form?
Regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 04:19 PM
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';
}
}
}
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 04:19 PM
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';
}
}
}
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 05:04 AM
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
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)
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.
Save the UI Policy.
Using Client Scripts
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);
}
}
Save the Client Script.
Regards,
Mule Syam Prasanna