Can otrs auto fill the subject ,the text and the dynamic field with the customer attribute?
Moderator: crythias
Can otrs auto fill the subject ,the text and the dynamic field with the customer attribute?
When create a new ticket ,Can otrs auto fill the subject ,the text and the dynamic field with the customer attribute (such as customer ID, Customer Username) after i select a customer . Any one know about this ?
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Can otrs auto fill the subject ,the text and the dynamic field with the customer attribute?
Yes, with javascript in the according template file.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Can otrs auto fill the subject ,the text and the dynamic field with the customer attribute?
@RStraub can you tell me how can i realize the autofill? since i am not familer with the script, can you share the java script ? thank you! 

-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Can otrs auto fill the subject ,the text and the dynamic field with the customer attribute?
Should be in the forum somewhere. Here is what you need to do:
1) Uncomment and edit the template at the bottom of your template fiel, e.g.:
2) Locate the "JSOnDocumentComplete" block of the field you want the template to trigger on, we used it on "Dest". Add the javascript to set values and trigger the template, e.g.:
(If the Queue name matches Development, submit the template, if not, change values and submit it then.)
I think there might be a problem when you want to use this for the customer user, as the autocomplete function inputs the Customer and does not trigger a change event.
1) Uncomment and edit the template at the bottom of your template fiel, e.g.:
Code: Select all
<form action="[% Env("CGIHandle") %]" method="post" enctype="multipart/form-data" id="HiddenForm">
<input type="hidden" name="Action" value="[% Env("Action") %]"/>
<input type="hidden" name="Subaction" value="StoreNew"/>
<input type="hidden" name="FormID" value="[% Data.FormID | html %]"/>
<input type="hidden" name="CustomerUser" value="DefaultUserName"/>
<input type="hidden" name="Dest"/>
<input type="hidden" name="NextStateID" value="new" />
<input type="hidden" name="ExpandCustomerName" value="2"/>
<input type="hidden" name="Body" value="Problem/Description:<br />Current state/behavior:<br/>Expected state/behavior:<br />Scenario:<br />Workaround:"/>
</form>
(If the Queue name matches Development, submit the template, if not, change values and submit it then.)
Code: Select all
var custUser = '$Env{"UserLogin"}';
if (strDest.match(/(.*)\|DEVELOPMENT(.*)/gi)) {
$('#HiddenForm').submit();
} else if (strDest.match(/(.*)\|SUPPORT(.*)/gi)) {
$('#HiddenForm input[name=ServiceID]').val('3');
$('#HiddenForm input[name=CustomerUser]').val(custUser);
$('#HiddenForm').submit();
}
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS