Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Download the xml and goto 

Test script

goto "Retrieved Update Set" and upload the xml. That will install the script helper.

Also make sure you can execute the helper by disabling API authentication, or setup the correct authentication.

Disable it by going to Scripted REST API and uncheck that authentication box.

Test script

Go to Fix script and look for Example - MP Upload.

Make sure to set these things

mpHelper.setHostDetails('incident', hostRecord);

mpHelper.addAttachment( 'file', attachmentId );


it must be named file

Code Block
function doUpload( hostRecord, attachmentId ) {
var mpHelper = new MultipartHelper();

mpHelper.setHostDetails('incident', hostRecord);

//mpHelper.setHostRecord( hostRecord );
mpHelper.addAttachment( 'file', attachmentId );

// this uses the loopback API to create a multipart-formatted payload.

// we create the real rest message, and attach the multipart attachment.
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setEndpoint( '');

restMessage.setHttpMethod( 'POST' );
restMessage.setRequestHeader("File", 'sys_remote_update_set_d5a54f904fb12300402ff9aba310c7c3.xml');
restMessage.setRequestHeader("Multipart", "true");

// getContentType returns the content-type string including the boundary
// e.g. multipart/form-data; boundary="xxxxxxxxxxxx"
restMessage.setRequestHeader('Content-Type', mpHelper.getContentType());

// getBodyId returns the sys_id of the multipart attachment

var restResponse = restMessage.execute();

// Once we have sent the body we can delete the temporary attachment

return restResponse.getBody();

//inc id  and attachment id