why is an <br> too in my title when i make a ticket from ejscript ?

lock
push_pin
done
Beantwortet
2

Hi, i have a <br> in my title Ticket who appears but i don't write him.

%EJSCRIPT_START%<%
#setLanguageLevel 3;

String personid = getCgiVariable("personid");
String productName = getCgiVariable("productname");
String release = getCgiVariable("release");
String isUpdate = getCgiVariable("isupdate");
String rechnername = getCgiVariable("rechnername");
String windows = getCgiVariable("postDataWindows");

//Erstellt eine neue Ticket im System
Integer catId = 249; // _Intern/Installationsinfo
Integer catIdErstInstallation = 264;
Integer catIdUpdate = 265;
String myTitel = "Installation "+productName+" "+release;
myTitel = myTitel.substitute("<br>","");
myTitel = myTitel.substitute("\r\n","");

//Erstellt eine neue Ticket
Integer myTicketId = 0;
Ticket myTicket;
if(isUpdate.toLower() == "true")
{
  myTicket.setValue("category", catIdUpdate.toString());  
}
else
{
  myTicket.setValue("category", catIdErstInstallation.toString());  
}

myTicket.setValue("title", myTitel);
myTicket.setValue("ticketStatus", "6");
myTicket.setValue("status", "1");
myTicket.setValue("custId", personid);
myTicket.setValue("x_herkunft", "AKG-Desktop");
myTicket.setValue("x_systeminfo", rechnername +"\r\n"+windows);
myTicketId = myTicket.save();

//Hier muss nochmal den TicketStatus geändert sein
Ticket t;
t.load(myTicketId);
t.setValue("ticketStatus", "6");
t.save();

%>%EJSCRIPT_END%

I don't know why this <br> are here. Whenn I debug the code it's no <br> in the string but when i open the ticket the title is Installation Toto<br> 1.00.0161.

What can i do ?

thanks

Fabrice

12. März 2024 | 10:05 AM

Alle Antworten (2)

Hi Fabrice, if you have an extra "
" in your title it must be coming from the cgi variables "productName" or "release". Suggest you look at the values sent to the script.

Also, you should probably change the order of the two lines where you set "status" and "ticketStatus". That could fix the issue you have where you reload the ticket to set ticketStatus again.

14. März 2024 | 09:14 AM

Hi Frode,

thanks for your reply.

I have found with HTMLEncode Function that the "
" here stay.

Why, I don't but i have fixed him.

Thanks

14. März 2024 | 09:16 AM

Antwort hinzufügen