Announcement

Collapse
No announcement yet.

Trying to run screlate conditionally

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to run screlate conditionally

    we have a new request. Interactions are opened by external customers via a Connect-It integration. We've been asked, when a ticket comes in through this integration with a specific problem type, can we automatically escalate it to an Incident (they get dozens per day, and dont want to manually escalate)

    At first, I thought it would be an easy After-Add trigger, to call the rad app. But it looks like you cant make an Application call using trigger with a condition. So, I thought I'd write a quick javascript in the trigger.

    I tried calling screlate, but I'm getting an RIO panel error related to the trigger (pasted entire message below). I thought that maybe I cant do this in the trigger itself, so I used the trigger to call a javascript. I'm getting the same error. Here is what I have:

    Trigger
    Code:
    if (record.problem_type = "auto validation testing"){ 
        print("Calling the MyScripts script, autoEscalateValidation function, passing the record");
        system.library.MyScripts.autoEscalateValidation(record);
    }
    ScriptLibrary
    Code:
    function autoEscalateValidation (sdTicket){
    
    
        var rc = "done";
        
        if (sdTicket.problem_type = "auto validation testing")
        {
            var rteRC = new SCDatum();
            var argNames = new SCDatum();
            var argVals = new SCDatum();
        
            argNames.push("name");
            argNames.push("query"); 
            argNames.push("prompt");
            argNames.push("text");
        
            argVals.push("incidents");
            argVals.push(sdTicket.incident_id);
            argVals.push("opendep");
            argVals.push("probsummary");
            
            
            print("name: " + argNames);
            print("values:" + argVals);
        
            rc = system.functions.rtecall("callrad", 
                             rteRC, 
                             "screlate", //RAD app name
                             argNames, 
                             argVals,
                             false); 
                                               
            print("Auto Escalation of validation testing ticket Complete");
        }
        
        return;
    }
    I tried putting the whole thing in the trigger, and like above, calling the script library from the trigger. Either way, I'm getting:

    Code:
    Error attempting to execute an RIO panel from a database trigger application (display,show.rio)Value of Customer Visible flag: true
    Operator for activity record is: xxxxxxxx
    Auto Escalation of validation testing ticket Complete
    Error exit during relation processing for primary file incidents, destination file=probsummary, and unique=SDDEV10356123
    sc relation error: Application error occured.
    Unrecoverable error in application:  se.view.engine on panel display.go
    Display application error exit during RIO on screen apm.edit.problem
    values:[C++ object SCDatum] - {"incidents", "SDDEV10356123", "opendep", "probsummary"}
    name: [C++ object SCDatum] - {"name", "query", "prompt", "text"}
    Calling the QuestScripts file, autoEscalateValidation function, passing the record
    Script Library record updated.
    I also tried calling it from the master FC, but got an error the the SD didnt exist in the "query" parameter.

    My other thought was to somehow call the Process that's used behind the "Escalate" button (escalate.interaction) in a script or trigger, but I dont know how to call a process in javascript.

    Any suggestions?
    Last edited by BethQ; 2016-03-08, 23:05.

  • #2
    I don't have access to a SM system right away, but you can try to use a record.doAction("action") ?
    action is then the name of the command of the "Escalate" displayoption.
    Kind regards,
    fid509
    https://boincstats.com/signature/-1/user/38933/sig.png

    Comment


    • #3
      Thanks for the input!

      So, I've tried writing a new trigger that just does the following:
      Code:
      if (record.problem_type = "auto validation testing"){ 
          print("Auto-escalating SD using the doAction function.");
          
          var rc = record.doAction("escalate");
          
          print("Return Code: " + rc);
      }
      When I put this in an After-Add trigger, I get a successfull SD transaction, and it runs the trigger (print statements). But the IM isnt opened, and I gat the line at the top:
      This record has changed since you selected it.
      Value of Customer Visible flag: true
      Operator for activity record is: xxxxxxxx
      Return Code: false
      Auto-escalating SD using the doAction function.


      When I change it to a Before-Add trigger, I get pretty much the same error as before:
      Unrecoverable error in application: se.call.process on panel call.rad.1Unrecoverable error in application: wizard.run on panel display.1
      Display application error exit during RIO on screen wizard.display
      Error attempting to execute an RIO panel from a database trigger application (display,show.rio)
      Unrecoverable error in application: se.call.process on panel call.rad.1
      Unrecoverable error in application: wizard.run on panel display.1
      Display application error exit during RIO on screen wizard.display
      Error attempting to execute an RIO panel from a database trigger application (display,show.rio)
      Value of Customer Visible flag: true
      Operator for activity record is: xxxxxxxxxxxxxx
      Return Code: true
      Auto-escalating SD using the doAction function.
      It seems that screlate doesnt like running in a script/trigger or something. Is there some way around this?

      I tried doing the script in FC java, but got errors that the SD number didnt exist (it queries the incidents table first, and I guess the ticket wasnt saved yet?).

      What else can I try?

      Thanks again for any and all help!

      Comment


      • #4
        I thought I had found an answer. I thought it was as simple as just putting in a subroutine (instead of triggers or scripts). It sort of worked when manually entering a ticket, but it would take me to the IM and want me to hit save. I decide to test this through a connect-it ticket. Doing that, the SD opened, but I recieved the follwoing in the Response message in the log file specific to connect-it:
        <CreateInteractionResponse message="scxmlapi(19) - Doc Engine call failed with cc -1" returnCode="19" schema
        RevisionDate="2016-01-22" schemaRevisionLevel="0" status="FAILURE" xmlns="http://schemas.hp.com/SM/7" xmlns:cmn="http://schemas.hp.c
        om/SM/7/Common" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w
        3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.hp.com/SM/7 http://qhud502a:9201/SM/7/Interaction.xsd"
        I went back to trying the doAction("escalate") in the after-add trigger, opening via connect-it, and I got the following (same if I made it a before-add):
        CallRAD returned 0 for docEngine invocation
        ****** finished running after add escalate trigger! //this is a log message in my trigger
        se.external.action returned 51 in parameter one
        The log then moves on to the next trigger (todo).

        I tried going back to the after-add trigger, that does the callrad screlate, and I get the following in the main sm.log file:
        RAD E Display application error exit during RIO on screen apm.edit.problem
        RAD E sc relation error: Application error occured.
        RAD W Error exit during relation processing for primary file incidents, destination file=probsu
        mmary, and unique=SDDEV10356180
        This error in the sm.log file came 2 minutes after the transaction in the connect-it log. The connect-it log shows no errors.

        This doesnt seem like it should be this difficult. The customer receives between 40 and 50 of these tickets every day, and we really want to automate the escalation. Any thoughts or help would be greatly appreciated.
        Last edited by BethQ; 2016-03-12, 20:27.

        Comment


        • #5
          Maybe it is time to try another approach to the problem?

          On save in Formatcontrol or a trigger after adding the interaction, you could create a pmo eventin record containing the interaction id (via a modified eventmapping). This would then create an incident with the interaction id contained inside this new incident. With another trigger on the probsummary table you could then set the relation between the 2 through some JS code creating the record in screlation?
          Kind regards,
          fid509
          https://boincstats.com/signature/-1/user/38933/sig.png

          Comment

          Working...
          X