User Tools

Site Tools


servicenow_salesforce_attachments

ServiceNow to Salesforce Attachments

Before continuing with this configuration, be sure to follow the steps from the ServiceNow and Salesforce Configuration page.

Table Maps

The SFDC Attachment table is included by default, therefore the table should already be set. Below is what it should look like:

Attachment to SFDC Attachment:

Below are the source script for required fields above

attributes:

answer= {"type":"Attachment"};

body:

var sysEncodedAttachment = new GlideSysAttachment();  
var binData = sysEncodedAttachment.getBytes(current);  
var StringUtil = (typeof GlideStringUtil != 'undefined') ? new GlideStringUtil() : new Packages.com.glide.util.StringUtil();
answer = StringUtil.base64Encode(binData);

@ExternalIdValue:

var gr = new GlideRecord(current.table_name);
gr.addQuery("sys_id", current.table_sys_id);
gr.query();
if (gr.next()){
	answer = String(gr.number);
}

table_sys_id to ParentId:

var gr = new GlideRecord(current.table_name);
gr.addQuery("sys_id", current.table_sys_id);
gr.query();
if (gr.next()){
	answer = String(gr.correlation_id);
}

Dynamic Share

After configuring the dynamic share from the ServiceNow and Salesforce Configuration page, the related list is necessary when sharing attachments. It may be added in the same dynamic share. Follow the images below to properly configure the related list for sharing attachments if it is not shown on the form.

After configuring the PSP Share Table Map table to be visible on dynamic share, proceed to the bottom and select the respective tab. Click the “New” button and add the following table and table map as shown below.

servicenow_salesforce_attachments.txt · Last modified: 2018/04/20 22:26 by paul