MB-230 · Question #271
A company enables custom context variables on a chat widget. Users report that the context variables are not being populated on new chats. You need to troubleshoot the issue by querying the event…
The correct answer is D. getContextProvider. getContextProvider returns the currently set custom context provider, if any. If there is no registered custom context provider, then it returns null. The live chat SDK methods should be invoked after the lcw:ready event is raised. You can listen for this event by adding your…
Question
A company enables custom context variables on a chat widget. Users report that the context variables are not being populated on new chats. You need to troubleshoot the issue by querying the event listeners. Which listener is required to be running?
Options
- AsetContextProvider
- BstartProactiveChat
- CstartChat
- DgetContextProvider
- EinitializeNewConversation
How the community answered
(36 responses)- B6% (2)
- C3% (1)
- D83% (30)
- E8% (3)
Explanation
getContextProvider returns the currently set custom context provider, if any. If there is no registered custom context provider, then it returns null. The live chat SDK methods should be invoked after the lcw:ready event is raised. You can listen for this event by adding your own event listener on the window object. window.addEventListener("lcw:ready", function handleLivechatReadyEvent(){ // Setting the custom context provider // Throws error if contextProvider is not a function Microsoft.Omnichannel.LiveChatWidget.SDK.setContextProvider(function contextProvider(){ // Here it is assumed that the corresponding work stream would have context variables with logical name of 'contextKey1', 'contextKey2', 'contextKey3'. 'contextKey1': 'contextValue1', // string value 'contextKey2': 12.34, // number value 'contextKey3': true // boolean value // Retrieves the currently set custom context provider // If there is no registered custom context provider, then it returns null let registeredContextProvider = Microsoft.Omnichannel.LiveChatWidget.SDK.getContextProvider(); Not A: setContextProvider sets the context provider. The context provider function, when invoked, returns the context to be used for initializing a chat session. https://docs.microsoft.com/en-us/dynamics365/customer- service/developer/reference/methods/getcontextprovider https://docs.microsoft.com/en-us/dynamics365/customer- service/developer/reference/methods/setcontextprovider
Topics
Community Discussion
No community discussion yet for this question.