Livechat setDepartment not working

Hi,

I’m trying to use the widget API to set the department when a user enters the chat. The background is that I want to use the same RC instance for a number of teams who each deal with a different topic. I’m using RC 3.7.0, freshly installed.

I have tried the setdepartment method and the intialize method. The other settings, ie color and title are showing up so why isn’t department being set?

RocketChat(function() {
this.initialize({
    theme: {
        color: '#04436A',
        fontColor: '#FFFFFF',
        iconColor: '#1d74f5',
        title: "Welkom to test chat",
       offlineTitle: "Service is offline",
    },
    department: 'my department',
    language: 'nl',

});
});

This work.

RocketChat(function() {
this.setTheme({ color: ‘#47A3DA’, fontColor: ‘#FFFFFF’, title: ‘ACME: ask support’ });
this.registerGuest({
token: GA_makeid(17),
name: ‘<%=session(“UserNick”)%>’,
department: ‘IT support’,
customFields: [
{key: ‘Sess_ServerName’, value: ‘<%=session(“ServerName”)%>’, overwrite:true},
{key: ‘Sess_Start’, value: ‘<%=session(“Start”)%>’, overwrite:true},
{key: ‘Sess_UserIP’, value: ‘<%=session(“UserIP”)%>’, overwrite:true},
{key: ‘Sess_Username’, value: ‘<%=session(“username”)%>’, overwrite:true},
{key: ‘Sess_UserNick’, value: ‘<%=session(“UserNick”)%>’, overwrite:true},
{key: ‘Sess_UserEmail’, value: ‘<%=session(“UserEmail”)%>’, overwrite:true},
{key: ‘Sess_Dipartimento’, value: ‘Supporto Reparto IT’, overwrite:true},
{key: ‘Sess_Context’, value: ‘INTRANET’, overwrite:true},
{key: ‘Sess_Item’, value: ‘all’, overwrite:true},
]
});
});
function GA_makeid(length) {
var result = ‘’;
var characters = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’;
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}

Thanks, this does work indeed! I had department outside of the registerguest function in which case it does not work.