Attachment Remove button hide only for change request table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 04:13 AM
Hi ,
Please let me know how to hide/disable attachment the remove button only change request table ?
No user should not able to delete the attachment
Thanks & Regards,
Shravan Kumar
- Labels:
-
Change Management
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 04:33 AM
Hi shravan
Is this what you are looking for
6 Disabling Attachments on a Table
To prevent attachments from being added to records on a specific table:
- Open a record in the table.
- Right-click in the header bar and select the appropriate option for your version:
- In the list of dictionary entries, select the first record in the list (the record with no Column name entry).
- Add no_attachment to the Attributes field, separated by commas from any existing attributes.
- See Dictionary_Attributes for more information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 04:34 AM
If you just want to make sure that no attachment is deleted (on change request)
Most neat way to do it would be a before delete business rule on sys_attachment table(with condition that it comes from change) and abort transaction in that business rule with a proper message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 05:00 AM
Hi,
Please add a onLoad Client Script for change request table and use below:
function onLoad()
{
var state = g_form.getValue('state');
if(state == '3')// Replace this with your condition if any
g_form.disableAttachments();
}
This will work.
Regards,
Avinash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 05:01 AM
Hi Shravan,
I think you can make changes in attachment UI page to make it work apart from adding a BR as suggested by Anurag,
WIth below solution, I am trying to restrict the call made to activate remove button on checking the attachment box.
Try with below code block in the UI page.
1) search for setRemoveButton in the HTML part of UI page and replace the input tag with the code below. setRemoveButton n
<j:choose>
<j:when test="${jvar_target_table=='change_request'}" >
<input name="sys_id_$[sys_attachment.sys_id]"
id="sys_id_$[sys_attachment.sys_id]" title="${gs.getMessage('Delete attachment')}"
onclick="displayRemoveMsg(this)" type="checkbox" />
</j:when>
<j:otherwise>
<input name="sys_id_$[sys_attachment.sys_id]"
id="sys_id_$[sys_attachment.sys_id]" title="${gs.getMessage('Delete attachment')}"
onclick="setRemoveButton(this);" type="checkbox" />
</j:otherwise>
</j:choose>
2) And then in script part, add this new method displayRemoveMsg added in the code.
function displayRemoveMsg(record){
record.checked=false;
alert("Removing the attachment is not permitted on this table");
}
This will restrict users to remove any attachment from change request table once they have uploaded it.
Thanks
Gaurav