Tuesday, 26 November 2024

What’s the difference between Einstein Article Recommendations and Suggested Articles?

How Does Einstein Article Recommendations Work?

Einstein Article Recommendations helps support agents resolve customer cases efficiently by recommending knowledge articles that were attached to similar cases in the past. Agents don’t have to waste time searching or scrolling through lists of articles, and can quickly attach recommended articles or dismiss them as not helpful. 

Difference between Einstein Article Recommendations and Suggested Articles?

Like Einstein Article Recommendations, the Suggested Articles feature suggests knowledge articles in the Lightning Service Console. However, it relies only on keyword-based search and can’t refine its suggestions or incorporate data from past cases.

For example, many cases contain the same subject, description, and category. Because Einstein Article Recommendations considers which articles were attached to similar cases in the past, the top recommended article is likely to address the issue. Suggested Articles can search your knowledge base for articles containing case keywords, but the exclusion of case data.


Reference:

https://help.salesforce.com/s/articleView?id=service.einstein_article_recommendations_introduction.htm&type=5



Monday, 25 November 2024

Key Concepts of Prompt Builder

Hi,

The following key concepts and vocabulary are used throughout Prompt Builder.

Prompts

Generative language models are versatile and can create different types of responses. To produce a response, tell the LLM what you want in the form of a prompt. Prompts determine the quality and relevance of the LLM’s response, so it’s important to craft prompts that the model can understand and use.

Prompt Design

Prompt design is the process of creating prompts that improve the quality and accuracy of the model’s responses. Many models expect a certain prompt structure, so it’s important to test and iterate them on the model you’re using. After you understand what structure works best for a model, you can optimize your prompts for the given use case. To scale the prompt design process, create reusable prompts called prompt templates.

Prompt Templates

Behind the scenes, Einstein generative AI uses prompt templates. Prompt templates are reusable, detailed prompts that you can create and manage in Prompt Builder. These templates are use case-driven and include the information that helps the LLM generate a high-quality response, such as a goal, constraints, and brand guidelines. And to make sure that the prompts you send to the LLM are grounded in the most up-to-date data, prompt templates include placeholders for information that changes, such as customer names, contact information, and product prices.

Grounding

To help ensure high-quality responses, ground the prompt in data that’s relevant to your request. Einstein generative AI features use your Salesforce data to add context and personalization to your prompts. The LLM uses the grounding data along with the original, generic data that it was trained on. Without grounding, a model’s response can contain generic or irrelevant details. In Prompt Builder, you can easily ground prompts using merge fields that reference record fields, flows, Apex, and more.

The Einstein Trust layer masks sensitive data from the LLM by sending placeholder text instead. To see the placeholder text, look at the prompt resolution. In the response, you can see the demasked data added back in by Salesforce. You can see a summary of all masked data for the response in the Data Masking Details dialog.


Prompt Template Type

Prompt template types help you to create a prompt template for your particular use case. For example, a Sales Email prompt template helps your sales team to draft personalized emails for a contact or a lead.

Prompt Instructions

Prompt instructions are natural language instructions in a prompt template. Instructions describe a task for the LLM, such as “Write a description no longer than 500 characters.” Add instructions to a prompt template, and then relevant CRM data replaces the template’s placeholders. The prompt template is now a grounded prompt and sent to the LLM.

Reference: 








Friday, 11 October 2024

Best Practices for Building Prompt Templates

 Hi,

