Service Manager / Service Center Practitioners Forum
cancel

Add updates from javascript interaction?

SOLVED
Go to solution
dasarro23
Honored Contributor.

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
2 REPLIES
Highlighted
Kelalek2
Outstanding Contributor.
Solution

Re: Add updates from javascript interaction?

Try 


file.doAction("save");

 

instead of 

 

file.doUpdate();

 

Worked for me...

---
To get good answers, ask good questions.
Vadim Gorda
Acclaimed Contributor.

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)