Re: Add updates from javascript interaction? (271 Views)
Reply
Valued Contributor
Posts: 135
Registered: ‎10-28-2011
Message 1 of 3 (308 Views)
Accepted Solution

Add updates from javascript interaction?

Hello,

I'm trying to create a scipt to add updates to an interaction in the $ update.action field and send a notification.

This is the script:

function updateSDRelated(incident){

    var file = new SCFile("incidents");
    var rc = file.doSelect("incident.id=\"" + incident + "\"");
    if (rc != RC_SUCCESS) {
        print("Not files");
        return;
    }
     else {
         while(rc == RC_SUCCESS){
         print("Updated");
         vars.$update_action = ["TEST"];
         file.doUpdate();
         rc=file.getNext();
         }
        return;
    }
}

 


But it adds nothing, can you help?

 

Thans!!

HP 9.30 Patch 5
Highlighted
Esteemed Contributor
Posts: 223
Registered: ‎08-05-2011
Message 2 of 3 (271 Views)

Re: Add updates from javascript interaction?

Try 


file.doAction("save");

 

instead of 

 

file.doUpdate();

 

Worked for me...

Honored Contributor
Posts: 5,899
Registered: ‎11-10-2008
Message 3 of 3 (268 Views)

Re: Add updates from javascript interaction?

Hello,
doUpdate  is not calling save action so the data you are trying to input remains in the variable and is not passed to the object.

You can either use other doAction, or write information directly to actions and not variable.

 

I would have used doAction("save") to avoid popping message the record has been modifyed since read (can be achieved via ioactions)

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.