Recent searches


No recent searches

How to prefill the description field in the webWidget (classic) inside a custom function



Posted Dec 14, 2021

I tried to follow the docs but I did not find a solution for prefilling the description or any custom fields in the webWidget form.

I need to fill the webWidget form a JS function

<script type="text/javascript">
zESettings = {
webWidget: {
contactForm: {
title:{ '*': 'title'},
launcher:{'en-US': 'button label'},
attachments: false,
}
}
};

zE('webWidget', 'hide');

function setWidget(name,email,description){

zE('webWidget','show');
zE('webWidget','open');
zE('webWidget','prefill', {
name: {value: name},
email: {value: email},
description: {value: description}
});
}

</script>

In this code launcher does not work and the prefill description does not work. I tried to move zESettings inside the function but that did not work. I tried add the zE('webWidget', 'identify') block and that did nothing. So I do not have anything else to try please help.

zESettings works for prefiling data only on page load. Is there any other function that could be used to prefill the the description?






0

4

4 comments

image avatar

Greg Katechis

Zendesk Developer Advocacy

Hi there! I saw that you had an open ticket regarding this issue that had some progress from where you were when you initially posted this. Regarding the description, I'm guessing that you found the correct setting to use was fields in addition to prefill. If you need to update settings after the widget has already loaded, you can also use the updateSettings command.

Finally, the reason that this shows up for the offline form is that ticket fields are not available options for chat and thus the description is not available either. Could you share with me what you're specifically looking to update on the chat form?

1


Oh there is also update settings can you share some code to do this??

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

Thanks for the screenshot! This is called the pre-chat form and this does not have an available setting in which you could prefill that. The available settings for the pre-chat form are limited to the greeting. 
 
As for the code example in the updateSettings command, there is a snippet in the link that I previously shared with you!

0


Can I turn the pre-chat form off?

would that solve the problem?

I need to send data to the agent before the chat starts. Can the offline form be on the whole time for example?

Is there any other solution to this problem?

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post