HPE Service Manager / Service Center Support and News Forum
Showing results for 
Search instead for 
Do you mean 

Add updates from javascript interaction?

SOLVED
Go to Solution
Valued 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
1 ACCEPTED SOLUTIONS
Highlighted
Honored Contributor

Re: Add updates from javascript interaction?

Try 


file.doAction("save");

 

instead of 

 

file.doUpdate();

 

Worked for me...

2 REPLIES
Highlighted
Honored Contributor

Re: Add updates from javascript interaction?

Try 


file.doAction("save");

 

instead of 

 

file.doUpdate();

 

Worked for me...

Honored Contributor Honored 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)