Custom Customer Form

Moderator: crythias

Locked
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Custom Customer Form

Post by stonkers »

I need a little direction (pointer to documentation or whatever). I've been looking through the Admin Guide and I see how to set up custom fields on the customer creation form, but I don't see the ability to divert from purely freeform text being submitted for tickets. Is it possible to change the interface that a customer uses for sending tickets so that we can gather a minimum amount of required information? Informaiton like: priority, OS, login type (vpn or on site)... Thanks in advance!
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Custom Customer Form

Post by crythias »

sure. You can either enable free text or use your own webform (such as via jotform) that submits tickets with the data you require.

Built-in: TicketFree Text
Alternate 1: http://wiki.otrs.org/index.php?title=Cr ... _API_calls
Alternate 2: http://forums.otrs.org/viewtopic.php?f=60&t=8032
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

I like #2 very much, Thanks!!!
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, well I tried this, but am having issues. I've created a theme and am getting into the theme (in CustomerTicketMessage.dtl). I've put an alert in there to say I'm in there. First of all, I don't have a line:

Core.Customer.InitFocus();

In my CustomerTicketMessage.dtl (I'm on version 2.4, maybe it's different there).

So I tried just placing the code at the top. If I put the Core.Customer.InitFocus in there, I get to an alert before that, but not after that. So I pulled it. Then if I put the switch / case in there, it doesn't make it into it. I played a bit and it seems to choke trying to get to the variable $('#Dest').val(). Can you help me out a bit here?

Thanks,
Eric
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Custom Customer Form

Post by crythias »

I would strongly recommend being at 3.0 but you can play with the referenced 2.4 link... http://forums.otrs.org/viewtopic.php?f=62&t=5157#p23375
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, digging in to upgrade (Rolls Sleeves Up). I'll try this again once I'm all up in 3.0 and all... Thanks again!
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

WOW! You peeps have your act together. That was one smooth upgrade (http://doc.otrs.org/3.0/en/html/x907.html). Thanks! Now on to the custom code...
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, having a few issues:

1) When I log in to the customer web interface, I get an error: Cannot read property 'style' of null with some references to som javascript files
>I tried to fix this by changing the charset (#14 in install doc), but that doesn't fix it
2) When trying to run step 14 in the install doc:

I have:

Code: Select all

$Self->{'Frontend::Themes'} = {
  'LMCO' => '1',
  'Lite' => '1',
  'Standard' => '1'
};
So I try to fix it by going to SysConfig / Core::Web / Frontend::Themes and pushing the reset arrow, but that says: Can't write ConfigItem!

ackend ERROR: OTRS-CGI-10 Perl: 5.8.8 OS: linux Time: Fri Mar 18 14:11:14 2011

Message: Can't write ConfigItem!
Traceback (16448):
Module: Kernel::Modules::AdminSysConfig::Run (v1.112) Line: 174
Module: Kernel::System::Web::InterfaceAgent::Run (v1.58.2.1) Line: 853
Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler (unknown version) Line: 45
Module: (eval) (v1.89) Line: 204
Module: ModPerl::RegistryCooker::run (v1.89) Line: 204
Module: ModPerl::RegistryCooker::default_handler (v1.89) Line: 170
Module: ModPerl::Registry::handler (v1.99) Line: 31
That's pretty much the whole of it. Any help?

Thanks,
Eric
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

Should I open a new topic for this since it's gone down a different trail?
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

No help at all here?
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, upgrade is finished and appears to be successful except for the custom theme with the change to the form. I can logon as a STANDARD theme customer and create a ticket, but when I change to my custom THEME and try to create a ticket, I get the following error:

Image

So I assume that 'block' is an invalid style? Here's the code (just testing with the code in that link):

Code: Select all

<script type="text/javascript">
    Core.Customer.InitFocus();
<!--Add Custom Code Below-->
    switch ($('#Dest').val() ) { //this is where the queue is relevant (Dest = Queue)
    case  "20|\|ESE": // need to slash escape the pipes
      document.compose.RichText.value = "This is junk<br/>and line 2"; // only if you want to change the body. destroys user input if queue changes
      document.getElementById('TicketFreeText1').style.display = 'block';
      document.getElementById('LabelTicketFreeText1').style.display = 'block';
    break;
    default:
      document.compose.RichText.value = $('#Dest').val(); //remove this. debug only. shows queue information
      document.getElementById('TicketFreeText1').style.display = 'none';
      document.getElementById('LabelTicketFreeText1').style.display = 'none';
    }

<!--Add Custom Code Above-->
</script>
<!-- dtl:js_on_document_complete -->
Any help?

Thanks,
Eric
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Custom Customer Form

Post by jojo »

you can not use templates from 2.4 in 3.0
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

I'm not. The reason I'm upgrading is so that I can create this template correctly using the code from the following topic:

http://forums.otrs.org/viewtopic.php?f=60&t=8032

I think I found the issue though after reading the fine print in that discussion. I need to go into the sysConfig and add the fields that I'm going to use. I think I have to search under "free text" to find this. Sorry, I only saw OTRS for the first time a week ago...

I really do appreciate the help!
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

I'm missing something. So I tried to do the following:

1) I enabled TicketFreeText1 in Core::TicketFreeText changing the Key - Content to test123 / test123 removing the previous items there.
2) Added the custom code to MYTHEME/CustomerTicketMessage.dtl:

Code: Select all

<script type="text/javascript">
    alert("In the custom theme");
    Core.Customer.InitFocus();
<!--Add Custom Code Below-->
    switch ($('#Dest').val() ) { //this is where the queue is relevant (Dest = Queue)
    case  "5|\|ESE": // need to slash escape the pipes
      document.getElementById('TicketFreeText1').style.display = 'block';
    break;
    default:
      document.getElementById('TicketFreeText1').style.display = 'none';
    }

<!--Add Custom Code Above-->
</script>
<!-- dtl:js_on_document_complete -->

I get in the theme successfully, but still get the style error. Any direction? I'm oviously missing something.
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, I'm not getting into the case statement to ESE group. Always going to the default area. I put alerts into both and always going to default.

I chose 5 because if I go to ADMIN / Agent Management / GROUPS and mouseOver ESE, I get ID=5 in the link url. Am I ascertaining this information incorrectly?

Thanks,
Eric
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Custom Customer Form

Post by crythias »

Among other things, you didn't slash escape both pipes.

You should also be certain that TicketFreeText1 shows up (view source) without the custom code before you attempt to do something with it.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, threw in an alert and obviously my methodology for determining the ID is wrong. It shows 20 was correct (not sure how I figured it out before). I also only escaped one of the pipes. Getting closer... Sorry for all of this talking to myself but I don't want you looking at this when I'm finding my way through my questions...
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Custom Customer Form

Post by crythias »

btw, my "debug" code would have told you what to put in the case statement... (it changes the body to the dest value).
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

Yeah, had your debug code in there for a while, but I had other issues then (my issues have issues). So you're right, I'm not seeing the field in the source. I've searched for both the key/content values as well as TicketFreeText1 and neither shows. Am I adding these to the wrong area of SysConfig? I'm in "Edit Config Settings in Ticket -> Core::TicketFreeText". This time I actually pushed the Update button way at the bottom as well...
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, so I tried to visit this through the back door with:

Code: Select all

<script type="text/javascript">
    Core.Customer.InitFocus();
<!--Add Custom Code Below-->
    switch ($('#Dest').val() ) { //this is where the queue is relevant (Dest = Queue)
    case  "20\|\|ESE": // need to slash escape the pipes
        document.compose.RichText.value = 'Ticket information:<br/><br/><table><tr><td>Environment:</td><td><input type="text" name="environment"/></td><tr><td>Machine (if known):</td><td><input type="text" name="Machine"/></td></tr></table>';             
    break;
    default:
        document.compose.RichText.value = "";                                                                                  
    }

<!--Add Custom Code Above-->
</script>
But this makes it so that I can enter something in the first field, but it crashes after that. I guess I really need to be able to add fields to this form.
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

Found it kind of. If I do the following:
  • SysConfig
    Ticket -> Frontend::Customer::Ticket::ViewNew - Set key1 with content 1
    Ticket -> Core::TicketFreeText - Set TicketFreeText1 (just leave defaults for kicks)
    Set TicketFreeText1
This makes it show, but kind of goofy. Instead of having like the Priority: and then a dropdown for the levels like before it, I get a fill in the blank where Priority is and a dropdown to the right side. I was really looking for a TextBox field with a label before it:

Info: [========]

Interesting stuff but crazy obtuse at the same time. Any help achieving what I'm after?

Thanks,
Eric
stonkers
Znuny newbie
Posts: 33
Joined: 18 Mar 2011, 16:41
Znuny Version: 2.4.8

Re: Custom Customer Form

Post by stonkers »

OK, nevermind. I'll just create a form on my team website for submitting tickets.
andreyhlb
Znuny newbie
Posts: 1
Joined: 24 Mar 2011, 22:01
Znuny Version: 3.0.5

Re: Custom Customer Form

Post by andreyhlb »

Dear,
Get it to work on "CustomerTicketMessage.dtl", thanks.
However, in "AgentTicketPhone.dtl" did not work correctly. I believe because of function InitFocus() that does not exist in "Core.Agent.TicketAction". Thus, it runs only once the code to display the "Freetext".
How do I work also in "AgentTicketPhone.dtl?
I'm in version 3.0.5.
Thanks.
Andrey
Locked