Skip to content

Instantly share code, notes, and snippets.

@deangrant
Last active September 13, 2017 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deangrant/99d86f6a45167f021506cd0b75bfde96 to your computer and use it in GitHub Desktop.
Save deangrant/99d86f6a45167f021506cd0b75bfde96 to your computer and use it in GitHub Desktop.
com.deangrant.library.vro/setResourceElementMimeType
// Retrieves the resource element as a mime attachment from the specified input parameter (resourceElement).
var content = resourceElement.getContentAsMimeAttachment();
System.debug('The resource element ' + resourceElement.name + ' has been returned with the mime type ' + content.mimeType)
content.mimeType = mime;
// Sets the mime attachement to the type specifed from the input parameter (mime).
resourceElement.setContentFromMimeAttachment(content);
System.log('The resource element ' + resourceElement.name + ' mime type type has been set to ' + mime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment