Re: Add updates from javascript interaction? (126 Views)
Reply
Valued Contributor
dasarro23
Posts: 135
Registered: ‎10-28-2011
Message 1 of 3 (163 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
Please use plain text.
Respected Contributor
Kelalek2
Posts: 180
Registered: ‎08-05-2011
Message 2 of 3 (126 Views)

Re: Add updates from javascript interaction?

Try 


file.doAction("save");

 

instead of 

 

file.doUpdate();

 

Worked for me...

Please use plain text.
Honored Contributor
Vadim Gorda
Posts: 5,626
Registered: ‎11-10-2008
Message 3 of 3 (123 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)

Please use plain text.
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