Play Games

Search This Blog

Wednesday, April 9, 2025

How to read/learn salesforce release using Agentforce salesforce - Salesforce Release Assistant Einstein using Data cloud and Agentforce

Solution: Build salesforce Agent and use Data Library to feed the data .In this example ,the latest release pdf document is given for reference and use agent to answer the queries .

Step 1:  Download the required release pdf. 

Go to the URL 'https://help.salesforce.com/s/articleView?id=release-notes.salesforce_release_notes.htm&release=254&type=5' and download the respective latest salesforce release pdf document.


Step 2: Upload the pdf file

Go to setup --> Einstein --> Einstein Data Library


click on 'New Library' button and fill the details and click on save

click on files tab and upload the respective salesforce release pdf document 


Step 3: Get the retriever details.

Go to the Einstein Studio and click on retrievers to view all the retrievers 

Select the respective data library that you upload and not the api name of the retriever 


Step 4: Create the prompt template. Go to setup --> Einstein --> Einstein Generative AI --> Prompt Builder and click on 'New Prompt Template'


Fill the details and click on 'Next'

Construct the prompt template as below

You are an experienced Salesforce Technical Architect and your role is to answer the question by referring to the following files {!$EinsteinSearch:File_Salesforce_Release_Assistant_1Cx_nzw964c34f8.results}

Here is the question asked {!$Input:Query}

"""

Follow the instructions below

Remember to tailor your response to the specific question, focusing on the relevant details

your tone should be friendly and informative.

"""


Note: Use the data library in the template by referring the retriever.

Test the prompt template and do modifications as required to get proper output



Step 5: Create the Agent Action.

Go to setup --> Einstein --> Agentforce Assets and click on Actions tab 


click on 'New Agent Action'



Fill the details as shown in above image and click on next 

Fill the details as shown in the images below and click on Save 




The custom action gets created as shown below


Step 6: Configure the Agent .

Go to setup --> Einstein --> Einstein Generative AI --> Agentforce Studio --> Agentforce Agents and click on 'New Agent'


Select 'Create with Gen AI' and add the text 'create salesforce agent that answer the question referring to the data library' in  What do you want your agent to do? field and click on Next 

Fill the details as per the image below and click on next

In the add topics section, unselect existing topics and click on 'Add Draft Topic' button




Fill the details as shown in above image and save.

The 'Salesforce Release Notes' topic gets added


click on 'Next'

Select the 'Salesforce Release Assistant' data library and click on 'Create'.

The agent gets created with the topic


Go to the topic and click on 'This Topic's Actions' and click on 'New' button and then click on 'Add from Asset Library'


select the custom action created in step 5 i.e. Release Template Action and click on 'Finish'.



Test the agent and activate it.



Note: The data cloud feature and the other permissions/licenses are assumed to be present for this to work.






Thursday, April 3, 2025

How to enable Flex Card Designer in omnistudio salesforce org

 Solution: Go to Setup --> Object Manager --> Omni UI Card object --> Lightning Record Pages and click on 'Vlocity Card Designer'


click on view as shown below


 The lightning page gets opened as shown below


Click on Activation and then assign to org default 


 click on 'Next' and then save.

That's it. The flex card designer is ready now 

Output:

Before:

After:



Friday, March 28, 2025

knowledge setup or enable knowledge articles in salesforce

Go to setup --> Service Setup and Clink on Knowledge Setup


The following screen appears 


Click on Start

Select the user/people and click on Next

Add data category if needed and click on Next

Click on Finish 

The knowledge setup is done successfully.


Note: After you enable Lightning Knowledge, you can’t disable it.

Wednesday, March 26, 2025

How to enable or turn on Agentforce in salesforce

Solution: Go to Setup --> Einstein --> Einstein Generative AI --> Agents and enable the toggle icon of 'Agentforce' as shown in images below 



How to enable or turn on Einstein in salesforce

