{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":5909,"path":"customer-service-management/config-conv-features-agent-user.md","title":"Update the service portal chat configuration","bundle":null,"doc_type":null,"release":"australia","body":"\n# Update the service portal chat configuration\n\nConfigure the Now Assist in Virtual Agent chat configuration to ensure Now Assist in Virtual Agent loads on your Customer and Consumer Service Portals when CSM chat is enabled.\n\n## Before you begin\n\nRole required: workspace\\_admin\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Service Portal** &gt; **Agent Chat**.\n\n2.  To configure Now Assist in Virtual Agent loading on your Customer Service Portal:\n\n    1.  On the Service Portal Agent Chat Configuration page, select **Now Assist in Virtual Agent - CSM Chat Config** in the **Name** column.\n\n    2.  On the form, enter a value in the **Order** field.\n\n        **Note:** To display Now Assist in Virtual Agent chat configuration prominently on the portals, set the **Order** value to be either lower or better compared to the old CSM chat configuration.\n\n    3.  In the script box, replace the current script with the following script.\n\n        ```\n        (function($sp) {\n        \tvar configObj = {portal: $sp.getValue('url_suffix')},\n        \t\tisVAActive = GlidePluginManager.isActive('com.glide.cs.chatbot');\n        \t\n        \tconfigObj.liveagent_application = 'csm';\n        \tconfigObj.live_agent_only = !isVAActive;\n        \tconfigObj.liveagent_queue = $sp.getDisplayValue('sp_chat_queue');\n        \n        \tvar cc = new GlideRecord('customer_contact');\n        \tcc.addQuery('sys_id', gs.getUserID());\n        \tcc.query();\n        \tif (cc.next()) {\n        \t\tconfigObj.liveagent_interaction_contact = cc.getUniqueValue();\n        \t\tconfigObj.liveagent_interaction_account = cc.getValue('account');\n        \t}\n        \n        \tif (gs.isLoggedIn() && GlidePluginManager.isActive('com.sn_csm_b2b_consumers')) {\n        \t\tvar consumer = new GlideRecord('csm_consumer');\n        \t\tconsumer.addQuery('user', gs.getUserID());\n        \t\tconsumer.query();\n        \t\tif (consumer.next()) {\n        \t\t\tvar accounts = new sn_acct_consumer.AccountConsumerUtil().getAccountFromConsumer(consumer.getUniqueValue());\n        \t\t\tif (accounts.length > 0) {\n        \t\t\t\tif (accounts.length == 1) {\n        \t\t\t\t\tconfigObj.liveagent_interaction_account = accounts[0];\n        \t\t\t\t}\n        \t\t\t\tconfigObj.liveAgent_interaction_consumer = consumer.getUniqueValue();\n        \t\t\t}\n        \t\t}\n        \t}\n        \n        \treturn configObj;\n        })($sp);\n        ```\n\n    4.  Select **Update**.\n\n3.  To configure Now Assist in Virtual Agent on your Consumer Service Portal:\n\n    1.  On the Service Portal Agent Chat Configuration page, select **Now Assist in Virtual Agent - CSP Chat Config** in the **Name** column.\n\n    2.  On the form, enter a value in the **Order** field.\n\n        **Note:** To display Now Assist in Virtual Agent chat configuration prominently on the portals, set the **Order** value to be either lower or better compared to the old CSM chat configuration.\n\n    3.  In the script box, replace the current script with the following script.\n\n        ```\n        (function($sp) {\n        \tvar configObj = {portal: $sp.getValue('url_suffix')},\n        \t\tisVAActive = GlidePluginManager.isActive('com.glide.cs.chatbot');\n        \t\n        \tconfigObj.liveagent_application = 'csm';\n        \tconfigObj.live_agent_only = !isVAActive;\n        \tconfigObj.liveagent_queue = $sp.getDisplayValue('sp_chat_queue');\n        \n        \tif (gs.isLoggedIn()) {\n        \t\tvar consumer = new GlideRecord('csm_consumer');\n        \t\tconsumer.addQuery('user', gs.getUserID());\n        \t\tconsumer.query();\n        \t\tif (consumer.next()) {\n        \t\t\tconfigObj.liveAgent_interaction_consumer = consumer.getUniqueValue();\n        \t\t}\n        \t}\n        \t\n        \treturn configObj;\n        })($sp);\n        ```\n\n    4.  Select **Update**.\n\n\n## Result\n\nNow Assist in Virtual Agent configuration takes precedence over the standard Virtual Agent chat configuration for the portal.\n\n"}}