Own fields in customer portal, not included in post.

Hi,

I have a problem where i have added my own element to customer portal (7.5).

The reason to this field is i want it to be higher up on the page (not where the extra fields are posted)

(This is added to newTicket).

%EJSCRIPT_START%
<%
print("<label>Phone no</label>");
print("<input type='text' name='ticket_x_phonenumber' id ='ticket_x_phonenumber' value='"+getCgiVariable("ticket_x_phonenumber")+"' size='50' maxlength='255' onChange='inputChanged=true;;' autocomplete='off'>");
%>
%EJSCRIPT_END%

I then want this to be included in the post and the value being put in an extra field (which is not external) in CS.

If i put the field to external it looks exactly the same, the only change is the "Value" which i tried both blank and with getCgiVariable, but it never seem to stick and the value never gets posted to the new ticket.

(When i get this to work i have other fields as well that needs to be posted in the same manner, for example a date field which doesn't show in customer portal for some reason...).

Any ideas?

RE: Own fields in customer portal, not included in post.

I guess a solution would be to replace the submit button with my own and point towards my own post event, in there make an ejScript to create the ticket directly. But I would prefer not to do that.

Av: Rikard Fredlund 21. jun 2018

RE: Own fields in customer portal, not included in post.

In the ticketPosted.html you can do something like this:

%EJSCRIPT_START%

<%

String ticketId = getVariable("ticketId");

if(ticketId.toInteger() > 0)
{
  Ticket t;
  t.load(ticketId.toInteger());
  t.setValue("x_phonenumber", getCgiVariable("ticket_x_phonenumber"));
  t.save();
}

%>
%EJSCRIPT_END%

 

Av: Simen Mostuen Iversen 21. jun 2018

RE: Own fields in customer portal, not included in post.

Hi,

Unfortunatley:

This doesn't give me the ticketId (empty when printing), so can't set values to the ticket:

String ticketId = getVariable("ticketId");

But i get the phone number from:

getCgiVariable("ticket_x_phonenumber") (gives me value when printed).

Av: Rikard Fredlund 21. jun 2018

RE: Own fields in customer portal, not included in post.

Sorry, use this instead:

 

getParserVariable("ticket.id");

 

%EJSCRIPT_START%
 
<%
 
String ticketId = getParserVariable("ticket.id");
 
if(ticketId.toInteger() > 0)
{
  Ticket t;
  t.load(ticketId.toInteger());
  t.setValue("x_phonenumber", getCgiVariable("ticket_x_phonenumber"));
  t.save();
}
 
%>
%EJSCRIPT_END%
Av: Simen Mostuen Iversen 22. jun 2018

RE: Own fields in customer portal, not included in post.

Hi,

Works at least in 8.1. Don't have access to the real 7.5 environment till friday, but guessing it will work. And from there I can fix all the other issues.

Cheers Simen.

Av: Rikard Fredlund 25. jun 2018

RE: Own fields in customer portal, not included in post.

Glad it worked Rikard.

There're no changes in the customer centre from 7.5 to 8.1 (as far as I know), so it should work in both versions.

Also, that being said, there might be an easier way to do this as well, if Sverre or Stian could chime in and give their 2 cents.

Av: Simen Mostuen Iversen 25. jun 2018

RE: Own fields in customer portal, not included in post.

Hi,

My first thought is to drop the %ROWSTART%-loop we have in the standard template over the extra fields, and rather print them yourself. I believe the field needs to be external for us to include it when saving.

I got this working by just adding a field like this:

<label>VAT</label>
<input type='text' name='ticket_x_vat' value=''>

But unfortunately, the value-part is not working because we are printing out the whole input-tag as our parser variable, not just the posted value. This means that if the user enters something in this field, leaves the subject empty, clicks Ok and gets the form in return, the field is empty.

I did find the value in a parser variable called "AuthProgramAll" though (as an URL-encoded parameter). Perhaps you could use a small bit of javascript to parse it and extract it from there. We should really offer you the value as a Parser-variable, but since you are working on 7.5 it would not help.

I believe Simen is correct in that there aren't any changes in the customer centre since 7.5.

Sverre

Av: Sverre Hjelm 25. jun 2018

RE: Own fields in customer portal, not included in post.

Works like a charm in 7.5 too.

Now i just have to add the save event to all my added fields. Cheers.

Av: Rikard Fredlund 29. jun 2018