The following API allows you to specify values that will populate the contact form when it’s opened. It includes hidden values* that will be visible in the ticket details in your inbox (for representatives).
Then add each value using the following syntax; replacing name and value with your desired information:
*For the values to appear in the Contact Form input boxes, the specified name must match the name of the field in the Contact-Form configuration (commonly used names are Email_Address, Message_Body). These values are called 'visible values since they are visible to the user.
If the specified name does not match an existing UI input box, the value will not be visible to the user, and will be silently added to the ticket's details. Once added, it will be visible in your inbox (we call these values 'hidden values').
Remember: you can add any and as many values as you require for processing your ticket effectively.
To illustrate how to set 2 values to a contact form (1 visible and 1 hidden), we take as an example a contact form with 2 fields: an e-mail address and a details box.
To automatically set the user's email address and add his user ID to the ticket, the following lines are added:
Please notice that email@example.com will appear in the e-mail field in the contact form. However, the user ID value will not appear in the UI but will be available in the ticket details in your inbox.
Your final script should look like this: