• Julia Krause
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Hello,
I use the Einstein Bot inside Community and to identify the user I used the standard PreChat Component 'Basic Scenarios'. It displays the input fields: FirstName, LastName and Email.
When I open the Chat a first time, it works well and the input fields are automatically filled in. But when I close and reopen the Chat, the input fields are empty. Only after reloading the hole page and open the Chat -> the input fields are filled again.
Did sameone have the same problem? How to solve it?
Thanks,
Julia

Hello,
I use a Einstein Bot inside Salesforce Community.

The goal is: The Bot have to provide informations about a specify Order. The order Id is passed by a url parameter. 

In the moment: The PreChat Component recognizes the param and represents it to the user. But how can I store this id to a custom field inside the LiveChatTranscript record to use it inside the Bot?
As a basis, I used the code from this side: https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_lightning_components_prechat_sample_aura.htm
Component:

<aura:component implements="lightningsnapin:prechatUI" description="Sample custom prechat component for Snapins. Implemented using Aura." controller="EinsteinBot_SaveRecordeController">
    <!-- Source: https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_lightning_components_prechat_sample_aura.htm -->
    <!-- You must implement "lightningsnapin:prechatUI" for this component to appear in the "Prechat Component" customization dropdown in the Snapins setup. -->

    <!-- Prechat field components to render. -->
    <aura:attribute name="prechatFieldComponents" type="List" description="An array of objects representing the prechat fields specified in prechat setup."/>

    <!-- get url parameter -->
    <aura:attribute name="isOrderParamInsideURI" type="Boolean"/>
    <aura:attribute name="orderIdLabel" type="String"/>
    <aura:attribute name="orderIdValue" type="String"/>
    
    <!-- Handler for when this component is initialized. --> 
    <aura:handler name="init" value="{!this}" action="{!c.onInit}" />

    <!-- For Aura performance. -->
    <aura:locator target="startButton" description="Prechat form submit button."/> 
    
    <!-- Contains methods for getting prechat fields, starting a chat, and validating fields. -->
    <lightningsnapin:prechatAPI aura:id="prechatAPI"/>
    
    <h2>Prechat form.</h2>
    <div class="prechatUI">
        <div class="prechatContent">
            <ul class="fieldsList">
                <!-- Look in the controller's onInit function. This component dynamically creates the prechat field components. -->
                {!v.prechatFieldComponents}

            </ul>

            <aura:if isTrue="{!v.isOrderParamInsideURI}">
                <p>
                    more information About the Order:
                </p>
                <p>
                    {!v.orderIdValue}
                </p>
            </aura:if>
        
        </div>
        <div class="startButtonWrapper">
            <ui:button aura:id="startButton" class="startButton" label="{!$Label.LiveAgentPrechat.StartChat}" press="{!c.handleStartButtonClick}"/>
        </div>
    </div>

</aura:component>
Helper:
...
/**
     * get order Id out of uri
     * TAKE CARE: static implementation for a Demo version
     */
    getOrderIdFromURI: function(cmp, evt, hlp) {
        var isParamInsideURI = false;

        var orderParam = decodeURIComponent(window.location.search.substring(1));
        var orderParamParts = orderParam.split('=');
        if(orderParamParts.length == 2){
            var orderParamLabel = orderParamParts[0];
            var orderParamValue = orderParamParts[1];
            isParamInsideURI = true;

            //set attributes
            cmp.set('v.orderIdLabel', orderParamLabel);
            cmp.set('v.orderIdValue', orderParamValue);
        }

        return isParamInsideURI;
    }
...

Is there any solution?
Thanks,
Julia
I'm building a custom pre-chat form that I'm using with a snap-ins chat deployment. I am using it in a Salesforce community and everything works great except I have no way of sending specific cases that I want to attach to the transcript and to display to the agent. I know exactly how to do this using the code snippet route, but since the chat is being used in the community there is no way to access any of the embedded_svc information because of locker service. I tried making a visualforce page and using the snippet, which allowed me to access embedded_svc, however it broke the chat altogether. Any ideas for how to pass an existing case ID to the chat so that it shows the existing case instead of making a new one? I've tried at least ten different ways to do this, but all have failed. Thanks everyone in advance.