Versions Compared

Key

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

UI Button
colormagenta
tooltipInformation on this page pertains to the Perspectium Fluorine release
titleFluorine
urlhttps://docdocs.perspectium.com/display/fluorine


The final configuration step on the ServiceNow side for your Freshdesk service integration is to add a script action. Script actions are server-side scripts triggered by events that can modify configuration items in your instance. The script action that you will need to add will create an outbound message for any incident records that have attachment data included, thus ensuring that any attachments you have created in ServiceNow are successfully shared out to your Freshdesk instance.

Prerequisites


(warning) You will first need to create a ServiceNow dynamic share for Freshdesk.

(warning) You will also need to create custom ServiceNow outbound table map fields for Freshdesk and update required ServiceNow transform map field scripts for Freshdesk.

Procedure

To add a script action for attachment.uploaded, follow these steps:

1. Log


UI Steps
UI Step

Log into your ServiceNow instance and navigate to System Policy > Events

>

 > Script Actions or simply type and then

select

select Script Actions

in

 in the Filter Navigator on the upper left-hand side of the screen.

UI Step

Click New to

2. Click New to

create a new script action.

3. In
UI Step

In the resulting Script Action form, type Perspectium Attachment (Freshdesk)

as

 as the Name. Then, select attachment.uploaded

from

 from the Event name

dropdown4. Check the

 dropdown.

UI Step

Check the 

Active box. Then, add the following script in the scripting window:


pspShareUploaded();
function pspShareUploaded() {
var pspRepl = new PerspectiumReplicator();
var pspUtil = new PerspectiumUtil();

var tableName = event.parm1;
var tableSysId = event.parm2;

var tgr = new GlideRecord(tableName);
tgr.addQuery('sys_id', tableSysId);
tgr.queryNoDomain();
if (!tgr.next()) {
return;
}

var op = "attach";

var agr = new GlideRecord(event.table);
agr.get(event.instance);
if (pspUtil.recordHasTag(agr, "freshdesk_sent")) {
return;
}

var qc = new GlideRecord('psp_replicate_conf');
qc.addQuery('table_name', tableName);
qc.addQuery('action_create', true);
qc.addQuery("action_update", true);
qc.addQuery("sync_direction", "share");
qc.addQuery("active", "true");
qc.addQuery("u_target_queue.u_name", "psp.in.siam.client.freshdesk");
qc.query();
while(qc.next()) {
// reset the message set counter each time we do a new share configuration
pspRepl.messageSetCounter = {};

var startedDateTime = gs.nowDateTime();
// share record, setting tag to mark attachments
if (tgr.operation() == "insert" || (tgr.isValidField("correlation_id") && tgr.correlation_id.nil())) {
op = "deferred";
}
// try changing name from update to attach

pspRepl.shareOneRecord(tgr, qc, tableName, op, 'freshdesk_sent');
}
}
5. 
UI Step

Click Submit

to

 to finish creating your script action.


Next steps


Create custom Freshdesk ticket fields


Similar topics


Content by Label
showLabelsfalse
max5
showSpacefalse
sortmodified
cqllabel = "get-startedfreshdesk" and parent = "2753162"space = currentSpace()