You need to sign in to do that
Don't have an account?

I want Lead Title should be mapped to Opportunity Name on conversion of lead.

"Looks like something went wrong, please try again later." while trying to Check Challenge on Superbadge unit
I try to check 3. challenge in User Authentication Setting Superbadge Unit and receive an error:
https://trailhead.salesforce.com/content/learn/superbadges/superbadge-user-authentication-settings



Trailhead Help (https://trailhead.salesforce.com/en/help?support=home)can provide assistance for situations where Trailhead does not appear to be functioning correctly. You can reach out to them if this is the case.
If this information helps, please mark the answer as best. Thank you

Lightning-input-rich-text custom type for Lightning Datatable
Hello everyone,
I am trying to add lightning-input-rich-text component as editTemplate for the cell of richtextarea custom type but constantly receiving engine error.
The one when I am trying to type any value
Uncaught TypeError: this.concreteComponent.showHelpMessageIfInvalid is not a function
throws at https://sparks--test--c.sandbox.vf.force.com/components/lightning/primitiveDatatableIeditTypeFactory.js:1:4612
The the other one when I click outside the rich-text-input component
Uncaught TypeError: Cannot read properties of undefined (reading 'valid') throws at https://sparks--test--c.sandbox.vf.force.com/auraFW/javascript/wyQWsVjjDIx-Xsqekbsbwg/aura_prod.js:13:40835
The code for the edit template (richTextAreaEditTmpl.html):
<template> <lightning-input-rich-text value={editedValue} data-inputable="true" > </lightning-input-rich-text> </template>
Custom type definition in customDatatable.js
richtextarea: { template: richTextAreaTmpl, editTemplate: richTextAreaEditTmpl, standardCellLayout: true, typeAttributes: [] }
Are rich text areas supported by datatable at all?
Thanks for help




Yes, rich text areas are supported in Lightning web components, including the lightning-input-rich-text component. However, there might be an issue with your implementation that is causing the errors you mentioned.
But the lightning-input-rich-text component is not directly supported as an edit type for the datatable. The supported edit types for the datatable include text, number, date, picklist, and checkbox.
For further reference and solution how to achieve this , i would request you to go through this discussion and let me know further -> https://salesforce.stackexchange.com/questions/274594/need-help-with-custom-types-in-lightning-datatable-lwc
If this helps , please mark this as Best Answer.
Thank you.


Parent Component.cmp
<aura:component>
<!-- Parent Component -->
<aura:attribute name="documents" type="List" default="[]" />
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<h2>Documents</h2>
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
<thead>
<tr class="slds-text-title_caps">
<th scope="col">Name</th>
<th scope="col">Type</th>
</tr>
</thead>
<tbody>
<c:ChildDocumentComponent documents="{!v.documents}" />
</tbody>
</table>
</aura:component>
parent component js file
({
init: function(component, event, helper) {
// Fetch the documents data here from an Apex controller or a data service
var documents = [
{ Name: 'Document 1', Type: 'Type 1' },
{ Name: 'Document 2', Type: 'Type 2' },
{ Name: 'Document 3', Type: 'Type 3' }
];
component.set("v.documents", documents);
}
})
Childcomponent.cmp
<aura:component>
<!-- Child Component -->
<aura:attribute name="documents" type="List" default="[]" />
<aura:iteration items="{!v.documents}" var="doc">
<tr>
<td>{!doc.Name}</td>
<td>{!doc.Type}</td>
</tr>
</aura:iteration>
</aura:component>
Thanks👍🏻

Custom Metadata Type Records Mass Insert Issues
Sfdx force:cmdt:record:insert --filepath /Desktop/test.csv --typename test__mdt --inputdir /Documents/main/default/objects --outputdir /Users/4530206/Documents/main/default/customMetadata
test_mdt has two fields: "text__c" and "num__c"
test.csv has three columns: "Name", "text__c", "num__c"




https://salesforce.stackexchange.com/questions/328317/unable-to-insert-custom-metadata-records-with-cmdt-command
https://help.salesforce.com/s/articleView?id=sf.custommetadatatypes_cli.htm&type=5
Also I found some known issue around Metadata Relationship below.
https://github.com/forcedotcom/cli/issues/544
Please mark as Best Answer if above information was helpful.
Thanks,

Hi Team Help me to resolve this
Lead Status (Open - Not Contacted)
If the lead is still in the same condition (Open - Not Contacted) after 4 hours of lead creation, an email has to be sent to the owner of the lead and the manager of the owner in CC.
The below code works for sending emails to lead owner if he is an individual owner (sending Cc mail to Manager), same like that if lead owner is queue it is sending only to user mail not user's Cc manager.
should now send emails to individual owners, CC their managers, and all users in queues, including the CC to queue user managers.
Plz Provide solution.
public class LeadClass implements Database.Batchable<SObject> { // Start method for the batch job public Database.QueryLocator start(Database.BatchableContext context) { // Calculate the datetime four hours ago DateTime fourHoursAgo = DateTime.now().addHours(-4); // Retrieve the leads that meet the criteria return Database.getQueryLocator([ SELECT Id, OwnerId, Owner.Email, Owner.Type, CreatedDate FROM Lead WHERE Status = 'Open - Not Contacted' AND CreatedDate >= :fourHoursAgo ]); } // Execute method for processing the batch public void execute(Database.BatchableContext context, List<Lead> scope) { // Create a map to store email messages Map<Id, Messaging.SingleEmailMessage> emailMap = new Map<Id, Messaging.SingleEmailMessage>(); // Create a set to store owner IDs Set<Id> ownerIds = new Set<Id>(); // Create a set to store queue IDs Set<Id> queueIds = new Set<Id>(); // Iterate over the leads in the current batch for (Lead lead : scope) { if (lead.Owner.Type == 'User') { // Add the lead's owner ID to the set of owner IDs ownerIds.add(lead.OwnerId); } else if (lead.Owner.Type == 'Queue') { // Add the lead's owner ID to the set of queue IDs queueIds.add(lead.OwnerId); } } // Query the owners and their details using the owner IDs Map<Id, User> ownerMap = new Map<Id, User>([ SELECT Id, Name, Email, ManagerId FROM User WHERE Id IN :ownerIds ]); // Create a set to store manager IDs Set<Id> managerIds = new Set<Id>(); // Iterate over the owner records to collect manager IDs for (User owner : ownerMap.values()) { if (owner.ManagerId != null) { // Add the owner's manager ID to the set of manager IDs managerIds.add(owner.ManagerId); } } // Query the managers and their details using the manager IDs Map<Id, User> managerMap = new Map<Id, User>([ SELECT Id, Name, Email FROM User WHERE Id IN :managerIds ]); // Iterate over the leads in the current batch for (Lead lead : scope) { if (lead.Owner.Type == 'User') { // Retrieve the lead's owner from the ownerMap User owner = ownerMap.get(lead.OwnerId); // Create an email message Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); // Set the recipient (owner's email address) email.setToAddresses(new List<String>{ owner.Email }); // Add owner's manager's email to cc recipients if available if (owner.ManagerId != null && managerMap.containsKey(owner.ManagerId)) { User manager = managerMap.get(owner.ManagerId); if (manager != null && !String.isBlank(manager.Email)) { email.setCcAddresses(new List<String>{ manager.Email }); } } // Set the email subject and body email.setSubject('Lead Still not actioned upon'); email.setPlainTextBody('Dear ' + owner.Name + ',\n\n' + 'This is a notification regarding the lead with the status "Open - Not Contacted" that was created within the last 4 hours.\n\n' + 'Lead Record: ' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + lead.Id + '\n\n' + 'Thank you.\n\n' + 'Best Regards,\n' + 'Your Company'); // Add the email message to the map using the lead's owner ID as the key emailMap.put(lead.OwnerId, email); } else if (lead.Owner.Type == 'Queue') { // Retrieve the queue users associated with the lead's queue List<User> queueUsers = [SELECT Id, Name, Email, ManagerId FROM User WHERE Id IN (SELECT UserOrGroupId FROM GroupMember WHERE GroupId = :lead.OwnerId)]; // Iterate over the queue users for (User queueUser : queueUsers) { // Create an email message Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); // Set the recipient (queue user's email address) email.setToAddresses(new List<String>{ queueUser.Email }); // Add queue user's manager's email to cc recipients if available if (queueUser.ManagerId != null && managerMap.containsKey(queueUser.ManagerId)) { User manager = managerMap.get(queueUser.ManagerId); if (manager != null && !String.isBlank(manager.Email)) { email.setCcAddresses(new List<String>{ manager.Email }); } } // Set the email subject and body email.setSubject('Lead Still not actioned upon'); email.setPlainTextBody('Dear ' + queueUser.Name + ',\n\n' + 'This is a notification regarding the lead with the status "Open - Not Contacted" that was created within the last 4 hours.\n\n' + 'Lead Record: ' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + lead.Id + '\n\n' + 'Thank you.\n\n' + 'Best Regards,\n' + 'Your Company'); // Add the email message to the map using the queue user's ID as the key emailMap.put(queueUser.Id, email); // CC the manager of the queue user if available if (queueUser.ManagerId != null && managerMap.containsKey(queueUser.ManagerId)) { User manager = managerMap.get(queueUser.ManagerId); if (manager != null && !String.isBlank(manager.Email)) { emailMap.get(queueUser.Id).setCcAddresses(new List<String>{ manager.Email }); } } } } } // Send the email messages Messaging.sendEmail(emailMap.values()); } // Finish method for post-processing after the batch job finishes public void finish(Database.BatchableContext context) { // Do any post-processing after the batch job finishes } }


I have made changes to your code, tried simplifying it, and followed the best practice.
In your code, there is SOQL in the loop which is against the best practice. I have commented on the code
Here is the code
public class LeadClass implements Database.Batchable<SObject> { // Start method for the batch job public Database.QueryLocator start(Database.BatchableContext context) { // Calculate the datetime four hours ago DateTime fourHoursAgo = DateTime.now().addHours(-4); // Retrieve the leads that meet the criteria return Database.getQueryLocator([ SELECT Id, OwnerId, Owner.Email, Owner.Type, CreatedDate FROM Lead WHERE Status = 'Open - Not Contacted' AND CreatedDate >= :fourHoursAgo ]); } // Execute method for processing the batch public void execute(Database.BatchableContext context, List<Lead> scope) { // Create a map to store email messages Map<Id, Messaging.SingleEmailMessage> emailMap = new Map<Id, Messaging.SingleEmailMessage>(); // Create a set to store owner IDs Set<Id> ownerIds = new Set<Id>(); // Create a set to store queue IDs Set<Id> queueIds = new Set<Id>(); // Create a map to store List of Owner for every lead Map<Id, List<Id>> idLeadidUsersMap = new Map<Id, List<Id>>(); // Iterate over the leads in the current batch for (Lead lead : scope) { if (lead.Owner.Type == 'User') { // Add the lead's owner ID to the set of owner IDs ownerIds.add(lead.OwnerId); idLeadidUsersMap.put(lead.Id, new List<Id>{lead.OwnerId}); } else if (lead.Owner.Type == 'Queue') { // Add the lead's owner ID to the set of queue IDs queueIds.add(lead.OwnerId); } } // create map to store list of Queue users by Queue Id Map<Id, List<Id>> idMap = new Map<Id, List<Id>>(); // create map of Group Member of the Queue Id Map<Id, GroupMember> memberMap = new Map<Id, GroupMember>([SELECT UserOrGroupId, GroupId FROM GroupMember WHERE GroupId = :queueIds]); // iterate over Group Member to create Map list of Users in Queue for(GroupMember member : memberMap.values()) { ownerIds.add(member.UserOrGroupId); List<Id> tempList = new List<Id>{member.UserOrGroupId}; if(idMap.containsKey(member.GroupId)) { tempList = idMap.get(member.GroupId); tempList.add(member.UserOrGroupId); } idMap.put(member.GroupId, tempList); } // iterate over lead records collect list of users per lead for (Lead lead : scope) { if(lead.Owner.Type == 'Queue' && idMap != null && idMap.get(lead.OwnerId) != null) { idLeadidUsersMap.put(lead.Id, idMap.get(lead.OwnerId)); } } // Query the owners and their details using the owner IDs Map<Id, User> ownerMap = new Map<Id, User>([ SELECT Id, Name, Email, ManagerId FROM User WHERE Id IN :ownerIds ]); // Create a set to store manager IDs Set<Id> managerIds = new Set<Id>(); // Iterate over the owner records to collect manager IDs for (User owner : ownerMap.values()) { system.debug('User : ' + owner.ManagerId); if (owner.ManagerId != null) { // Add the owner's manager ID to the set of manager IDs managerIds.add(owner.ManagerId); } } // Query the managers and their details using the manager IDs Map<Id, User> managerMap = new Map<Id, User>([ SELECT Id, Name, Email FROM User WHERE Id IN :managerIds ]); for(Lead lead : scope) { for(Id iduser : idLeadidUsersMap.get(lead.Id)) { // Retrieve the lead's owner from the ownerMap User owner = ownerMap.get(idUser); system.debug('lead Id : ' + lead.Id + ' -- owner : ' + owner.Id + ' -- Manage : ' + owner.ManagerId); // Create an email message Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); // Set the recipient (owner's email address) email.setToAddresses(new List<String>{ owner.Email }); // Add owner's manager's email to cc recipients if available if (owner.ManagerId != null && managerMap.containsKey(owner.ManagerId)) { User manager = managerMap.get(owner.ManagerId); if (manager != null && !String.isBlank(manager.Email)) { email.setCcAddresses(new List<String>{ manager.Email }); system.debug('email.setCcAddresses'); } } // Set the email subject and body email.setSubject('Lead Still not actioned upon'); email.setPlainTextBody('Dear ' + owner.Name + ',\n\n' + 'This is a notification regarding the lead with the status "Open - Not Contacted" that was created within the last 4 hours.\n\n' + 'Lead Record: ' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + lead.Id + '\n\n' + 'Thank you.\n\n' + 'Best Regards,\n' + 'Your Company'); // Add the email message to the map using the lead's owner ID as the key emailMap.put(lead.OwnerId, email); } } // Iterate over the leads in the current batch /* for (Lead lead : scope) { if (lead.Owner.Type == 'User') { // Retrieve the lead's owner from the ownerMap User owner = ownerMap.get(lead.OwnerId); // Create an email message Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); // Set the recipient (owner's email address) email.setToAddresses(new List<String>{ owner.Email }); // Add owner's manager's email to cc recipients if available if (owner.ManagerId != null && managerMap.containsKey(owner.ManagerId)) { User manager = managerMap.get(owner.ManagerId); if (manager != null && !String.isBlank(manager.Email)) { email.setCcAddresses(new List<String>{ manager.Email }); } } // Set the email subject and body email.setSubject('Lead Still not actioned upon'); email.setPlainTextBody('Dear ' + owner.Name + ',\n\n' + 'This is a notification regarding the lead with the status "Open - Not Contacted" that was created within the last 4 hours.\n\n' + 'Lead Record: ' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + lead.Id + '\n\n' + 'Thank you.\n\n' + 'Best Regards,\n' + 'Your Company'); // Add the email message to the map using the lead's owner ID as the key emailMap.put(lead.OwnerId, email); } else if (lead.Owner.Type == 'Queue') { // Retrieve the queue users associated with the lead's queue List<User> queueUsers = [SELECT Id, Name, Email, ManagerId FROM User WHERE Id IN (SELECT UserOrGroupId FROM GroupMember WHERE GroupId = :lead.OwnerId)]; // Iterate over the queue users for (User queueUser : queueUsers) { // Create an email message Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); // Set the recipient (queue user's email address) email.setToAddresses(new List<String>{ queueUser.Email }); // Add queue user's manager's email to cc recipients if available if (queueUser.ManagerId != null && managerMap.containsKey(queueUser.ManagerId)) { User manager = managerMap.get(queueUser.ManagerId); if (manager != null && !String.isBlank(manager.Email)) { email.setCcAddresses(new List<String>{ manager.Email }); } } // Set the email subject and body email.setSubject('Lead Still not actioned upon'); email.setPlainTextBody('Dear ' + queueUser.Name + ',\n\n' + 'This is a notification regarding the lead with the status "Open - Not Contacted" that was created within the last 4 hours.\n\n' + 'Lead Record: ' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + lead.Id + '\n\n' + 'Thank you.\n\n' + 'Best Regards,\n' + 'Your Company'); // Add the email message to the map using the queue user's ID as the key emailMap.put(queueUser.Id, email); // CC the manager of the queue user if available if (queueUser.ManagerId != null && managerMap.containsKey(queueUser.ManagerId)) { User manager = managerMap.get(queueUser.ManagerId); if (manager != null && !String.isBlank(manager.Email)) { emailMap.get(queueUser.Id).setCcAddresses(new List<String>{ manager.Email }); } } } } } */ // Send the email messages Messaging.sendEmail(emailMap.values()); } // Finish method for post-processing after the batch job finishes public void finish(Database.BatchableContext context) { // Do any post-processing after the batch job finishes } }
I hope this also fixes your issue.
Regards,
Abdul Aziz Khatri

how to set up discussion forums on our salesforce community
We would like our customers to be able to have discussions based on our own products?



You can enable "Allow discussion threads" as mentioned in
https://help.salesforce.com/s/articleView?id=sf.networks_chatter_threaded_discussions_enable.htm&type=5
Also see https://salesforce.stackexchange.com/questions/375093/adding-a-forum-to-an-existing-experience-cloud-site
https://salesforce.stackexchange.com/questions/107645/is-it-possible-to-create-a-user-forum-in-communities
If this information helps, please mark the answer as best. Thank you


Hi Sonali,
To display an image in an Aura component using a static resource, you can follow these steps:
1. Upload the image to a Static Resource:
- Go to Setup in your Salesforce org.
- In the Quick Find box, search for "Static Resources".
- Click on "Static Resources" under the "Develop" section.
- Click on the "New Static Resource" button.
- Enter a name for the static resource (e.g., "MyImage").
- Choose the image file from your local system by clicking on "Choose File" or dragging and dropping the file.
- Click "Save" to upload the image as a static resource.
- Create or open the Aura component file (e.g., MyComponent.cmp).
- Inside the component markup, add an `<img>` tag to display the image.
- Set the `src` attribute of the `<img>` tag to the URL of the static resource.
<aura:component> <img src="{!$Resource.MyImage}" alt="My Image" /> </aura:component>
3. Save and deploy the Aura component:
Hope this will be Helpful.
Thanks!

I have a requirement i need to add couple of columns in Recently viewed cases list view
Please help me




Try below steps.
- From Setup, at the top of the page, select Object Manager.
- Click the label name of the object for the Recently Viewed list you want to modify.
- From the menu of links at the top of the page, click Search Layouts.
- In the far right of the Search Results row, click and select Edit.
- Recently viewed lists use the Search Results search layout in Lightning. In Classic, recently viewed lists use the Tab search layout.
- To add columns to the Recently Viewed list, select one or more fields from Available Fields and click Add. To remove columns, select one or more fields from Selected Fields and click Remove.
- Order columns by selecting one or more fields from Selected Fields and clicking Up or Down.
- Click Save.
Please mark as Best Answer if above information was helpful.
Thanks,

Compare two values from a picklist
the picklist is Customer, Prospect, Competitor
I want to do this with a row level formula for example
If company 1 = TRUE, and company 2 = TRUE it is Company 1 and 2
if comapny 1 = TRUE and company 3 = TRUE it is Comapny 1 and 3
if comapny 2 = TRUE and company 3 = TRUE it is Company 2 and 3




To compare the number of customer accounts between three companies and generate a row-level formula, you can use a combination of logical conditions and formula fields. Here's an example of how you can achieve this:
Please use this below formula for the same :
IF( ISPICKVAL(Company1_c, "Customer") && ISPICKVAL(Company2c, "Customer") && ISPICKVAL(Company3_c, "Customer"), "Company 1, 2, and 3", IF( ISPICKVAL(Company1_c, "Customer") && ISPICKVAL(Company2_c, "Customer"), "Company 1 and 2", IF( ISPICKVAL(Company1_c, "Customer") && ISPICKVAL(Company3_c, "Customer"), "Company 1 and 3", IF( ISPICKVAL(Company2_c, "Customer") && ISPICKVAL(Company3_c, "Customer"), "Company 2 and 3", "" ) ) ) )Replace Company1_c, Company2c, and Company3_c with the actual API names of the picklist fields representing the three companies.
If this helps , please mark this as Best Answer.
Thank you.
Can you try with the below trigger and let me know further : In this trigger, we first check if the lead has been converted by verifying the IsConverted field. We iterate over the updated leads in the trigger context and identify the leads that have been converted for the first time.
Next, we query for the opportunities associated with the converted leads using the LeadId field. We store the converted opportunities in a map using the lead IDs as the keys.
Then, we iterate over the converted leads and retrieve the corresponding opportunity from the map. If the opportunity exists and the lead has a non-null title, we update the opportunity's name with the lead's title and add it to the opportunitiesToUpdate list.
Finally, if there are opportunities to update, we perform the update using the update DML statement.
If this helps , please mark this as Best Answer.
Thank you.