Solution: Go to Setup --> Einstein --> Einstein Setup and enable the toggle icon of 'Turn on Einstein' as shown in images below 






Thursday, March 20, 2025

Objects in Salesforce and their extensions

 

Object Type Object Name API Name (Extension) Explanation
Standard Objects Account Account No suffix
Custom Objects Any custom object Custom_Object__c End with __c (e.g., Invoice__c).
Big Objects LargeDataObject LargeDataObject__b End with __b, used for handling large data sets.
External Objects External Data Object External_Object__x End with __x, used for integrating with external data sources.
Platform Events Custom Event Custom_Event__e End with __e, used for event-driven architecture.
Metadata Objects Custom Metadata Type Custom_Metadata__mdt End with __mdt, used for storing metadata configuration.
Settings Objects/Custom Seetting Custom Settings Custom_Setting__c End with __c, used for custom settings.
Data Lake Object (DLO) Data Lake Object Data_Lake_Object__dlm End with __dlm
Data Model Object (DMO) Data Model Object Data_Model_Object__dmo End with __dmo
Engagement Object Engament Object Engagement_Object__e End with __e

Monday, March 17, 2025

metadata to retrieve the Einstein prompt templates in visual studio code salesforce


 
Solution:

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

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

    <types>

        <members>Test_Prompt</members>

        <name>GenAIPromptTemplate</name>

    </types>

    <version>63.0</version>

</Package>

Output:


Note: Test_Prompt
is the api name of the respective prompt template.


Tuesday, March 11, 2025

Call the prompt template from Apex Salesforce

 

Solution: You can call the prompt template from Apex as shown in example below

Note: Test_Template is the sample flex template created and Lead is the object associated with it.

                                       

public class PromptTemplateController {
    public static void callPromptTemplate() {
        Map<String, String> property = new Map<String, String>();
        List<Lead> lstLead = [Select id,name from Lead];
        property.put('id', lstLead[0].id); // parameters to the prompt template
        ConnectApi.WrappedValue propertyValue = new ConnectApi.WrappedValue();
        propertyValue.value = property;
        Map<String, ConnectApi.WrappedValue> inputParams = new Map<String, ConnectApi.WrappedValue>();
        inputParams.put('Input:Lead', propertyValue); // Property is the API Name we gave to the input
        
        ConnectApi.EinsteinPromptTemplateGenerationsInput executeTemplateInput = new ConnectApi.EinsteinPromptTemplateGenerationsInput();
        executeTemplateInput.additionalConfig = new ConnectApi.EinsteinLlmAdditionalConfigInput();
        executeTemplateInput.additionalConfig.applicationName = 'PromptBuilderPreview';
        executeTemplateInput.isPreview = false;
        executeTemplateInput.inputParams = inputParams; 
        String promptTemplateName = 'Test_Template'; //prompt template api name
        
        ConnectApi.EinsteinPromptTemplateGenerationsRepresentation generationsOutput = ConnectApi.EinsteinLLM.generateMessagesForPromptTemplate(
            promptTemplateName,
            executeTemplateInput
        );
        if(generationsOutput != null && generationsOutput.generations != null){
            ConnectApi.EinsteinLLMGenerationItemOutput response = generationsOutput.generations[0]; 
            String res = response.text;
            System.debug('Response:::'+res);
        }
    }
}

call the method from the Developer console using the code below
PromptTemplateController.callPromptTemplate();

Output:



Send an email using apex class salesforce

 

Solution: Use sendEmail method as shown in the example below

public class EmailController {
    public static void sendEmail() {
        List<String> lstToAddress = new List<String>();
        lstToAddress.add(UserInfo.getUserEmail()); //Add email to whom email needs to be sent
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setToAddresses(lstToAddress);
        email.setSubject('Test Email'); // Give subject of the Email
        String body='Email Content'; // content of the email
        email.setPlainTextBody(body);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[]{email});
        System.debug('Email Sent');
    }
}

Call the method from developer console using below code
EmailController.sendEmail();

Output: