How can I hide the [Update] and [Delete] on a Picture field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2024 05:52 PM
I have a requirement to display the picture of the Model ID on a CI form, but hide the "Click to add...", [Update] and [Delete] buttons/links on the field so that the picture can only be updated on the Model ID record directly.
The field has been added to the CI form and set to read only, but the users get confused because the field links to add, update, and delete are still shown and they want those hidden. I looked at various posts here as well as some similar scripts, but when using an onLoad client script those options are not hidden.
I've tried the following, but with no luck:
function onLoad() {
document.getElementById("cmdb_ci.model_id.picture.editLink").style.display = false;
}
function onLoad() {
document.getElementById("edit.cmdb_ci.model_id.picture").style.display = "none";
}
function onLoad() {
$('cmdb_ci.model_id.picture.editLink').hide();
}
function onLoad() {
$('edit.cmdb_ci.model_id.picture').hide();
}
In the browser console the element id shows as edit.cmdb_ci.model_id.picture for [Update] and [Delete], while cmdb_ci.model_id.picture_click_to_add is for the "Click to add..." link. I've tried all the various versions of the element that I can think of with no luck as well.
Has anyone done something similar successfully that they might be willing to share?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2024 11:08 PM
Hello,
Please check below discussions, they might be able to help you.
https://servicenow.com/community/developer-forum/hide-update-and-delete-buttons/m-p/2205943
If my answer helped you in any way please mark it as correct or helpful.