PDFGenerationAPI: How to place attachment ONLY in a file_attachment field instead of header
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 10:56 AM
I'm using the PDFGenerationAPI in a UI Action to generate a PDF and attach it to a specific document and, as expected by default, it's visible the form header.
I also have a 'file attachment' field, however, and this is where I actually want it to appear (and only there).
Anyone know of a way to only show the attachment in the file attachment field and not also in the form header?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 11:56 AM
Yeah, I'd prefer no DOM manipulation. ServiceNow is doing it within the platform somehow, but I don't understand exactly how, or I'd replicate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 03:50 PM
So, I got a closer, but almost feel further away now.
As mentioned before, in the global scope I'm able to use the code above to create a PDF and attach it to a record (e.g on the Incident table). I'm then able to get the sys_id of the newly created attachment and put it in my file attachment field.
If I then prepend the sys_attachment record's table_name field with ZZ_YY (e.g. change it from incident to ZZ_YYincident), the attachment will no longer appear in the header of the form, but remains visible in the file attachment field. This is exactly what I want to happen.
The problem now is that I don't see a way to do the same in a custom scoped app (the sys_attachment table's cross-scope access policy prevents it and I don't think the customer would be willing to change it).
Still searching for a solution and open to ideas. 😕