Getting External Data into OTRS

Moderator: crythias

Locked
tnieman
Znuny advanced
Posts: 103
Joined: 14 Nov 2012, 21:59
Znuny Version: 3.1.6
Real Name: Tom Nieman
Company: WorkForce Software

Getting External Data into OTRS

Post by tnieman »

I'm trying to use the script provided in viewtopic.php?f=60&t=17033

I've got a dropdown added to the Frontend::Agent::Ticket::ViewCustomer page, it is populating from the script, but it is not being saved to the Dynamic Field I created.

The moderator of that post asked if the Dynamic Field was on the page I am using. The ViewCustomer page seems to be a bit different than other pages in the SysConfig, there isn't a place to add Dynamic Fields.

Another issue is that I will need to pass the current value of the Dynamic Field to the Perl script so that the drop down can set it as selected. From my research on the web, it appears that it is possible to do that, but I couldn't find how to adjust the Jquery below to pass an argument to GetCompanyData.pl.

Code: Select all

    <script type="text/javascript">
        $.get("GetCompanyData.pl", function(data) {
           $("#companydata").append(data);
    });
    </script>
This field is a must have for our company for go-live, which is Jan 28. I'm running out of time.


Thanks for any help!

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

Re: Getting External Data into OTRS

Post by crythias »

Dynamic fields aren't customer related. They are ticket or article related. That would have saved a lot of our back and forth right there.

"But I need to have a populated list for an entry in CustomerUser"
Yes, so first, you'll need to make the field available in the database for the customer. You can't use a Dynamic Field to do this. You have to either ALTER your customer_user table or make your alternative back end writable. I have to assume that you're using Database for the customer_user, or else you're going to not easily get this to work.

Optional, but necessary if you're actually wanting to use a custom field for the user:
1)

Code: Select all

ALTER TABLE  `customer_user` ADD  `my_field` VARCHAR( 200 ) NULL
2) add the field to the Map:

Code: Select all

[ 'UserMyField', 'LabelName', 'my_field', 1, 0, 'var', '', 0],
3) change the field to a select by adding "Selections" to "CustomerUser"

Code: Select all

 Selections => {
   UserMyField => {
      '' => '',
   }
},
Now the rest of the application can be used to populate and store the values.
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
tnieman
Znuny advanced
Posts: 103
Joined: 14 Nov 2012, 21:59
Znuny Version: 3.1.6
Real Name: Tom Nieman
Company: WorkForce Software

Re: Getting External Data into OTRS

Post by tnieman »

Got it. It is really a field tied to Ticket, so I will move it off of the Customer page and put it on the new phone and email ticket as well as a custom page we have.


Thanks for the help!
tnieman
Znuny advanced
Posts: 103
Joined: 14 Nov 2012, 21:59
Znuny Version: 3.1.6
Real Name: Tom Nieman
Company: WorkForce Software

Re: Getting External Data into OTRS

Post by tnieman »

Can I make the Dynamic Field hidden? Otherwise it is on the page twice (once as the drop down and once as the dynamic field at the bottom).

Can the jquery below be modified to send the current value of the Dynamic Field so that the current value can be the selected item in the drop down?

Code: Select all

    <script type="text/javascript">
        $.get("GetCompanyData.pl", function(data) {
           $("#companydata").append(data);
    });
    </script>
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Getting External Data into OTRS

Post by crythias »

tnieman wrote:Can I make the Dynamic Field hidden? Otherwise it is on the page twice (once as the drop down and once as the dynamic field at the bottom).
If you've enabled the dynamic field in SysConfig, it will appear and you don't have to code for it.

"How do I make it a select field?"
Change it in the configuration (Not Text, Dropdown) and give it a blank default as an option. Unfortunately, you can't make this change through the interface if you've already defined it. (through the database, maybe, but it'd be unsupported. Create a new DF).
tnieman wrote:Can the jquery below be modified to send the current value of the Dynamic Field so that the current value can be the selected item in the drop down?
Yes. #companydata is the representaion of prepending "#" to the DOM id= of the input field. Chances are, it'll be something like #DynamicField_myFieldName
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
Locked