Do anyone have idea on how to use RAD Debugger to correct the javascripts in scriptlibrary. Please provide step by step approach.
Do anyone have idea on how to use RAD Debugger to correct the javascripts in scriptlibrary. Please provide step by step approach.
Thanks Tommy,
I have created a javascript to run a batch process to update all calls in history as below. Any way to know if it will work fine?
function batchUpdatetoCallbackContact()
{
var ret;
var counter = 0;
var incidentFile = new SCFile("incidents");
var rc = incidentFile.doSelect("incident.id=\"" + sInteractionID + "\"");
print("Processing - Please Wait...");
while (rc == RC_SUCCESS)
{
if (incidentFile.callback_contact_fullname == null)
{
counter += 1;
print("Processing Interaction(" + counter + "): " + incidentFile.sInteractionID);
incidents.callback_contact_fullname = system.library.contacts.getOperatorFullName(incide nts.callback_contact);
system.functions.rtecall("trigger", ret, 0);
incidentFile.doUpdate();
system.functions.rtecall("trigger", ret, 1);
}
if (incidentFile.contact_fullname == null)
{
counter += 1;
print("Processing Interaction(" + counter + "): " + incidentFile.sInteractionID);
incidents.contact_fullname = system.library.contacts.getOperatorFullName(incide nts.contact_name);
system.functions.rtecall("trigger", ret, 0);
incidentFile.doUpdate();
system.functions.rtecall("trigger", ret, 1);
}
rc = incidentFile.getNext();
}
print("Batch Process Completed. " + counter + " processed.");
}
I see several issues with this script.
1. sInteractionID is not initialised or set but you use it in the select statement.
2. you start a while look but the select statement you have will only ever return one record (you update counter but it is not used anywhere)
3. you should not use doUpdate() to update a record because it do not lock records or check if records are locked. resulting in potential dataloss. use doAction("save") and check return code.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks