Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Creating INC ticket by using the scheduled job

RC10
Tera Contributor

Hi All,

We have implemented the logic to create an INC ticket based on the scheduled job execution. However, for the INC ticket Description field, we need to populate a catalog URL in a user-friendly format.

Currently, the complete catalog URL is displayed in the Description. Instead, we would like to display a clickable text such as “Service Account Password Reset”. When the user clicks on this text, it should open the corresponding catalog item in a new browser window/tab.

Advance thanks...



function createExpiryIncident(svcAcct) {

    gs.info("Entered createExpiryIncident for: " + svcAcct.name);
    var instanceUrl = gs.getProperty('glide.servlet.uri');
    var resetCatalogItem = '6a067b4fdbfba01456456a9ed39619ed';

    var inc = new GlideRecord('incident');
    inc.initialize();
    inc.caller_id = "6816f79cc0a8016401c5a33be04be441";
 var supportGroup = svcAcct.support_group.getRefRecord();

    gs.info("Support Group: " + supportGroup.name);
     inc.assignment_group = svcAcct.support_group;
    inc.cmdb_ci = svcAcct.getUniqueValue();

    inc.short_description =  "ACTION REQUIRED: Service Account Password Expiring - "svcAcct.name;


   inc.description = "The password for Service Account " + svcAcct.name + " is set to expire on " + svcAcct.u_password_exception_granted.getDisplayValue() + ".\n\n" + "Please submit a Service Account Password Reset:\n" + instanceUrl + "sp?id=sc_cat_item&sys_id=" + resetCatalogItem + "\n\n" + "If you are no longer using this account please disable your account here." + "\n\n" + "If you believe you received this service account password expiration in error please click here.";

    var incidentSysId = inc.insert();

    gs.info("Incident Sys Id = " + incidentSysId);

    if (!incidentSysId) {
        gs.error("Incident creation failed");
        gs.error("Last Error: " + inc.getLastErrorMessage());
    }

    return incidentSysId;
}
0 REPLIES 0