Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
HTML
<style>
.release-box {
	height: 30px; 
	width: 100px; 
	padding-top: 8px;
	text-align: center; 
	border-radius: 5px; 
	font-weight: bold; 
	background-color: #d4af37;  
	border-color: #FCE28A;
}

.release-box:hover {
  	cursor: hand;
    cursor: pointer;
    opacity: .9; 
}
</style>
<meta name="robots" content="noindex">

<div class="release-box">
<a href="https://docs.perspectium.com/display/gold" style="text-decoration: none; color: #FFFFFF; display: block;">
Gold
</a>
</div>

ServiceNow 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 a ServiceNow 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 Autotask.


Prerequisites

...

(warning) First, you will need to create a ServiceNow dynamic share for Autotask.

(warning) You will also need to create a ServiceNow subscribed queue and subscribe for Autotask and edit ServiceNow outbound table map fields for Autotask.

(warning) Lastly, you will need to add and edit ServiceNow transform map scripts for Autotask.

Procedure

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

...

UI Steps


UI Step

Create a new script action

Log into your ServiceNow instance and navigate to System Policy > Events > Script Actions or simply type and then select Script Actions in the Filter Navigator on the upper left-hand side of the screen. Then, click New to create a new script action.


UI Step

Add an attachment.uploaded script

In the resulting Script Action form, type Perspectium Attachment (Autotask) as the Name. Then, select attachment.uploaded from the Event name dropdown. Check the Active box. Then, add the script shown below in the scripting window and click Submit in the bottom left-hand corner of the form to save your script action.

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, "autotask_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.meshlet.autotask");
    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, 'autotask_sent'); 
        }
    }

...

Similar topics

Content by Label
showLabelsfalse
max5
showSpacefalse
sortmodified
cqllabel = "autotask" and space = currentSpace()

Contact Perspectium Support

Image Removed

US: 1 888 620 8880

UK: 44 208 068 5953

...