How to Show hide dynamic fields in CustomerTicketMessage

Moderator: crythias

Locked
mmanara
Znuny newbie
Posts: 14
Joined: 09 Mar 2013, 16:39
Znuny Version: OTRS 6.0.23
Real Name: Massimo Manara
Company: Aglea s.r.l.

How to Show hide dynamic fields in CustomerTicketMessage

Post by mmanara »

Hi All,

my goal is show or hide a dynaminc field (in the example below named: "Progetto") based on the Customer ID in CustomerTicketMessage Interface. To achieve this goal I've defined an ACL in config.pm file.

$Self->{TicketAcl}->{'ACL-Customer-ID'} = {
Properties => {
Frontend => {
Action => ['CustomerTicketMessage'],
CustomerID => ['AGL'],
},
},
Possible => {
Ticket => {
DynamicField_ProgettoARI => ['Progetto'],
},
},
};

Anyway this seem does not work.

Suggestions?

Thanks.

Massimo
OTRS 3.2.0.beta3
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to Show hide dynamic fields in CustomerTicketMessage

Post by crythias »

ACL will only show or not show values in a field. It won't determine display of the field.
You could modify viewtopic.php?f=60&t=8032 ... somewhat with respect to the value of CustomerID
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
mmanara
Znuny newbie
Posts: 14
Joined: 09 Mar 2013, 16:39
Znuny Version: OTRS 6.0.23
Real Name: Massimo Manara
Company: Aglea s.r.l.

Re: How to Show hide dynamic fields in CustomerTicketMessage

Post by mmanara »

Many thanks Crythias!

Following this post: viewtopic.php?f=60&t=8032 (How To show freetext for specific Queues for Customers) I've

1) Created into OTRS Admin the project Dynaminc field (ProgettoARI)
2) Enabled into "Ticket -> Frontend::Customer::Ticket::ViewNew"
3) Edited the "CustomerTicketMessage.dtl" by inserting this code:

<!-- dtl:js_on_document_complete -->
<script type="text/javascript">
Core.Customer.InitFocus();

//START by MM
switch ($CustomerID.val() ) { //If the customer ID is named ARI
case "ARI": // need to slash escape the pipes
document.getElementById('DynamicField_ProgettoARI').style.display = 'block';
document.getElementById('LabelDynamicField_ProgettoARI').style.display = 'block';
document.getElementById('LabelDynamicField_ProgettoARI').className = 'Validate_Required';
break;
default:
document.getElementById('DynamicField_ProgettoARI').style.display = 'none';
document.getElementById('LabelDynamicField_ProgettoARI').style.display = 'none';
}
//END by MM
</script>
<!-- dtl:js_on_document_complete -->


but seem does not working. Something is wrong?

Thanks in advance.

Massimo
OTRS 3.2.0.beta3
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to Show hide dynamic fields in CustomerTicketMessage

Post by crythias »

A customer who is creating a message will not change her CustomerID so maybe it isn't an optimal choice to do a conditional show of dynamic field.

Probably would be better to provide this customer with her own theme, with the field enabled.

What I'm about to say won't make sense if you don't understand the .dtls:

If you enable a field on a screen in SysConfig, it *must* be represented by a "block" on that screen (.dtl). This "block" will either be a static block where you explicitly place it or a dynamic "listing" block that iterates through the enabled fields. Most .dtl templates provide commented examples of how to create a DynamicField block.

If you use the DynamicField manual block, it would be a good idea to remove/comment the DynamicField listing block.

Next, provide the HTML markup for the DynamicField block(s) that will show the field. You will need to present this as a theme to your client (and all clients with the same customerID).

For all other clients/customers, you still must include the block, but do not need to include any code to show the field.
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
stek
Znuny newbie
Posts: 11
Joined: 26 Aug 2019, 12:14
Znuny Version: 6.0.18

Re: How to Show hide dynamic fields in CustomerTicketMessage

Post by stek »

Good morning,
I'm configuring the dynamic fields in the CustomerTicketMessage.tt page in a static way; I commented on the general block [% RenderBlockEnd ("DynamicField")%] and inserted the block relative to the custom dynamic field. The problem is that when I open a ticket from the customer interface, the ticket is not opened and the page is blocked.

Everything works if I use the standard block of the CustomerTicketMessage page ([% RenderBlockEnd ("DynamicField")%]). It seems that the dynamic fields statically inserted in the page do not work.

Do you have any suggestions? Thanks in advance
root
Administrator
Posts: 3963
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: How to Show hide dynamic fields in CustomerTicketMessage

Post by root »

Hi,

Please don't hijack old topics, this one is from 2013. Create a new post on your own.

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
Locked