Where to put Custom Javascript Code for Activity Dialogs !

English! place to talk about development, programming and coding
Post Reply
Purvi
Znuny newbie
Posts: 9
Joined: 28 Jun 2016, 19:01
Znuny Version: 5.0.10

Where to put Custom Javascript Code for Activity Dialogs !

Post by Purvi »

I have 2 Activity Dialogs present for my ticket.
My requirement is to add some custom javascript code for one of the Activity Dialogs.

I tested my code. It works fine.
But I don't know where to put it.

The url that is generate when I click on my Activity Dialog is this one :

http://192.168.1.152/otrs/index.pl?Acti ... 119babe7dc

I get from here the Action is AgentTicketProcess. So I was putting my javascript in Core.Agent.TicketProcess.js
But the code gets execute only when I create a new process.
I want the code to get executed after my ticket is created and when I go to the desired Activity Dialog.

Please help !
I am so close.

** Attched is the screenshot of my Ticket with 2 Activity Dialogs. I want to add my code to the Show Emp Info AD.
You do not have the required permissions to view the files attached to this post.
jcasavilca
Znuny newbie
Posts: 1
Joined: 06 Jul 2016, 21:11
Znuny Version: 4.0.x
Real Name: Jonathan Casavilca
Company: Free Lance Developer

Re: Where to put Custom Javascript Code for Activity Dialogs !

Post by jcasavilca »

Hi Purvi!

The best way that i've found to customize activity dialogs with Javascript code, is putting all of them inside the ActivityDialogoFooter.tt / dtl file. Doing this way you can run JS code after the entire screen was "painted", finally you can control the code execution putting the functions/lines of code inside of this tags:

<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[

..... your JS code ....

//]]></script>
<!--dtl:js_on_document_complete-->

Hope this help!!!

Jonathan
undefined
Znuny newbie
Posts: 5
Joined: 12 Jul 2016, 09:48
Znuny Version: 5.0.9

Re: Where to put Custom Javascript Code for Activity Dialogs !

Post by undefined »

Hi!

For enhancement to make the javascript only activate for certain activity dialog,

Code: Select all


<script type="text/javascript">  	
var ActivityDialogEntityID = document.getElementsByName("ActivityDialogEntityID")[0].value;
//change the “ActivityDialog-xxxxxxx” to your Activity dialog id 
//*the ActivityDiaolog can get from the url ofprocessticket
    if(ActivityDialogEntityID == "ActivityDialog-afe6c75836b5e17e33336eb078c32936")
    {
  //your script here
    }  
</script>


Hope this help.
Post Reply