Linker Issue

Hi Expert,

found error in linker log , mostly related with interaction / incidents activity updates.

Please advise!

13877( 14201) 05/10/2016 08:22:35 RAD I Interaction SD101171768 has been updated.
13877( 14201) 05/10/2016 08:22:35 RAD I Audit Record successfully recorded and added.
13877( 14201) 05/10/2016 08:24:35 RTE E CJSDatum::Init - index 1 exceeds ARRAY size of 1
13877( 14201) 05/10/2016 08:24:35 RTE E Invalid index: It is too large (1) (ioevents.process.action,process.action)
13877( 14201) 05/10/2016 08:24:35 RAD E Script 'activityUpdates' line 26: ERROR Invalid property or field '1' for JavaScript class 'Datum' at char 1
13877( 14201) 05/10/2016 08:24:35 RTE E Cannot evaluate expression js("var returnCode = system.library.activityUpdatesInterface.customerVisibleUpdate( vars.$L_file );") (ioevents.process.action,process.action)
13877( 14201) 05/10/2016 08:24:35 RTE E Process panel process.action in RAD ioevents.process.action encountered error in line 1 (ioevents.process.action,process.action)
13877( 14201) 05/10/2016 08:24:35 RAD E Unrecoverable error in application: ioevents.process.action on panel process.action
13877( 14201) 05/10/2016 08:24:35 RAD E Unrecoverable error in application: ioevents.process on panel process.action

  • Any one please any suggestion how to proceed with this issue.
    Thanks in Advance!

  • Hi,

    Please upload the activityUpdates to this post so we can review it.

    Regards,

  • Hi Ssyedzahir,

    We need to check your script but it seems that was past a wrong parameter or different type from expected.

    Could you upload the script here.

    Thanks in advanced.

  • Thanks for checking this request.

    sl :
    activityUpdates

     

    var $=lib.c.$;
    function relatedRecordUpdate(id, filename, relatedFile, activityType, activityText, custVisible) {
    if (id == null)
    return false;

    var relation = new SCFile("screlation");
    var sql;
    var relatedFileAlias = relatedFile;
    var filenameAlias = filename;
    var unique = "number";


    if (relatedFileAlias == "probsummary")
    relatedFileAlias = "problem";

    if (filenameAlias == "probsummary")
    filenameAlias = "problem";

    if (relatedFile == "rootcause" || relatedFile == "knownerror")
    unique = "id";

    if (relatedFile == "incidents" )
    unique = "incident.id";

    //Added in Defect 2816 by SGA

    var sourceTicket = lib.MYActivityUpdates.getTicketNumber(activityText[1]);


    sql = "depend=\"" id "\" and "
    "depend.filename=\"" filenameAlias "\" and "
    "source.filename=\"" relatedFileAlias "\" and "
    "source.active=true"

    if (sourceTicket != null)
    sql = sql " and source~=\"" sourceTicket "\"";
    if ( relation.doSelect( sql ) == RC_SUCCESS )
    {
    do
    {

    var record = new SCFile(relatedFile);
    var record_id = relation.source;
    if ( record.doSelect("" unique "=\"" record_id "\"" ) == RC_SUCCESS )
    {
    system.library.activityUpdatesTailoring.setSpecificFields(record, relatedFile, activityType, custVisible);
    //Added in Defect 2620 by TBI
    if (relatedFile == "incidents" && filename == "ocmq")
    record.cust_visible = true;
    // End
    //Added in Defect 2624 by LKA
    if (relatedFile == "incidents" && filename == "probsummary")
    record.cust_visible = true;
    // End
    updateRecord(record, activityType, activityText, custVisible);

    /// QCRQ1E97738, to send notification HTML email to interaction's contacts, modified by ,
    // deactivated by RMA as it does not suit the SS notification tool
    //if(relatedFile==="incidents" && custVisible===true && filename!="rootcause"){
    // lib.RequestUtil.sendEmailToRelatedIntertion(record, record);
    //}
    /// modified by wangxun

    if (relatedFileAlias == "rootcause" && filenameAlias == "knownerror" && activityType == "Error Closure")
    {
    var screlation = new SCFile("screlation");

    sql = "depend.filename=\"" filenameAlias "\" and "
    "depend.active=true and "
    "source = \"" record_id "\" and "
    "source.filename=\"" relatedFileAlias "\" and "
    "source.active=true"

    if (screlation.doSelect( sql ) == RC_NO_MORE)
    {
    if ( system.library.context.GenerateCount(screlation) == 0 )
    {
    var strCurPhase = "XX";

    while (record.current_phase != strCurPhase)
    {
    strCurPhase = record.current_phase;
    record.doAction("nextphase");
    }
    }
    }
    }
    }
    }
    while (relation.getNext() == RC_SUCCESS);
    }
    //cleanupActivityFields();
    system.vars.$G_bg_activity_type=null;
    system.functions.cleanup(system.vars.$G_bg_activity_text);
    return true;
    }

    function updateFromQuery(filename, query, activityType, activityText, custVisible) {
    custVisible = ((custVisible == true || custVisible == "true") ? true : false);
    var record = new SCFile(filename);
    if (record.doSelect(query) == RC_SUCCESS) {
    system.library.activityUpdatesTailoring.setSpecificFields(record, filename, activityType, custVisible);
    updateRecord(record, activityType, activityText, custVisible);
    }
    }

    function updateRecord(record, activityType, activityText, custVisible) {

    setActivityFields( activityType, activityText );

    //Journal Update
    if (system.functions.filename(record) === "request") {
    lib.RequestUtil.journalAction(record, vars['$G.bg.activity.text']);
    } else if (system.functions.filename(record) === "probsummary") { //do nothing, IM module have done this.
    } else if (system.functions.filename(record) === "cm3r") {
    if (record.update_action == null) {
    record.update_action = [""];
    }

    var len = activityText.length();
    if (len > 0) {
    for (var i = len - 1; i >= 0; i--) {
    record.update_action = system.functions.insert(record.update_action, 1, 1, activityText[i]);
    }
    }
    } else if (system.functions.filename(record) === "rootcause") {
    $("#problemService").journalUpdate(record, vars['$G.bg.activity.text']);
    }

    var bypassAuthcheckOrig=vars.$bypass_bg_authcheck;
    var bypassValidationOrig=vars.$bypass_failed_validation;

    vars.$bypass_bg_authcheck = true;
    vars.$bypass_failed_validation = true;

    vars.$sync_activity=true;
    var result = record.doAction("save");
    vars.$sync_activity=false;
    vars.$bypass_bg_authcheck = bypassAuthcheckOrig;
    vars.$bypass_failed_validation = bypassValidationOrig;

    //var result = record.doAction("save");

    if (result == RC_CANT_HAVE || result == 51 )
    scheduleActivityUpdate(record, activityType, activityText, custVisible);

    }

    function scheduleActivityUpdate(record, type, text, custVisible) {
    var schedule = new SCFile("schedule");
    schedule._class = "linker";


    var time = new Date();
    var sched = new Date(time.getTime() 60*1000);
    schedule.expiration = sched;

    schedule.name = "Interoperability Record - Activity Update";
    schedule.application = "sc.activity.bg.update";

    var dTag = new Datum()
    system.functions.tag(dTag, record);

    schedule.strings[0] = dTag;
    schedule.strings[1] = type;
    schedule.strings[2] = custVisible ? ("" custVisible) : "";
    schedule.strings1 = text;

    if ( schedule.doInsert() == RC_SUCCESS)
    return true;
    return false;

    }


    function initActivityFields()
    {
    vars.$G_bg_activity_type = "External Update";
    vars.$G_bg_activity_text[0] = "External Update";
    }

    function setActivityFields( activityType, activityText)
    {
    if ( activityType != null )
    vars.$G_bg_activity_type = activityType;
    if ( activityText != null )
    vars.$G_bg_activity_text = activityText;
    }

    function readActivityType()
    {
    return vars.$G_bg_activity_type;
    }

    function readActivityAction()
    {
    return vars.$G_bg_activity_text;
    }

    function cleanActivityFields()
    {
    system.functions.cleanup(vars.$G_bg_activity_text);
    system.functions.cleanup(vars.$G_bg_activity_type);
    }

     

     

  • Hi Ssye3dzahir,

    The erro is in the manner you are trying to access the variable "activityText". 

    You should get the type of variable. Probably it is a SM array(SC/SM) and not a JS array, there are little differences between them.

    SM array begin with position 1 and JS array with position 0. The way to access these types of variables are also different.

    According to the book "JavaScript Basics for Service Manager", by Mike Sanders, there are different ways to access each one.

    Following examples:

    JavaScript => var group = aNames[2]

    SC/SM => $group = 3 in $name

    PS: the book recommends convert SC/SM array to JavaScript array before manipulating them.

    For convert the SC/SM array to JavaScript array using: aNames = aNames.toArray();

    The information and examples above are taken from mentioned book