<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sharad Maheshwari on Medium]]></title>
        <description><![CDATA[Stories by Sharad Maheshwari on Medium]]></description>
        <link>https://medium.com/@sharadmaheshwari04?source=rss-b009a75970f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oUdZ85cAyUyUAf7FB85L6A.jpeg</url>
            <title>Stories by Sharad Maheshwari on Medium</title>
            <link>https://medium.com/@sharadmaheshwari04?source=rss-b009a75970f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:52:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sharadmaheshwari04/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Launch SF Messaging from an External Website]]></title>
            <link>https://medium.com/@sharadmaheshwari04/launch-sf-messaging-from-an-external-website-1829f08e9de7?source=rss-b009a75970f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1829f08e9de7</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[enhanced-einstein-bot]]></category>
            <category><![CDATA[external-website]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[messaging]]></category>
            <dc:creator><![CDATA[Sharad Maheshwari]]></dc:creator>
            <pubDate>Fri, 20 Sep 2024 18:34:05 GMT</pubDate>
            <atom:updated>2024-09-20T18:34:05.282Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*xedvUkhKvezHM9BvYzgIvw.png" /></figure><p><strong>Context</strong>: Salesforce Messaging is a powerful real-time communication platform that enables businesses to connect with customers across multiple channels, including SMS, WhatsApp, and web chat. Embedding Salesforce Messaging on an external website is a common requirement. This follow along guide will walk you through the steps to do that.</p><p><strong>Pre-requisite</strong>: You need to have Salesforce Messaging setup with an <strong>Enhanced</strong> Einstein Bot.</p><p><strong>High-level Steps to Embed Salesforce Messaging</strong></p><ol><li><strong>Confirm Messaging Setup and Enhanced Bot Routing</strong><br>Ensure that Salesforce Messaging is correctly set up and properly routes to the Enhanced Einstein Bot.</li><li><strong>Embed Messaging Code on External Website</strong><br>Retrieve and embed the Salesforce Messaging code on an external website (or use a demo site for testing as we will for this guide).</li><li><strong>Resolve CORS Error</strong><br>Fix the “No Access-Control-Allow-Origin header” error by adding the external site to the CORS allow list in Salesforce.</li><li><strong>Resolve CSP Error</strong><br>Address the “Refused to frame” error by adding the external site as a Trusted Domain for inline frames in Salesforce.</li><li><strong>Launch Salesforce Messaging</strong><br>After resolving both errors, successfully launch Salesforce Messaging and confirm it routes to the Enhanced Bot.</li></ol><p><strong>Solution</strong></p><p><strong>Confirm Messaging Setup and Enhanced Bot Routing</strong></p><p>First, let’s confirm that Salesforce Messaging is working and correctly routes to your Enhanced Bot.</p><ul><li>Navigate to Setup&gt; Embedded Service Deployments&gt; “Your Messaging Deployment”.</li><li>Ensure the deployment is active and published.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*Bq5t0dubFj123hIaWnrkQQ.png" /></figure><ul><li>Click on the “Test Messaging” tile to check if the Messaging Deployment launches correctly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*Uk8yR2eEbP6hgpeiIhPFlg.png" /></figure><ul><li>Also, confirm that a Lightning Web Runtime (LWR) site has been created for Messaging by navigating to Setup&gt; Sites (NOT All Sites) and checking for a site starting with ESW_……</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*rs4JDXBGrUgkCYIz1cfRvg.png" /></figure><p>Once verified, you can proceed to embed this on an external website.</p><p><strong>Embed Messaging Code on an External Website</strong><br>For this example, we’ll use W3Schools as the external site.</p><ul><li>To get the Messaging code snippet, go to Setup&gt; Embedded Service Deployments&gt; “Your Messaging Deployment”&gt; Code Snippet Tile</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*Vu9usTwrnOnHfaquZEUQQw.png" /></figure><ul><li>Click “Copy to Clipboard” to get the code.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*b9_-ymKMMeZca0IqJUQyvA.png" /></figure><ul><li>The code should look something like this:</li></ul><pre>Salesforce Messaginge with launch here<br>SAMPLE SCRIPT- DO NOT COPY- IT WILL NOT RUN<br>&lt;script type=&#39;text/javascript&#39;&gt;<br> function initEmbeddedMessaging() {<br>  try {<br>   embeddedservice_bootstrap.settings.language = &#39;en_US&#39;;<br><br>   embeddedservice_bootstrap.init(<br>    &#39;01ABCDEFGHIJKL&#39;,<br>    &#39;Messaging_for_In_App_and_Web&#39;,<br>    &#39;https://your-domain.sandbox.my.site.com/ESWMessagingforInApp01234567899876543210&#39;,<br>    {<br>     scrt2URL: &#39;https://your-domain.sandbox.my.salesforce-scrt.com&#39;<br>    }<br>   );<br>  } catch (err) {<br>   console.error(&#39;Error loading Embedded Messaging: &#39;, err);<br>  }<br> };<br>&lt;/script&gt;<br>&lt;script type=&#39;text/javascript&#39; <br>src=&#39;https://your-domain.sandbox.my.site.com/ESWMessagingforInApp01234567899876543210/assets/js/bootstrap.min.js&#39; <br>onload=&#39;initEmbeddedMessaging()&#39;&gt;<br>&lt;/script&gt;</pre><ul><li>You can paste this script into <a href="https://www.w3schools.com/js/tryit.asp?filename=tryjs_default">W3Schools</a> to test. Simply hit “Run” to see it in action.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*wsPUjvYIxxd6PGHUQmeXTQ.png" /></figure><p><strong>Resolve CORS Error</strong></p><p>If you inspect the Right Hand Side of the screen, you’ll notice the following error under the Console tab.</p><pre>Access to XMLHttpRequest at <br>&#39;https://your-domain.sandbox.my.salesforce-scrt.com/embeddedservice/v1/embedded-service-config?orgId=01ABCDEFGHIJKL&amp;esConfigName=Messaging_for_In_App_and_Web&amp;language=en_US&#39; <br>from origin &#39;https://www.w3schools.com&#39; <br>has been blocked by CORS policy: <br>No &#39;Access-Control-Allow-Origin&#39; header is present on the requested resource.</pre><p>To resolve the CORS policy error,</p><ul><li>Navigate to Setup&gt; CORS.</li><li>Add <a href="https://www.w3schools.com/">https://www.w3schools.com</a> as a new origin and save.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G-gKA3W1us4rM7ouCUzWtw.png" /></figure><p><strong>Resolve CSP Error</strong></p><p>After resolving the CORS error, you might face a Content Security Policy (CSP) error.</p><pre>Refused to frame &#39;https://your-domain.sandbox.my.site.com/&#39; <br>because an ancestor violates the following <br>Content Security Policy directive: <br>&quot;frame-ancestors xyz.abc.com *.xyz.com c.sandbox.vf.force.com&quot;.</pre><p>To resolve the CSP error,</p><ul><li>Navigate to Setup&gt; Sites&gt; your ESW Site.</li><li>Add <a href="https://www.w3schools.com/">https://www.w3schools.com</a> as a &quot;Trusted Domain for Inline Frames.&quot;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*luyqPkkE8insw2Nu9zuhWQ.png" /></figure><p><strong>Launch Messaging</strong></p><p>Once you’ve resolved both the CORS and CSP errors, Salesforce Messaging should launch correctly and route to the Enhanced Bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*M3DRNO-A96OTB0yZSSSrXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*xSzLbI8jBitvE0WDCN0euw.png" /></figure><p><strong>Conclusion</strong>: This guide gives you a basic introduction to embedding Salesforce Messaging on an external website. For next steps:</p><ul><li>If you have questions, feel free to ask in the comments.</li><li>If you want to embed Messaging on a specific website, make sure to allow list it for CORS and add it as a trusted domain for inline frames.</li><li>If this guide helped, please Clap, share and leave feedback.</li><li>If you know of a better solution, please do share!</li></ul><h3>Your motivation is appreciated, please don’t forget to Clap!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*85_OJrLZEw0lemiF" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1829f08e9de7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SF Chatbot & OpenAI Integration]]></title>
            <link>https://medium.com/@sharadmaheshwari04/sf-chatbot-chatgpt-integration-6a23b3fcaa09?source=rss-b009a75970f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a23b3fcaa09</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[einstein-bots]]></category>
            <category><![CDATA[salesforce-chatbot]]></category>
            <category><![CDATA[chatgpt-chatbot]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Sharad Maheshwari]]></dc:creator>
            <pubDate>Sat, 10 Feb 2024 22:32:45 GMT</pubDate>
            <atom:updated>2024-05-28T17:58:18.367Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*gzw3U67IYUxnvBRtiZPZEg.png" /></figure><p><strong>Context</strong>: Ever wondered if you could provide automated human like responses via your SF chatbot? Or, are your support agents being bombarded with cases and wish, there was a smarter way to deflect cases? Whether you want to have your Chatbot provide ChatGPT like responses based on Knowledge Articles, or, just want to create a bot that can answer your everyday life questions, you are in the right spot.</p><p>This a follow-along guide and there are no pre-requisites, but, familiarity with the Salesforce Environment will help. Also, I am assuming that you know how to setup a basic Chatbot (aka Einstein Bot). If not, check out the free Salesforce help articles linked in the resources section.</p><p><strong>High level steps</strong></p><ol><li>Create a Chatbot</li><li>Create new Remote Site Settings entry and a custom label to store the OpenAI API Key</li><li>Create Apex Classes (fret not, I’ll provide the code)<br>3.1 Apex Class that takes user input and OpenAI provides a response<br>3.2 Apex Class that searches through knowledge articles in SF and OpenAI answer the user’s question based on the information from the knowledge articles</li><li>Give chatbot access to the Apex Classes and the knowledge object</li><li>Create an OpenAI account and generate an API Key</li><li>Update the custom label to use the API Key generated in the previous step</li><li>Update the Chatbot to invoke OpenAI via our Apex Classes</li><li>Test your Chatbot and OpenAI integration</li></ol><p>You can expect the following end-result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*bp8G-LKnahBM23Q0UHGnwQ.png" /></figure><p><strong>Solution:</strong></p><ol><li><strong>Create a Salesforce Chatbot aka Einstein Bot</strong>: My hope is that you already have a working version of the chatbot. If not, please check the resources section on how to create one.<br>If you think I should expand this section or write another article on how to set up a basic Chatbot, please leave a comment and if there is enough interest, I’ll write one.</li><li><strong>Create RSS and Custom Label<br></strong>Remote Site Settings (RSS):<br>Navigate to Setup&gt; Remote Site Settings&gt; New Remote Site<br>Remote Site Name: Open_AI_ChatGPT<br>Remote Site URL: <a href="https://api.openai.com/">https://api.openai.com</a><br>Active: True/Checked</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*QOFuXxgAsHXjfbWRxq0o0g.png" /></figure><p>Custom Label:<br>Navigate to Setup&gt; Custom Labels&gt; New Custom Label<br>Short Description: chatGPTAPIKey<br>Name: chatGPTAPIKey<br>Value: set-it-to-any-value-for-now-we-will-change-it-towards-the-end</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*FEB8VEHDEOwItsj4qvU7gA.png" /></figure><p>3. <strong>Apex Class</strong>: Navigate to Setup&gt; Developer Console&gt; File&gt; New&gt; Apex Class and enter the Apex Class Name as follows</p><p>3.1 <strong>Apex Class that takes user input and OpenAI provides a response</strong><br><br>Apex Class Name: invokeChatGPT</p><pre>public with sharing class invokeChatGPT {<br>    private static final String API_KEY = System.label.chatGPTAPIKey;<br>    private static final String ENDPOINT_URL = &#39;https://api.openai.com/v1/chat/completions&#39;;<br><br>   public class chatGPTInput {<br>        @InvocableVariable(required=true)<br>        public String userInput;<br>    }<br><br>    public class chatGPTOutput {<br>        @InvocableVariable(required=true)<br>        public String chatGptOutput;<br>    }<br><br>    @InvocableMethod(label=&#39;Get ChatGPT Response&#39;)<br>    public static List&lt;chatGPTOutput&gt; generateResponse(<br>        List&lt;chatGPTInput&gt; chatGPTInputs<br>    ) {<br>        HttpRequest req = new HttpRequest();<br>        req.setEndpoint(ENDPOINT_URL);<br>        req.setMethod(&#39;POST&#39;);<br>        req.setTimeout(1000 * 120);<br>        req.setHeader(&#39;Content-Type&#39;, &#39;application/json&#39;);<br>        req.setHeader(&#39;Authorization&#39;, &#39;Bearer &#39; + API_KEY);<br>        String messageText;<br>        for (chatGPTInput cgi : chatGPTInputs) {<br>            messageText = cgi.userInput;<br>        }<br><br>        String prompt =<br>            &#39;Can you please provide a summarized and relevant response in bullet format for the question: &#39; +<br>            messageText +<br>            &#39;. If you are not confident about an answer, clearly state that and not guess the answer. Thanks!&#39;;<br><br>        Map&lt;String, Object&gt; PromptBody = new Map&lt;String, Object&gt;();<br>        PromptBody.put(&#39;role&#39;, &#39;user&#39;);<br>        PromptBody.put(&#39;content&#39;, prompt);<br><br>        List&lt;Object&gt; lstPrompts = new List&lt;Object&gt;();<br>        lstPrompts.add(PromptBody);<br><br>        Map&lt;String, Object&gt; requestBody = new Map&lt;String, Object&gt;();<br>        requestBody.put(&#39;messages&#39;, lstPrompts);<br>        requestBody.put(&#39;model&#39;, &#39;gpt-3.5-turbo-1106&#39;);<br><br>        req.setBody(JSON.serialize(requestBody));<br>        //System.debug(&#39;Request Body: &#39; + req.getBody());<br><br>        Http http = new Http();<br>        HttpResponse res = http.send(req);<br><br>        List&lt;chatGPTOutput&gt; chatGPTOutputs = new List&lt;chatGPTOutput&gt;();<br>        chatGptOutput cgo = new chatGptOutput();<br>        if (res.getStatusCode() == 200) {<br>            System.debug(res.getBody());<br>            Map&lt;String, Object&gt; responseBody = (Map&lt;String, Object&gt;) JSON.deserializeUntyped(<br>                res.getBody()<br>            );<br>            List&lt;Object&gt; choices = (List&lt;Object&gt;) responseBody.get(&#39;choices&#39;);<br>            if (choices.size() &gt; 0) {<br>                Map&lt;String, Object&gt; choice = (Map&lt;String, Object&gt;) choices.get(<br>                    0<br>                );<br>                Map&lt;String, Object&gt; mpMessages = (Map&lt;String, Object&gt;) choice.get(<br>                    &#39;message&#39;<br>                );<br><br>                String responseText = (String) mpMessages.get(&#39;content&#39;);<br><br>                responseText = responseText != null ? responseText.trim() : &#39;&#39;;<br>                //System.debug(&#39;Response Text: &#39; + responseText);<br>                cgo.chatGptOutput = responseText;<br>                chatGPTOutputs.add(cgo);<br>                return chatGPTOutputs;<br>            }<br>        } else {<br>            System.debug(<br>                &#39;Error: &#39; + res.getStatusCode() + &#39; &#39; + res.getStatus()<br>            );<br>            throw new ChatGPTException(<br>                &#39;Error: Unable to generate a response from ChatGPT.&#39;<br>            );<br>        }<br><br>        return chatGPTOutputs;<br>    }<br><br>    public class ChatGPTException extends Exception {<br>    }<br>}</pre><p>3.2 <strong>Apex Class that searches through knowledge articles in SF and OpenAI answer the user’s question based on the information from the knowledge articles</strong></p><p>Apex Class Name: invokeChatGPTWithKnowledge</p><p><strong>Note</strong>: To use this class, make sure that you have knowledge articles created and published for the corresponding record type and language. For example, to use the code below, I had pre-created knowledge articles of ‘Help Center’ record type in English ‘en_US’ language.</p><pre>public with sharing class invokeChatGPTWithKnowledge {<br>    private static final String API_KEY = System.label.chatGPTAPIKey;<br>    private static final String ENDPOINT_URL = &#39;https://api.openai.com/v1/chat/completions&#39;;<br><br>   public class chatGPTInput {<br>        @InvocableVariable(required=true)<br>        public String userInput;<br>    }<br><br>    public class chatGPTOutput {<br>        @InvocableVariable(required=true)<br>        public String chatGptOutput;<br>    }<br><br>    @InvocableMethod(label=&#39;Get ChatGPT Response with Knowledge&#39;)<br>    public static List&lt;chatGPTOutput&gt; generateResponse(<br>        List&lt;chatGPTInput&gt; chatGPTInputs<br>    ) {<br>        HttpRequest req = new HttpRequest();<br>        req.setEndpoint(ENDPOINT_URL);<br>        req.setMethod(&#39;POST&#39;);<br>        req.setTimeout(1000 * 120);<br>        req.setHeader(&#39;Content-Type&#39;, &#39;application/json&#39;);<br>        req.setHeader(&#39;Authorization&#39;, &#39;Bearer &#39; + API_KEY);<br>        String messageText;<br>        for (chatGPTInput cgi : chatGPTInputs) {<br>            messageText = cgi.userInput;<br>        }<br>  //query to get knowledge articles with a particular record type, langauge and, <br>  //only the articles that are in published status<br>        List&lt;List&lt;sObject&gt;&gt; search_results = [<br>            FIND :messageText<br>            IN ALL FIELDS<br>            RETURNING<br>                Knowledge__kav(<br>                    Title,<br>                    Article_Body__c<br>                    WHERE<br>                        RecordType.Name = &#39;Help Center&#39;<br>                        AND Language = &#39;en_US&#39;<br>                        AND PublishStatus = &#39;Online&#39;)<br>            LIMIT 5<br>        ];<br>        Knowledge__kav[] knowledgeArticles = (Knowledge__kav[]) search_results[0];<br>        List&lt;String&gt; nonBlankFieldList = new List&lt;String&gt;();<br>        for (Knowledge__kav ka : knowledgeArticles) {<br>            String articleBody = ka.Article_Body__c;<br>            //need to strip off all the HTML tags from knowledge articles<br>            String articleBodyWithoutHMTLTags = articleBody.stripHtmlTags();<br>            nonBlankFieldList.add(ka.Title + &#39;: &#39; + articleBodyWithoutHMTLTags);<br>        }<br><br>        String promptPrefix =<br>            &#39;Can you please provide a summarized and relevant response in bullet format for the question: &#39; +<br>            messageText +<br>            &#39;. Please do not use information from elsewhere, like internet, and answer solely on the basis of the information that I have provided here. &#39;+<br>            &#39;If you are not confident about an answer, clearly state that and do not provide pretentious answer. &#39;+<br>            &#39;Heres the information to answer the question: &#39;;<br><br>        String prompt = promptPrefix + String.join(nonBlankFieldList, &#39;; &#39;);<br>        System.debug(prompt);<br><br>        Map&lt;String, Object&gt; PromptBody = new Map&lt;String, Object&gt;();<br>        PromptBody.put(&#39;role&#39;, &#39;user&#39;);<br>        PromptBody.put(&#39;content&#39;, prompt);<br><br>        List&lt;Object&gt; lstPrompts = new List&lt;Object&gt;();<br>        lstPrompts.add(PromptBody);<br><br>        Map&lt;String, Object&gt; requestBody = new Map&lt;String, Object&gt;();<br>        requestBody.put(&#39;messages&#39;, lstPrompts);<br>        requestBody.put(&#39;model&#39;, &#39;gpt-3.5-turbo-1106&#39;);<br><br>        req.setBody(JSON.serialize(requestBody));<br>        //System.debug(&#39;Request Body: &#39; + req.getBody());<br><br>        Http http = new Http();<br>        HttpResponse res = http.send(req);<br><br>        List&lt;chatGPTOutput&gt; chatGPTOutputs = new List&lt;chatGPTOutput&gt;();<br>        chatGptOutput cgo = new chatGptOutput();<br>        if (res.getStatusCode() == 200) {<br>            System.debug(res.getBody());<br>            Map&lt;String, Object&gt; responseBody = (Map&lt;String, Object&gt;) JSON.deserializeUntyped(<br>                res.getBody()<br>            );<br>            List&lt;Object&gt; choices = (List&lt;Object&gt;) responseBody.get(&#39;choices&#39;);<br>            if (choices.size() &gt; 0) {<br>                Map&lt;String, Object&gt; choice = (Map&lt;String, Object&gt;) choices.get(<br>                    0<br>                );<br>                Map&lt;String, Object&gt; mpMessages = (Map&lt;String, Object&gt;) choice.get(<br>                    &#39;message&#39;<br>                );<br><br>                String responseText = (String) mpMessages.get(&#39;content&#39;);<br><br>                responseText = responseText != null ? responseText.trim() : &#39;&#39;;<br>                //System.debug(&#39;Response Text: &#39; + responseText);<br>                cgo.chatGptOutput = responseText;<br>                chatGPTOutputs.add(cgo);<br>                return chatGPTOutputs;<br>            }<br>        } else {<br>            System.debug(<br>                &#39;Error: &#39; + res.getStatusCode() + &#39; &#39; + res.getStatus()<br>            );<br>            throw new ChatGPTException(<br>                &#39;Error: Unable to generate a response from ChatGPT.&#39;<br>            );<br>        }<br><br>        return chatGPTOutputs;<br>    }<br><br>    public class ChatGPTException extends Exception {<br>    }<br>}</pre><p>4. <strong>Give chatbot access to the Apex Classes and the knowledge object</strong></p><p>Salesforce has a permission set for the basic chatbot user, called ‘Chatbot’. In previous Salesforce releases, the permission set was also known as ‘sfdc.chatbot.service.permset’.</p><p>Navigate to Setup&gt; Permission Sets&gt; Chatbot or ‘sfdc.chatbot.service.permset’ and give it the following access:<br>-Read and View All for the Knowledge__kav object<br>-Read Access to all the fields on the Knowledge__kav object<br>-Apex Class Access to invokeChatGPT &amp; invokeChatGPTWithKnowledge</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*hnRMYktDVYFFCQgbN40ubA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*-hT2Lnt06mKFWFZxCdo1ZQ.png" /></figure><p>5. <strong>Create an OpenAI account and generate an API Key</strong></p><p>To use OpenAI, we’ll first need to sign up for an OpenAI account followed by generating an API Key.</p><p>-To sign up, visit <a href="https://platform.openai.com/signup">https://platform.openai.com/signup</a></p><p>-To make callouts to OpenAI, you’ll need to enter your payment details. I started with the minimum payment, which is $5 and turned off Auto-Pay. Once logged in to OpenAI, Navigate to Settings&gt; Billing&gt; Payment Methods</p><p>-After you have entered your payment details and your account is loaded with some balance, it’s time to generate the API Key. <br>Navigate to API Keys&gt; Create new secret key&gt; <br>Name: After Payment API Key<br>Permissions: All</p><p><strong>Note</strong>: Once you hit the ‘Create Secret Key’ button, you’ll see your secret key on the next screen. It is important to Copy the Secret Key and Paste it somewhere, as you won’t be able to access it again. If you forget to copy it, you can always generate a new one.</p><p>You might be wondering, what’s the cost like?<br>For making a total of 155 callouts, my account was charged mere 13 cents ($0.13). Below are the screenshots of my usage cost and activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RXZA7awOeKv5vFJRDOo45A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPlb43TOpzvFvgtsBx2Ikw.png" /></figure><p>6. <strong>Update the custom label to use the API Key from the previous step</strong></p><p>Navigate to Salesforce Setup&gt; Custom Labels&gt; chatGPTAPIKey<br>Value: the-api-key-that-you-generated-in-the-previous-step</p><p>7. <strong>Update the Chatbot to invoke OpenAI using the Apex Classes</strong></p><p>In your Salesforce Chatbot, create a new Dialog<br>Dialog Name: invokeChatGPT</p><p>In the invokeChatGPT Dialog, add a Static Question Element with the following property values<br>Ask a question: What can I help you with today?<br>Choice Type: Static<br>Display Choices as Buttons<br>Expected Response Format: [System] Text (Text)<br>Save Answer to Variable: Create a New Variable &gt; userInputForChatGPT<br>If the variable already contains a value: Ask question and overrite the value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*tdm1y9TRLINnzQj_zDpacw.png" /></figure><p>In the invokeChatGPT Dialog, after the Question Element, add an Apex Action Element with the following property values<br>Action Type: Apex<br>Action Name: Get ChatGPT Response (this is the invocable method label in your invokeChatGPT Apex Class)<br>Input Source: Variable<br>Input Variable Name: userInputForChatGPT (Text)<br>Output Variable Name: Create a New Variable &gt; chatGPTResponse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*3ewpPSElE1f1-Du6hc-teQ.png" /></figure><p>Add a Message Element to display the ChatGPT response<br>{!chatGPTResponse}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*DWQ9dEo6VK8Gmo7NE2db9g.png" /></figure><p>Finally, show the Main Menu as your last step of the invokeChatGPT Dialog</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*fIUTc-tzTj_Y5uOCtaOKYw.png" /></figure><p>This is how your invokeChatGPT dialog should look like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8in0XILGQxmclDzjDRIQuQ.png" /></figure><p>Last 2 steps before we can test our integration,<br>-Make sure that your ‘Welcome Dialog’ shows the ‘Main Menu Dialog’ after the greeting message</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q94c5Uz-OL47Xk27Q4jsHg.png" /></figure><p>-Add ‘invokeChatGPT’ as a Menu Item under the ‘Main Menu Dialog’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8BasN05Zh-2nSj9B5V7zPw.png" /></figure><p>8. Test your Chatbot and OpenAI integration</p><p>Activate your Chatbot and test it using the Preview&gt; Rich Content Preview</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*lh7Hw4BfWIUzlIgUg6P1BA.png" /></figure><p>You’ll notice that the response you receive from OpenAI is succinct and not very useful. By setting the prompt to only the user input, I was able to get a more detailed response from OpenAI.</p><pre>//In your invokeChatGPT Apex Class, make the following change<br>//instead of prompt, user messageText<br>//PromptBody.put(&#39;content&#39;, prompt);//before<br>PromptBody.put(&#39;content&#39;, messageText);//after</pre><p>User Question:</p><pre>Can you help me generate a plan to run half marathon in the next 90 days? <br>I am a beginner and can easily run 10k.</pre><p>Chatbot + OpenAI Response:</p><pre>Sure! Here&#39;s a 12-week plan to help you train for a half marathon in the next 90 days:<br><br>Week 1-4: Building a Base<br>- Start with 3-4 runs per week, including one long run on the weekend<br>- Increase your long run distance by 1-2 miles each week<br>- Focus on easy, conversational pace runs<br>- Incorporate strength training and cross-training 1-2 times per week to build overall fitness and prevent injury<br><br>Week 5-8: Increasing Distance<br>- Gradually increase your weekly mileage by adding an additional mid-week run<br>- Continue to increase your long run distance by 1-2 miles each week<br>- Include tempo runs and intervals to work on speed and endurance<br>- Focus on proper recovery after long runs and hard workouts<br><br>Week 9-12: Tapering and Race Prep<br>- Start tapering your long run distance 2-3 weeks before the race<br>- Focus on maintaining fitness and avoiding injury during the taper<br>- Incorporate race-specific workouts such as hill repeats and race pace runs<br>- Don&#39;t try anything new in the last few weeks before the race – stick to what has worked for you during training<br><br>Remember to listen to your body, stay hydrated, and fuel properly with a balanced diet throughout your training. Good luck with your half marathon!</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*bp8G-LKnahBM23Q0UHGnwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*cprvJcninLDeVzFv14RCWw.png" /></figure><p>To test the Knowledge version of OpenAI, make sure that you have knowledge articles created and published for the corresponding record type and language. Once the knowledge articles have been published,<br>In the Chatbot, Navigate to invokeChatGPT Dialog&gt; Apex Action<br>Set the Action Name: Get ChatGPT Response with Knowledge (this is the invocable method label in your invokeChatGPTWithKnowledge Apex Class)<br>Activate the bot and test it out.</p><p><strong>Conclusion</strong>: This article is just to get you started and introduce you to the limitless world of Salesforce. As next steps,<br>-if you have any follow-up question, please leave a detailed comment and I’ll get back to you,<br>-if you enjoyed reading this article, please Clap and leave a comment,<br>-if you know of a better solution than the one I have provided above, please do share</p><p><strong>Note#1</strong>: If you added your payment details in OpenAI <strong><em>after </em></strong>generating the API key, you might need to regenerate the API key and update the custom label value in Salesforce<br><strong>Note#2:</strong> The quality of OpenAI response is directly related to the quality of the prompt you provide to OpenAI. Feel free to experiment with the prompt.</p><p><strong>Resources</strong>:<br>#1- <a href="https://help.salesforce.com/s/articleView?id=sf.bots_service_enable.htm&amp;type=5">Get Started with Einstein Bots</a><br>#2- <a href="https://help.salesforce.com/s/articleView?id=sf.bots_service_requirements.htm&amp;type=5">Einstein Bot Requirements</a><br>#3- <a href="https://help.salesforce.com/s/articleView?id=sf.live_agent_lightning_experience_setup_flow.htm&amp;type=5">Set up Chat with Guided Setup Flow</a><br>#4- <a href="https://help.salesforce.com/s/articleView?id=sf.snapins_chat_setup.htm&amp;type=5">Set up Embedded Chat Window</a></p><p><strong>References:</strong> I was inspired by the works of <a href="https://medium.com/u/d198ed3e7be0">Jitendra Zaa</a> and the basis of this article is one of his videos on how to integrate SF and ChatGPT using LWC</p><h3>Your motivation is appreciated, please don’t forget to Clap!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*RAUVPDrpubLhzHSY" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a23b3fcaa09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SF Chatbot: Rename field labels, Prepopulate offline support form & Hide required but redundant…]]></title>
            <link>https://medium.com/@sharadmaheshwari04/salesforce-chatbot-customization-rename-field-labels-prepopulate-offline-support-form-and-hide-92c20bf6d92b?source=rss-b009a75970f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/92c20bf6d92b</guid>
            <category><![CDATA[offline-case-support-form]]></category>
            <category><![CDATA[customization]]></category>
            <category><![CDATA[rename-hide-prepopulate]]></category>
            <category><![CDATA[salesforce-chatbot]]></category>
            <category><![CDATA[einstein-bots]]></category>
            <dc:creator><![CDATA[Sharad Maheshwari]]></dc:creator>
            <pubDate>Sun, 28 Jan 2024 04:02:09 GMT</pubDate>
            <atom:updated>2024-07-19T02:31:48.502Z</atom:updated>
            <content:encoded><![CDATA[<h3>SF Chatbot: Rename field labels, Prepopulate offline support form &amp; Hide required but redundant fields</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*LBxX_n3ZalGpPCO4o-vX4w.png" /></figure><p><strong>Context</strong>: A Salesforce chatbot is like a helpful assistant for businesses. It talks to customers, answers their questions, if needed, connects the user with live agent, and makes tasks quicker and easier for everyone. Salesforce provides abundant OOTB options to customize the bot labels and design, however, there is always a requirement for more :)! We’ll be working on resolving some common yet unanswered needs. At the time of writing this article, Salesforce provides no OOTB feature to customize the following:</p><p><strong>Ask#1</strong>: Change the field labels on the offline support (case) form without actually updating the field labels in Salesforce</p><p><strong>Ask#2</strong>: Pre-populate the offline support (case) form fields</p><p><strong>Ask#3</strong>: Preset and Hide fields that are not needed on the UI but are either required fields or are needed at the backend for further processing</p><p><strong>Solution:</strong> Salesforce allows updating the field label for standard and custom objects/fields, however, a downside to updating labels is that the update reflects EVERYWHERE! Consider the following 4 fields on the case object, where the keyword ‘Web’ might have uses in the SF back-office, however, is totally redundant for the end user.</p><p>The 4 fields (APIName) on the case object:<br>Web Company (SuppliedCompany)<br>Web Email (SuppliedEmail)<br>Web Name (SuppliedName)<br>Web Phone (SuppliedPhone)</p><p>A common ask is to be able to update the labels for these 4 fields on the Chatbot UI, without actually updating them in Salesforce. Using custom JS one can target the Chatbot offline support case form fields and update the field label as follows:</p><p><strong>Step#1</strong>: If you right-click &gt; inspect the field you wish to change the label for, you’ll notice that the field name on the Chatbot offline support form uses the &lt;label&gt; tag like below (to keep things simple, I have removed a few extra attributes that are not related to this discussion).</p><pre>&lt;label for=&quot;SuppliedName&quot;&gt;<br>  &lt;span id=&quot;SuppliedName-label&quot;&gt;Web Name&lt;/span&gt;<br>&lt;/label&gt;</pre><p><strong>Step#2</strong>: Once you have located the &lt;label&gt; tag for all the field you’d like to change the label for, make use of the afterMaximize event handler provided by Salesforce to identify when a user has clicked the chat button- which will open up (maximize) the chat window to either display bot dialogues, or, in case when the agents are offline, it’ll display the offline support form to create a case.</p><pre>embedded_svc.addEventHandler(&quot;afterMaximize&quot;, function () {<br>  //logic goes here<br>}</pre><p><strong>Step#3</strong>: Target the fields using document.querySelector as follows:</p><pre>embedded_svc.addEventHandler(&quot;afterMaximize&quot;, function () {<br>  suppliedNameField = document.querySelector(&#39;#SuppliedName&#39;);<br>  languageField = document.querySelector(&#39;#Language_2__c&#39;);<br>}</pre><p><strong>Step#4</strong>: To confirm if the offline support form has opened up and not the bot screen with bot dialogs, check, whether the fields are NULL or not. If the fields exists (i.e. NOT null), it means that the user is seeing the offline support form. Use the innerHTML property to <strong>rename </strong>or set the label of your choice as follows:</p><pre>embedded_svc.addEventHandler(&quot;afterMaximize&quot;, function () {<br>  suppliedNameField = document.querySelector(&#39;#SuppliedName&#39;);<br>  languageField = document.querySelector(&#39;#Language_2__c&#39;);<br>  <br>  //check if the field exists<br>  if (suppliedNameField != null) {<br>    //To change the field label<br>    document.querySelector(&#39;label[for=&quot;SuppliedName&quot;]  span:first-child&#39;).innerHTML = &#39;Full Name&#39;;<br>    //There is a form validation from the chat script that requires <br>    //a change event to bubble up to higher elements. If this is NOT included<br>    //the changes will not reflect on the Chatbot UI<br>    suppliedNameField.dispatchEvent(new Event(&#39;change&#39;, { &#39;bubbles&#39;: !0 }));<br>  }<br>}</pre><p><strong>Step#5</strong>: If you wish to <strong>prepopulate </strong>the fields, simply set the value for the target fields as follows:</p><pre>//To prepopulate the field<br>suppliedNameField.value = &#39;Full Name Goes Here&#39;;</pre><p><strong>Step#6</strong>: To <strong>hide</strong> fields that are not required on the chat bot UI, but needs to be set programmatically for further processing, set the display property to ‘none’ as below:</p><pre>if(languageField != null){<br>  //To hide the field<br>  languageField.parentElement.style.display = &#39;none&#39;;<br>}</pre><p>Complete code to update the field label, pre-populate the fields and hide fields not required on the UI is as follows:</p><pre>embedded_svc.addEventHandler(&quot;afterMaximize&quot;, function () {<br>  suppliedNameField = document.querySelector(&#39;#SuppliedName&#39;);<br>  suppliedEmailField = document.querySelector(&#39;#SuppliedEmail&#39;);<br>  subjectField = document.querySelector(&#39;#Subject&#39;);<br>  languageField = document.querySelector(&#39;#Language_2__c&#39;);<br>  <br>  //check if the field exists<br>  if (suppliedNameField != null) {<br>    //To change the field label<br>    document.querySelector(&#39;label[for=&quot;SuppliedName&quot;]  span:first-child&#39;).innerHTML = &#39;Full Name&#39;;<br>    <br>    //To prepopulate the field<br>    suppliedNameField.value = &#39;Full Name Goes Here&#39;;<br>    <br>    //There is a form validation from the chat script that requires <br>    //a change event to bubble up to higher elements. If this is NOT included<br>    //the changes will not reflect on the Chatbot UI<br>    suppliedNameField.dispatchEvent(new Event(&#39;change&#39;, { &#39;bubbles&#39;: !0 }));<br>  }<br><br>  if (suppliedEmailField != null) {<br>    document.querySelector(&#39;label[for=&quot;SuppliedEmail&quot;]  span:first-child&#39;).innerHTML = &#39;Email&#39;;<br>    suppliedEmailField.value = &#39;email@goesHere.com&#39;;<br>    suppliedEmailField.dispatchEvent(new Event(&#39;change&#39;, { &#39;bubbles&#39;: !0 }));<br>  }<br><br>  if (languageField != null){<br>    //Hide the parent div as langauge field is required for routing, <br>    //but should not display on the form<br>    languageField.parentElement.style.display = &#39;none&#39;;<br>  }<br><br>}</pre><p><strong>Outcome:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*9mxEbrCZHyTU-ox4dEI8ew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*JkkPbO6soYwISLBEP8gLzQ.png" /></figure><p><strong>Conclusion</strong>: Although the OOTB features are limited, Salesforce provides abundant options to customize. If you enjoyed reading this article, please Clap. If you have questions or would like to share your thoughts, please leave a comment. If you know of a better solution for the above limitation, please do share.</p><h3>Your motivation is appreciated, please don’t forget to Clap!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*RAUVPDrpubLhzHSY" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92c20bf6d92b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SF Knowledge: Article Summary repeated in the Article Content component (Experience Site)]]></title>
            <link>https://medium.com/@sharadmaheshwari04/salesforce-knowledge-experience-site-article-summary-repeated-in-the-article-content-component-4930cdca0ba5?source=rss-b009a75970f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4930cdca0ba5</guid>
            <category><![CDATA[salesforce-knowledge]]></category>
            <category><![CDATA[repeated-summary-section]]></category>
            <category><![CDATA[experience-site]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[article-content-component]]></category>
            <dc:creator><![CDATA[Sharad Maheshwari]]></dc:creator>
            <pubDate>Sun, 21 Jan 2024 22:39:29 GMT</pubDate>
            <atom:updated>2024-07-19T02:37:50.996Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*1nNAQHJQw8bKTUPoOmWUXw.png" /></figure><p><strong>Context</strong>: Salesforce Experience Site with it’s standard OOTB components provides an easy to use point-and-click way to create custom websites. One component which is frequently used is the <strong>Article Content component</strong> that allows you to display the contents of a Knowledge article on your webpage. Although, the component is customizable, it has certain limitations. We are going to address one such limitation in this article.</p><p><strong>Salesforce Limitation</strong>: One common requirement is to display the knowledge article summary, and, the Article Content component allows displaying the article summary, however, if article summary is added to the page layout, it gets displayed twice- once, under the title and again, under the summary section. At the time of writing this article, Salesforce does NOT provide an OOTB way to hide the duplicate article summary.</p><p>Here’s an example of a sample knowledge article with duplicate summary sections that I will use to explain the solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*xfpn2MVP44U4SVEO2CDYTw.png" /></figure><p><strong>Solution: </strong>Using custom CSS override you can,<br>1. <strong>Hide</strong> the summary under the title, or,<br>2. <strong>Hide </strong>the summary section</p><p><strong>Hide the summary under the title (highlighted in yellow)</strong>: Right-click on the article summary text under the title and you’ll notice that the summary text is enclosed inside the paragraph text &lt;p class= “article-summary”&gt;. We will target the “article-summary” class and hide it as follows:<br>1. Navigate to Builder Mode &gt; Theme &gt; Edit CSS<br>2. Add the provided CSS below and save the changes</p><pre>.article-summary{<br>    display: none!important;<br>}<br>//add !important only if the change does not reflect</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*kdLSVJEgaQCSQGBX" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66y-_h2Gcj8PsnFPE2AoXQ.png" /></figure><p><strong>Hide the summary section (highlighted in green)</strong>: Right-click and inspect the summary section and you’ll notice a div block that encapsulates the entire summary section. We will target the div using the “data-target-selection-name” attribute and hide it as follows:<br>1. Navigate to Builder Mode &gt; Theme &gt; Edit CSS<br>2. Add the provided CSS below and save the changes</p><pre>[data-target-selection-name=&quot;sfdc:RecordField.Knowledge__kav.Summary&quot;]{<br>    display: none!important;<br>}<br>//add !important only if the change does not reflect</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/0*JD5jhvssGtd-4KWy" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XRUeiV89mKw5jd4R" /></figure><p><strong>Conclusion</strong>: This is just a started code, please feel free to build on top of it. If you enjoyed reading this article, please like (clap) and leave a comment. If you know of a better solution for the above limitation, please do share.</p><p><strong>Note#1</strong>: If the provided code blocks do not yield the desired results, ensure that you verify the element class name for your Experience Site. While in preview mode (NOT in Builder mode), right-click and inspect the element to identify the corresponding class/data-target name. Adjust the CSS accordingly based on your findings.</p><h3>Your motivation is appreciated, please don’t forget to Clap!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*RAUVPDrpubLhzHSY" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4930cdca0ba5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SF Surveys: Change the default Emojis for the ratings question]]></title>
            <link>https://medium.com/@sharadmaheshwari04/salesforce-surveys-experience-site-change-the-default-emojis-for-the-ratings-question-8b0e2a980a98?source=rss-b009a75970f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b0e2a980a98</guid>
            <category><![CDATA[salesforce-surveys]]></category>
            <category><![CDATA[experience-site]]></category>
            <category><![CDATA[use-custom-emojis]]></category>
            <category><![CDATA[emoji]]></category>
            <category><![CDATA[change-default-emojis]]></category>
            <dc:creator><![CDATA[Sharad Maheshwari]]></dc:creator>
            <pubDate>Sat, 20 Jan 2024 17:27:22 GMT</pubDate>
            <atom:updated>2024-07-19T02:44:55.034Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*oB8_KwG_oqtm_lH3uS87bw.png" /></figure><p><strong>Context</strong>: Salesforce Surveys is a customer feedback and engagement tool integrated within the Salesforce platform. The tool allows for designing questionnaires tailored to specific needs. Salesforce Surveys also offers analytics features to analyze responses and generate meaningful reports. One feature which is frequently used is the Ratings Question that enables users to collect numerical feedback on a scale. Although, the component is customizable, it has certain limitations. We are going to address one such limitation in this article.</p><p><strong>Salesforce Limitation</strong>: When we set up Survey questions using Emojis, users cannot change the emojis and they are all smiling, thus, it limits the expression of diverse sentiments. The fixed smiling emojis may not accurately reflect negative or neutral feelings, hindering the survey’s adaptability and cultural relevance. Overall, this lack of customization restricts the tool’s ability to capture a wide range of emotions. as a rating icon. At the time of writing this article, Salesforce provides no OOTB feature to customize the Emojis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*TjD9tBTvK0j4TE9sjDiBPQ.png" /></figure><p><strong>Solution: </strong>Using custom CSS override you can, hide the existing Emojis and replace them with the Emojis of your choice.</p><p>If you inspect the Salesforce Survey component (right-click on the emoji and click ‘Inspect’), you’ll notice that each emoji has a data-value attribute associated with it, which one can use to target the emoji.</p><p>Step#1: Display the emoji of your choice: get your desired emoji, by either copying it from a website like Emojipedia (🔥) or using a relevant emoji code like “\01F525” and use it with the “content” property. Set cursor: pointer to get the hyperlink effect.</p><pre>[data-value=&quot;Bad&quot;]::after{<br>    content:&quot;😞&quot;!important;   <br>    cursor: pointer;<br>}<br><br>[data-value=&quot;2&quot;]::after{    <br>    content:&quot;🙁&quot;!important; <br>    cursor: pointer;<br>}<br><br>[data-value=&quot;3&quot;]::after{    <br>    content:&quot;😐&quot;!important;<br>    cursor: pointer;<br>}<br><br>[data-value=&quot;4&quot;]::after{<br>    content:&quot;🙂&quot;!important; <br>    cursor: pointer;<br>}<br><br>[data-value=&quot;Good&quot;]::after{<br>    content:&quot;\01F525&quot;!important;<br>    cursor: pointer;<br>}</pre><p>Step#2: Hide the existing emojis using the display property for the target “.surveyAnswerRating .visualPicker svg”</p><pre>.surveyAnswerRating  .visualPicker svg{<br>    display:none !important;<br>}</pre><p>Step#3: After hiding the old emoji, when you click on the new emoji, you’ll notice a blue dot, which is the old emoji’s border color. Set the border-color to white to get rid of the blue dot.</p><pre>.surveyAnswerRating .visualPicker input:focus~label lightning-icon {<br>    border-color: white!important;<br>}</pre><p><strong>Complete Code</strong>:</p><pre>//Display the Emoji of your choice<br>[data-value=&quot;Bad&quot;]::after{<br>    content:&quot;😞&quot;!important;  <br>    cursor: pointer;<br>}<br>[data-value=&quot;2&quot;]::after{    <br>    content:&quot;🙁&quot;!important; <br>    cursor: pointer;<br>}<br>[data-value=&quot;3&quot;]::after{    <br>    content:&quot;😐&quot;!important; <br>    cursor: pointer;    <br>}<br>[data-value=&quot;4&quot;]::after{<br>    content:&quot;🙂&quot;!important; <br>    cursor: pointer;<br>}<br>[data-value=&quot;Good&quot;]::after{<br>    content:&quot;\01F525&quot;!important;<br>    cursor: pointer;<br>}<br><br>//Hide the existing Emojis<br>.surveyAnswerRating  .visualPicker svg{<br>    display:none !important;<br>}<br><br>//Remove the on-click blue dot<br>.surveyAnswerRating .visualPicker input:focus~label lightning-icon {<br>    border-color: white!important;<br>}</pre><p>To use the above code with Salesforce Experience Site, while in Builder mode, navigate to <strong>Theme &gt; ‘Edit CSS’ &gt; Paste the above code and save</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/0*Qu_pqGlStK4ngWyN.png" /></figure><p><strong>Outcome</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*dJa-29UCEX4RxfU2x22fhw.png" /></figure><p><strong>Conclusion</strong>: I tested the above implementation and it is capturing the ratings with the correct score. This is just a starter code, please feel free to build upon it. If you enjoyed reading this article, please like/leave a comment. If you know of a better solution for the above limitation, please do share.</p><p><strong>Note#1</strong>: I haven’t tried it, but, to fix the emoji size, try setting the content property to point to an image stored as a static resource in your SF org ‘content: URL(/helpCenter/s/image.gif) !important;’ or to an image available online, ‘content: URL(“https://picsum.photos/50”) !important;’</p><p><strong>Note#2</strong>- the data-value sequence is Bad, 2, 3, 4, Good, there is NO 1 or 5</p><h3>Your motivation is appreciated, please don’t forget to Clap!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*RAUVPDrpubLhzHSY" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b0e2a980a98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SF Experience Site: How to open Sitemap.xml]]></title>
            <link>https://medium.com/@sharadmaheshwari04/salesforce-experience-site-how-to-open-sitemap-xml-8812c3365f3b?source=rss-b009a75970f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8812c3365f3b</guid>
            <category><![CDATA[experience-site]]></category>
            <category><![CDATA[sitemap]]></category>
            <category><![CDATA[helpcenter]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[google-search-console]]></category>
            <dc:creator><![CDATA[Sharad Maheshwari]]></dc:creator>
            <pubDate>Sat, 18 Nov 2023 18:07:10 GMT</pubDate>
            <atom:updated>2024-07-19T02:49:01.521Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*th3zpwf8cX7Dhiw-0S758A.png" /></figure><p><strong>Context</strong>: Upon launching a public Help Center via Salesforce Experience Site, I discovered that Google wasn’t listing the new Help Center in its search results. Further investigation revealed that Google wasn’t crawling the website. Without the pages indexed, they couldn’t appear in search results. Using Google Search Console, I successfully verified the site’s ownership, prompting Google to initiate crawling of the Help Center for indexing. Enhancing this process by adding a Sitemap in the Google Search Console is beneficial.</p><p>However, while Salesforce allows the generation of a Sitemap for your Experience Site, locating the Salesforce-generated Sitemap is not straightforward. In this article, I will guide you on how to find the generated Sitemap.</p><p><strong>Limitation</strong>: While Salesforce offers the capability to generate a Sitemap file, it lacks clear instructions on how to access it. Many online resources propose visiting http://&lt;hostname&gt;/sitemap_index.xml. However, two key issues arise: <br>a) there’s ambiguity regarding what the hostname should be, and <br>b) the existence of sitemap_index.xml is questionable. <br>Consequently, attempting to open the provided link proved unsuccessful for me.</p><p><strong>Solution</strong>: If your Experience Site is named MusicCenter and its URL is <a href="https://www.example.my.site.com/MusicCenter">https://www.example.my.site.com/MusicCenter</a>, accessing the Sitemap can be done by visiting <a href="https://www.example.my.site.com/MusicCenter/s/sitemap.xml">https://www.example.my.site.com/MusicCenter/s/sitemap.xml</a>.</p><p>To find your Experience Site URL, go to Salesforce &gt; Setup &gt; Sites. For generating a Sitemap for your Experience Site, go to Experience Builder &gt; Settings &gt; SEO &gt; Generate Sitemap.</p><p>The sitemap.xml file serves as a pointer to other sitemap files. For instance:</p><ul><li><a href="https://example.my.site.com/MusicCenter/s/sitemap-view-1.xml">https://example.my.site.com/MusicCenter/s/sitemap-view-1.xml</a></li><li><a href="https://example.my.site.com/MusicCenter/s/sitemap-topicarticle-1.xml">https://example.my.site.com/MusicCenter/s/sitemap-topicarticle-1.xml</a></li></ul><p>Visit the links mentioned in the sitemap.xml to gain additional insights into the creation of the sitemap for your website.</p><p><strong>Note</strong>: According to Salesforce documentation, SEO functionality for Salesforce Experience Sites is applicable exclusively to the production orgs for an active public access website after it has been published. Nevertheless, as an experimental measure, you can attempt to access your sitemap for a sandbox org and verify your sandbox website ownership with Google through the Google Search Console.</p><h3>Your motivation is appreciated, please don’t forget to Clap!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*RAUVPDrpubLhzHSY" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8812c3365f3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SF Experience Site: Hide/Rename the default Home link for Navigation Menu component]]></title>
            <link>https://medium.com/@sharadmaheshwari04/salesforce-experience-site-hide-rename-the-default-home-link-for-navigation-menu-component-4488740f02c1?source=rss-b009a75970f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4488740f02c1</guid>
            <category><![CDATA[navigation-menu]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-customization]]></category>
            <category><![CDATA[html-css]]></category>
            <category><![CDATA[experience-site]]></category>
            <dc:creator><![CDATA[Sharad Maheshwari]]></dc:creator>
            <pubDate>Sat, 23 Sep 2023 20:34:33 GMT</pubDate>
            <atom:updated>2024-07-19T02:54:25.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*G2HN8OYD7qSGZ2_O3Bqz7g.png" /></figure><p><strong>Context</strong>: Salesforce Experience Site with it’s standard OOTB components provides an easy to use point-and-click way to create custom websites. One component which is frequently used is <a href="https://help.salesforce.com/s/articleView?id=sf.rss_setup_nav_menu.htm&amp;type=5">Theme Navigation Menu component</a> that allows you to add a custom navigation/menu bar to your webpage. Although, the component is customizable, it has certain limitations. We are going to address one such limitation in this article.</p><p><strong>Salesforce Limitation</strong>: The Theme Navigation Menu component comes with a default link called ‘Home’ which when clicked redirects the user to the Home page. The Home link is a great feature, however, there are times when you don’t want it or would like to rename it to suite your needs. At the time of writing this article, Salesforce provides no OOTB feature to customize the Home link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*OmDIubdg_UYu7Qako_boIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-kO8evOm1z-dRbJvZktiA.png" /></figure><p><strong>Solution: </strong>Using custom CSS override you can,<br>1. <strong>Hide</strong> the Home link, or,<br>2. <strong>Remove</strong> the Home link, or,<br>3. <strong>Rename</strong> the Home link</p><p>If you inspect the Theme Navigation Menu component, you’ll notice that the HTML for the component is an unordered list &lt;ul&gt; with several list items &lt;li&gt;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Je9O3TpTk75FeEoL6xC-4g.png" /></figure><p>To hide, remove or rename the home link, you’ll need to target the first list item &lt;li&gt; from the unordered list &lt;ul&gt; using custom CSS. Use the <strong>Theme &gt; ‘Edit CSS’</strong> option to override CSS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*4wpIA5G1q0APEN2FyiYWAQ.png" /></figure><p><strong>Hide the Home link</strong>: This will hide the Home link, however, the list element will continue to take up the space on the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TjkOXj96QVH9unEXLT5ByA.png" /></figure><pre>li.mainNavItem:first-of-type{<br>    visibility: hidden;<br>}</pre><p><strong>To Remove the Home link</strong>: This will remove the list element from the page layout and will NOT take up space on the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RT6cn9NqcAMxqjTE65r3sw.png" /></figure><pre>li.mainNavItem:first-of-type{<br>   display: none !important;<br>}<br><br>/*If you continue seeing a blank space, add the below code as well<br> and adjust the padding as per your requirement*/<br>li.mainNavItem:nth-of-type(2){<br>   padding-left: 0 !important;<br>}</pre><p><strong>Rename the Home link</strong>: This will rename the text ‘Home’ with the text of your choice and will redirect the user to the home page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQkjPTbIhk_ODhFx2AWJoA.png" /></figure><pre>li.mainNavItem:first-child a{<br>   visibility: hidden;<br>}<br><br>/*replace &quot;Help Center&quot; with the text of your choice*/<br>li.mainNavItem:first-child a::after{<br>   visibility: visible;<br>   position: absolute;<br>   top:0;<br>   left:0;<br>   content: &quot;Help Center&quot;;<br>}</pre><p><strong>Conclusion</strong>: If you enjoyed reading this article, please like (aka clap) and leave a comment. If you know of a better solution for the above limitation, please do share.</p><p><strong>Note#1</strong>: The above solution works for the Stella Theme for the Experience Site. Depending on the theme you select, the CSS class name might be different and you’ll need to update the code accordingly. Use the inspect feature to determine the correct CSS class name.</p><p><strong>Note#2</strong>: If copying the above code, make sure that the quotes render correctly, otherwise, delete and re-add the quotes.</p><h3>Your motivation is appreciated, please don’t forget to Clap!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*RAUVPDrpubLhzHSY" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4488740f02c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>