Skip to content

Instantly share code, notes, and snippets.

@deangrant
Created September 14, 2018 06:24
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/208da83a7269112c2a9bd60e5ed08b3a to your computer and use it in GitHub Desktop.
Save deangrant/208da83a7269112c2a9bd60e5ed08b3a to your computer and use it in GitHub Desktop.
setResourceElementMimeType.js
// 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