function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Philippe UyttendaelePhilippe Uyttendaele 

Snap-in, Pre-Chat fields & translation workbench

Hello Everyone,

I have a very hard time woring with the LiveAgent Chat snap-in.

First of all, I can't manage to add fields that refer to other objects than the suggested ones (Case/Contacts).
 would like to add a Custom Object field, but i cannot manage to do that in the framework of the Snap-in. If i force it in the component code, i have a 'field validation error' recieved by the built-in SF code.
--> anyone see a way ?

I then decided to work with what i could and pass extraPrechatFormDetails as suggested in the documentation. the idea is to pass the element in a custom TranscriptField. It worked great in POC with hardcoded values. It got out of control when my colleague enabled translation on those...
Indeed the Label of the buttons are defined by Translation Workbench. Which means that at the time of the set of the extraprechat items (on the page where the snap-in lies), i have no idea of what the value of the label will be. hence i have no way to declare any of the extraPrechatItems...

Is there a way to have a workaround - or a way of doing -  for these

I managed to "pass" the built-in validation step with the help of the Class of the input button (original code taken from SFDC documentation deleting the hard coded value from fieldLabelToName and replacing line 64 by below code ):
createFieldsArray: function(fields) {
		if(fields.length) {
            
			return fields.map(function(fieldCmp) {
                this.addToExtra(fieldCmp);
				return {
					label: fieldCmp.get("v.label"),
					value: fieldCmp.get("v.value"),
                    name: fieldCmp.get("v.class").split(" ")[0] //Inserted by Philippe to make it pass Validation!
				};
			}.bind(this));
		} else {
			return [];
		}
	},