The following best practices should be considered when building prompt templates:

  • Make sure that your prompt templates are concise and easy to understand. Avoid using industry jargon or technical terms. Instead, use natural language and conversation design guidelines.
  • To give the LLM more contextual information, ask it to role play as a character, such as a sales or support representative. Then define the character’s goal. For example, include language such as, “You are a marketing executive who wants to invite major customers to a live event.”
  • Iterate on your prompt templates. Try achieving the same goal using different templates to see how the parts impact the model’s response. Get end-user feedback to see how well your prompt templates generate the desired response.
  • Choose a style, and stick to it. When you use a consistent writing style in your prompt templates, the LLM generates consistent responses. Your writing style is shaped by your word choice, intensifiers, emojis, and punctuation.
  • To help the LLM differentiate between context and instructions, create an instructions section in your prompt template. On a separate line, enter Instructions:, then surround your instructions with triple quotes (""").
  • Include direct instructions for the LLM to only generate the expected type of content. For example, if you want the LLM to draft an email, add instructions such as, “Follow these instructions strictly to generate only the message to be sent to the customer.” These instructions prevent the LLM from generating a response about the process of creating content, instead of just generating the content that you want.
  • Start with one of the templates in the Example Prompt Template Library, and customize it to fit your specific needs. Study the language that the templates use, especially the text related to writing style. You can use similar phrasing in your own templates.

 Here you can take a look at the example prompt template library


Reference:

Wednesday, 14 August 2024

How can you ensure that users can't bypass your SSO?

 Hi,

To ensure that users can’t bypass your SSO system, disable their ability to log in with their Salesforce username and password so that they’re required to log in with SSO. Salesforce recommends that you don’t require SSO for Salesforce admins so that they can still access Salesforce to respond to SSO outages or other issues.

  1. Disable direct logins through login.salesforce.com.
    1. From Setup, in the Quick Find box, enter My Domain, then select My Domain.
    2. In the Routing and Policies section, click Edit.
    3. In production, select Prevent login from https://login.salesforce.com. In a sandbox, select Prevent login from https://test.salesforce.com.
    4. Save your changes.
  2. For users who have the Is Single Sign-On Enabled user permission, disable their ability to log in with Salesforce credentials.
    1. From Setup, in the Quick Find box, enter Single Sign-On, then select Single Sign-On Settings.
    2. Click Edit.
    3. In Delegated Authentication, select Disable login with Salesforce credentials, then save your changes.
      This setting doesn’t directly disable username-password logins for all users. It applies only to users who have the Is Single Sign-On Enabled user permission. As long as you don’t assign this permission to users—such as admin users who must be able to log in if SSO is down— they can still log in with their Salesforce credentials when this setting is turned on.
  3. To require SSO of certain users, assign them the Is Single Sign-On Enabled user permission. To use permission sets, complete these steps.
  • Create a Permission Set that includes the Is Single Sign-On Enabled user permission or add this permission to existing Permission Set.
  • Assign the Permission Set to the respective users








Reference:

  • https://help.salesforce.com/s/articleView?id=sf.sso_enforce_sso_login.htm&type=5





Wednesday, 31 July 2024

ContentNote record Creation in Apex

 Hi,

We have to create 2 object records :

  • ContentNote - For Creating ContentNote Record
  • ContentDocumentLink - For linking to the Record (ex: Account, Contact etc)

ContentNote Record creation:


The following Apex code creates a note and escapes any special characters so they’re converted to their HTML equivalents.

ContentNote cnObj = new ContentNote(); cnObj.Title = 'test1'; String body = 'Hello World. Before insert/update,
escape special characters such as ", ', &,
and other standard escape characters.'; cnObj.Content = Blob.valueOf(body.escapeHTML4()); insert cnObj;

The following code creates a note using text that is already formatted as HTML, so it doesn’t need to be escaped.

ContentNote cnObj = new ContentNote(); cnObj.Title = 'test2'; String body = '<b>Hello World. Because this text is already
formatted as HTML,
it does not need to be escaped. Special characters such as &quot;, etc.
must already use their HTML equivalents.
</b>'; cnObj.Content = body; insert cnObj;

To Link to a record (eg: Account Record Id = 001XXXXXXXXXXXXXXX) :

ContentDocumentLink cdlObj = new ContentDocumentLink();

cdlObj.ContentDocumentId = cnObj.Id;

cdlObj.LinkedEntityId = '001XXXXXXXXXXXXXXX';//We have to add record id //dynamically here based on requirement

insert cdlObj;



Reference:

Tuesday, 30 July 2024

How do we retrieve picklist values from standard picklist fields?

 Hi ,

 When we have to retrieve picklist values from the standard Picklist Fields (eg: Stage on Opportunity object , Industry on Account object etc.,) then we have to use StandardValueSet. 

In API version 38.0 and later, standard picklists are represented by the StandardValueSet type. In previous versions, standard picklists are represented by the CustomField type. 

Note:

The names of standard value sets and picklist fields are case-sensitive.


Example: 

To retrieve picklist values from Opportunity's Stage field then we have to use StandardValueSet as shown below.

package.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>OpportunityStage</members>
<name>StandardValueSet</name>
</types>
<version>58.0</version>
</Package>

Output:




This following link has standard picklists as standard value sets and their corresponding field names.



Reference:


Sunday, 28 July 2024

How to configure a LWC for Screen flows

 Hi,

To include a custom Lightning Web Component in a Flow Screen and define its properties (input/output), we must configure the appropriate values in the meta file (componentName.js-meta.xml).

  • To make your component usable in a flow screen, add the lightning__FlowScreen target.
  • To add input fields to your component, add targetConfig properties.
  • To restrict a property to inputOnly or outputOnly, use the role attribute. 
  • For example, if a property is restricted to outputOnly, users can’t set its value from a Lightning record page. If you don’t specify the role attribute, the default value allows input and output.
  • This sample component has five flow screen input fields.   The startDate property is set to inputOnly.

    <?xml version="1.0" encoding="UTF-8"?>

    <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">

      <apiVersion>61.0</apiVersion>

      <isExposed>true</isExposed>

      <masterLabel>Best Component Ever</masterLabel>

      <description>This is a demo component.</description>

      <targets>

        <target>lightning__FlowScreen</target>

      </targets>

      <targetConfigs>

        <targetConfig targets="lightning__FlowScreen">

          <property name="startDate" label="Start Date" type="Date" role="inputOnly" />

          <property name="account" label="Account Chosen" type="@salesforce/schema/Account" />

          <property name="annualRevenue" label="Annual Revenue" type="Integer" role="outputOnly" />

          <property name="name" label="Account Name" type="String" />

        </targetConfig>

      </targetConfigs>

    </LightningComponentBundle>




    Reference:

    https://developer.salesforce.com/docs/platform/lwc/guide/use-config-for-flow-screens.html

    https://developer.salesforce.com/docs/platform/lwc/guide/reference-configuration-tags.html




    Thursday, 25 July 2024

    Uninstall Salesforce CLI from macOS, Linux and Windows

    Hi,

    If you are facing issues with VS Code with Salesforce CLI then follow the instructions below to uninstall completely. Once un install is completed then you can re install for better performance.

    The method to uninstall Salesforce CLI differs depending on whether you used an operating-specific installer or npm

    If  You Installed on macOS or Linux Using the Installers or TAR Files


    macOS or Linux


    Enter all these commands in a terminal to remove Salesforce CLI. The commands uninstall both sfdx (v7) and sf (v1 and v2).

    sudo rm -rf /usr/local/sfdx
    sudo rm -rf /usr/local/lib/sfdx
    sudo rm -rf /usr/local/bin/sfdx
    sudo rm -rf ~/.local/share/sfdx ~/.config/sfdx ~/.cache/sfdx
    sudo rm -rf ~/Library/Caches/sfdx
    sudo rm -rf /usr/local/sf
    sudo rm -rf /usr/local/bin/sf
    sudo rm -rf ~/.local/share/sf ~/.config/sf ~/.cache/sf
    sudo rm -rf ~/Library/Caches/sf


    If you Installed on Windows Using the Installer


    These steps uninstall both sfdx (v7) and sf (v1 and v2):

    1. Select Start > Control Panel > Programs > Programs and Features.
    2. Select @salesforce/cli, and click Uninstall.
    3. Inside your home directory, delete these two directories:
        • config\sfdx
        • config\sf

    If Salesforce CLI is still installed, delete these directories:

        • %LOCALAPPDATA%\sfdx
        • %LOCALAPPDATA%\sf


    If You Installed Using npm


    To uninstall sfdx (v7), run this npm command from a terminal or command prompt:

        npm uninstall sfdx-cli --global

    To uninstall sf (v1 or v2), run this command:
        
        npm uninstall @salesforce/cli --global

    Inside your home directory, delete these two directories.

      • Library/Caches/sfdx (On Windows: Library\Caches\sfdx)
      • Library/Caches/sf (On Windows: Library\Caches\sf)



    Reference:
    https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm



    Wednesday, 12 June 2024

    What Is Salesforce Einstein Trust Layer?

     The Einstein Trust Layer elevates the security of generative AI through data and privacy controls that are seamlessly integrated into the end-user experience. These controls enable Einstein to deliver AI that’s securely grounded in your customer and company data, without introducing potential security risks. In its simplest form, the Trust Layer is a sequence of gateways and retrieval mechanisms that together enable trusted and open generative AI.







    The Einstein Trust Layer lets customers get the benefit of generative AI without compromising their data security and privacy controls. It includes a toolbox of features that protect your data—like secure data retrieval, dynamic grounding, data masking, and zero data retention—so you don’t have to worry about where your data might end up. Toxic language detection scans prompts and responses for accuracy and to assure they are appropriate. And for additional accountability, an audit trail tracks a prompt through each step of its journey. 


    Salesforce designed its open model ecosystem so you have secure access to many large language models (LLMs), both inside and outside of Salesforce. The Trust Layer sits between an LLM and your employees and customers to keep your data safe while you use generative AI for all your business use cases, including sales emails, work summaries, and service replies in your contact center.






    Reference:


    https://www.salesforce.com/eu/artificial-intelligence/trusted-ai/


    https://trailhead.salesforce.com/content/learn/modules/the-einstein-trust-layer?trail_id=prepare-your-data-for-ai



    What’s the difference between Einstein Article Recommendations and Suggested Articles?

    How Does Einstein Article Recommendations Work? Einstein Article Recommendations helps support agents resolve customer cases efficiently by ...