GlideSysAttachment write of GlideSysAttachment getContent have different result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2016 07:34 AM
I am using restMessage to fetch image and attach it to records image type field in scoped app.
At start i just used rest saveResponseBodyAsAttachment method but that doesn't let me insert the attachment with just 'image' as it's name in case that instance has whitelist of allowed extensions filled and not blank.
So i wanted to save the attachment as 'image.jpeg' and then use
GlideSysAttachment.write(current, 'image', 'image/jpeg', GlideSysAttachment.getContent(gr)); // where gr is the original attachment
unfortunately these 2 attachments ends up to be completely different attachment.getContent gives me result as if I try to GlideSysAttachment.write restResponse.getBody() as the content.
I ran out of options how to do this beside of clearing the whitelist of extensions or allowing my scoped app write access to sys_attachment table and just using update and neither of these solutions are going to work for me.
Thanks for help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2020 03:02 PM
You can't call GlideSysAttachement.getContent() statically or you'll get:
InternalError: Java class "com.glide.ui.SysAttachment" has no public instance field or method named "getContent".
I
II realize that this thread is cold, but just posting as a PSA for anyone searching the community.