Getting attachment id in attachment action client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 07:55 AM
Hi everybody,
I have been struggling with an issue that is driving me crazy. Our customers want attachments to be opened in a new browser tab by default when they are being clicked on in a case / task record in CSM/FSM workspace. By default the document viewer shows up, overlapping the whole screen.
This does not seem to be possible.
Now since Vancouver, there is the option to define attachment actions (All > Workspace Experience > Actions & Components > Attachment Actions).
I have been trying to define an action that can be selected via the attachment context menu that helps agents open the attachment in a new tab:
Creating an action is easy. However, I do not get a hold on the attachment's sys_id in the client script. The predefined script provides nothing but the empty click event listener but no hints on available objects:
function onClick() {
}
If I had the attachment's sys_id I could do something such as
top.window.open("<instance_name>/sys_attachment.do?sys_id=<attachment_sys_id>" target="_blank")
Any ideas?
Thank you very much for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
So, I have similar issue: I want to add additional actions to the attachment menu in the sidebar. I added it in the appropriate place (Attachment Actions). The "Mark as test" action is supposed to change the u_test field, which is in the attachment table, from false to true. I tried implementing this with a server script, and when the button is clicked, the field does indeed change. The problem arises with the conditional display of this button. In the server script, "current" correctly refers to the sys_attachment table, but in the Script Condition, "current" refers to the ticket record (e.g., an incident). I know that at the bottom, in the related list, there are Action Model Fields, including one called "attachmentSysId," which can be used in Client Conditions. I would need a field in these Action Model Fields that stores the value of u_test and, depending on that, hides or shows the specific button—either "Mark as test" or "Unmark as test." I spent a long time searching for where this is configured, but I couldn’t figure out how, for example, "attachmentSysId" is populated with a value. I wanted to do something similar for the u_test field, but I found nothing, even after reviewing most of the records where it might be populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar Do you have any thoughts on this issue