strange behaviour by send Message

Hi,

 

I have crm running scripts to Trigger Save requests.

But If I manully send Message from CS Ticket to Customer, it last minutes but not sent yet after many Minutes.

if I reload the Ticket page, 

why?

 

Thanks!

RE: strange behaviour by send Message

It works only that Message will be sent, if i disable all Scripts with Trigger Save Requests.

Von: Jianchun You 12. Feb 2020

RE: strange behaviour by send Message

Hi,

If it works when you disable Trigger script on Ticket save, I would start to debug this script to figure out why this is taking so long.

Von: Michel Krohn-Dale 13. Feb 2020

RE: strange behaviour by send Message

Hi Michel,

 

i have enabled one of scripts to send message to Customer, if he has replied to a closed Ticket. It works to send automatically Message to Customer.

Just now if I reply to Customer as Support under this ticket in cs, then it lasts time to send my manuel message to Customer. If I trace while i reply, it says:

GeneralException: ejScript function getCgiVariable() called without an EJWebApp instance!

 

and it cannot go to next step 24:

 

What does this Exception mean?

 

Thanks!

Von: Jianchun You 13. Feb 2020

RE: strange behaviour by send Message

here is my script:

#setLanguageLevel 3;
Void SendMSG(String ticketId, String to, String cc, String bcc, String subject, String body)
{
Message msg;
msg.setValue("ticketId", ticketId);
Vector vTO;
vTO.parseString(to,",");
Vector vCC;
vCC.parseString(cc,",");
Vector vBCC;
vBCC.parseString(bcc,",");
//msg.addHeader("to", to);
msg.setValue("emailHeader", "Test");
msg.setValue("subject", subject);
//msg.setValue("body", body);
msg.setValue("type", "html");
msg.setValue("bodyHtml", body);
msg.save();
msg.send(vTO, vCC, vBCC, subject, body);
}

String ticketId = getCgiVariable("entryId");
Ticket t;
t.load(ticketId.toInteger());
String subject = t.getValue("title");
NSPersonAgent myPersonAgent;
NSPerson myPerson = myPersonAgent.GetPerson(t.getValue("cust_id").toInteger());
String emailTo = myPerson.GetEmail();
Integer rtId = 47;
ReplyTemplate replyTemplate;
replyTemplate.load(rtId);
String subject2 = replyTemplate.getSubject(0) + " - (MBS Support ID: " + ticketId + ") "+ subject;
String body = replyTemplate.getHtmlBody(0);
String oldStatus = getParserVariable("ticket.old.ticketStatus");
String newStatus = getParserVariable("ticket.new.ticketStatus");
//String oldOwner = getParserVariable("ticket.old.ownedBy");String newOwner = getParserVariable("ticket.new.ownedBy");
if ((oldStatus != "2") && (oldStatus != "7") && (newStatus == "2")) {
SendMSG(ticketId, emailTo, "", "", subject2, body);
}

Von: Jianchun You 13. Feb 2020

RE: strange behaviour by send Message

Hello,

You need to use getVariable to get the ticketId in the 'Saving a request' trigger.

Example:

Integer ticketId = getVariable("ticketId").toInteger();

See https://community.superoffice.com/documentation/SDK/SO.Customer.Service.Support/html/EJScripteventmodel-Savingarequest.htm

 

Von: David Hollegien 13. Feb 2020

RE: strange behaviour by send Message

Hi David,

 

it works now. Thanks!

Von: Jianchun You 13. Feb 2020