• Naveen KN
  • SMARTIE
  • 792 Points
  • Member since 2017
  • Salesforce Consultant
  • IBM


  • Chatter
    Feed
  • 25
    Best Answers
  • 0
    Likes Received
  • 6
    Likes Given
  • 1
    Questions
  • 365
    Replies
We had a vendor create a Aura component to insert an iFrame into one of our community pages to allow an end user to upload attachments.  This is not working because we need to be using ".secure.fore.com" in the URL.  It is getting the URL like this:  "cmp.get('c.getFileUploadSiteURL');  But in the cmp file I do not see "getFileUploadSiteUrl", so I am trying to understand where this field is coming from???
Hi Everyone,

I have JSON data. I wish to store this JSON data in my custom object field.
Is this possible in salesforce? Any idea?
Thanks in Advance.
how to send list<strings> from parent component  to child component  using aura attribute in lightning
 (note : I dont want aura methods or events ) 
I have an issue with lightning bottom menu item's that is within a data table whereby the menu items are not visible if the menu item appears as the last record of the data table (see the 2nd image) or if the data table consists of only 1 record (see the last image). Below is the sample code of the data table with the lightning button menu

Sample Code
<div class="slds-table--header-fixed_container" style="height: 100%">
        <div class="slds-card__body slds-card__body_inner slds-scrollable--y" style="height: 100%">
    
            <table class="slds-table slds-table--bordered slds-table--header-fixed">
                <thead>
                <tr class="slds-text-title--caps">
                    <aura:iteration items="{!v.columns}" var="col">
                        <th scope="col">
                            <div onclick="{!c.updateColumnSorting}"
                                 class="slds-truncate slds-cell-fixed"
                                 title="{! col.fieldName}" data-field="{! col.fieldName}">
                                {! col.label }
                                <span>
                                    <aura:if isTrue="{!v.sortedBy == col.fieldName}">
                                            {! v.sortAsc ? '&#8593;' : '&#8595;'}
                                    </aura:if>
                                </span>
                            </div>
                        </th>
                    </aura:iteration>
                    <th scope="col"></th>
                </tr>
                </thead>
                <tbody>
                <aura:iteration items="{!v.data}"
                                var="record" indexVar="indexVar">
                    <tr>
                        <th data-label="Title" class="{! 'popover_'+record.Id +' cell-solution-title-width'}">
                            <div class="slds-truncate cell-solution-title-width" title="{!record.Solution_Title__c}"
                                 data-recordid="{!record.Id}" data-record="{! record}">
                                {!record.Solution_Title__c}
                            </div>
                        </th>
                        <th data-label="Category" class="{! 'popover_'+record.Id +' cell-solution-number-width'}">
                            <div class="slds-truncate cell-solution-number-width" title="{! record.Solution_Sub_Category__c}"
                                 data-recordid="{!record.Id}" data-record="{! record.Solution_Sub_Category__c}">
                                {! record.Solution_Sub_Category__c}
                            </div>
                        </th>
                        <th data-label="Status" class="{! 'popover_'+record.Id}">
                            <div class="slds-truncate" title="{!record.Status__c}"
                                 data-recordid="{!record.Id}" data-record="{! record}">
                                {!record.Status__c}
                            </div>
                        </th>
                        <th data-label="Author" class="{! 'popover_'+record.Id}">
                            <div class="slds-truncate" title="{!record.CreatedBy.Name}"
                                 data-recordid="{!record.Id}" data-record="{! record}">
                                {!record.CreatedBy.Name}
                            </div>
                        </th>
                        <th>
                            <lightning:buttonMenu aura:id="menu" onselect="{! c.handleSelect }"
                                                  alternativeText="Menu" value="{!record.Id}" menuAlignment="right">
                                <lightning:menuItem value="{! 'E,'+record.Id +','+indexVar}" label="Edit"/>
                                <lightning:menuItem value="{! 'A,'+record.Id +','+indexVar}" label="Approve"/>
                            </lightning:buttonMenu>
                        </th>
                    </tr>
                </aura:iteration>
                </tbody>
            </table>
    
        </div>
    </div>

User-added image
User-added imageUser-added image
Hi 
Greetings of the day...

I am designing a Lightning component using Developer console and on adding it to Lightning App Builder, I am not finding any custom tab to add my component to the Lightning page.


User-added image


Plz. help us to add a lightning component in the custom section.
Hi, 

I'm a green Salesforce Admin.

I'm trying to close this Booking (Opportunity) by changing the stage fom 'Closed Won' to 'Closed', but gettign the error: 

Object (id = 0060I00000dElwv) is currently in trigger OpportunityTrigger, therefore it cannot recursively update itself

I can see the Apex Trigger in the Object Manager, but I don't have any experience with development, so I can;t tell why this error is occuring. 

 
Hi Team,

In my project i have the urgent requirement.

At the lookup Field we have an option to create New Record in Lightning View.  
Creating the New Record at Look-Up Field is a Standard Salesforce Out of the box functionality.
1)How can i restrict the user while trying to create the Record at Look-Up in lightning View ?

FYI:

User-added imageThanks in Advance...

Thanks,
Venkat.
I am trying to create a view to show activity information. However the below code is not displaying any information, only header is showing. Please help.
HTML Component :

<template>
    <lightning-card class="slds-text-title_bold"  title = "Activity Information">
        <div class="slds-p-around_medium lgc-bg" style="height: 300px;">
            <lightning-datatable
                    key-field="id"
                    data={data}
                    columns={columns}>
            </lightning-datatable>
        </div>
    </lightning-card>
</template>
 
JS File:

import { LightningElement,api,wire,track} from 'lwc';
import ActivitySearchController from '@salesforce/apex/ActivityLeadPage.ActivitySearchController'

const columns = [
    { label: 'Subject', fieldName: 'Subject' },
    { label: 'Due Date', fieldName: 'ActivityDate' },
    { label: 'Status', fieldName: 'Status' },
];

export default class ActivityLeadPageComponent extends LightningElement {
    @api recordId;
    @track data = [];
    @track columns = columns;
    @wire(ActivitySearchController, { currentID: '$recordID'})
    TaskList;
}
 
Controller :

public class ActivityLeadPage{
    
    @AuraEnabled(cacheable=true)
    public static List<Task> ActivitySearchController(String currentID){
        List<Task> TaskList = new List<Task>();
        Map<Id,Lead> leadMap = new Map<Id,Lead>();
        if(currentID.startsWith('00Q')){
            try{
                List <Lead> leadList = [SELECT id, Email FROM Lead WHERE ID=:currentId];
                String ldEmail       = leadList[0].Email;
                Set<String> emailIds = new Set<string>();
                if(ldEmail!=null){
                    emailIds.add(ldEmail);
                }               
                
                TaskList = getTaskList(emailIds);
                
            }           
            catch(Exception e){
                system.debug('getlinenumber-->'+ e.getMessage() +' line '+ e.getLineNumber());
            } 
        }
        return TaskList;
    }
    
    public static List<Task> getTaskList (Set<String> emailIds) {  
        Map<Id,Lead> leadMap = new Map<Id,Lead>();      
        leadMap = new Map<Id,Lead>([SELECT id, Email FROM Lead Where Email IN:emailIds]);       
        
        Set<Id> leadID = new Set<Id>(); 
        for(Lead lE : leadMap.values()){
            leadID.add(lE.id);            
        }  
        
        List<Task> TaskList = [Select id, Subject, Description, who.Type, What.Type, Priority, Status, ActivityDate,CreatedDate, LastModifiedDate FROM Task 
                               WHERE whoId IN:leadID ORDER BY createddate DESC LIMIT 20];
        
        if(TaskList.size() == 0){
            Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,''+'No Tasks to Display'));
        }
        
        return TaskList;
    }   
}
What should i do with this error? Does not let me send quotes by email from the PDF page of the quote...
 
Hi All,

I have created a lightning component to display a public site from which we can get customers sigup.
I have created the Lightning component for this and able to view the page but, I am unable to fire the toast messages in this.
And also my Save button is not getting disabled after clicking on it. 
This is my code. Any help to solve this is appreciated. Thanks in advance.
Lightning component:
<aura:component controller="CreateContactrecordController" 
implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:lightningQuickAction,
            flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,lightning:isUrlAddressable,
            lightning:actionOverride,force:hasRecordId"
             access="global" >
    <!-- Include Static Resource-->
    <ltng:require styles="/resource/bootstrap/css/bootstrap.min.css" 
scripts="/resource/bootstrap/js/jquery.js,/resource/bootstrap/js/bootstrap.min.js"/>
    <!--aura:attribute name="isSpinner" type="boolean" default="false"/-->
    <aura:attribute name="FirstName" type="String" default="" />
    <aura:attribute name="LastName" type="String" default="" />
    <aura:attribute name="Mobile" type="String" default="" />
    <aura:attribute name="Email" type="String" default="" /> 
    <aura:attribute name="Store" type="String" />
    <aura:attribute name="LanguageList" type="List" />
    <aura:attribute name="SelectedLanguage" type="String" />
    <aura:attribute name="isHide" type="Boolean" default="false" />
    
     <aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.handleSaveSuccess}"/>
 <force:recordEdit aura:id="edit" recordId=""/>
 <ui:button label="Save" press="{!c.save}"/>
    
    <div class="slds-page-header">
        <div class="slds-align_absolute-center">
            <div class="slds-text-heading_large">
                <div class="slds-m-top_xx-large">
                    Customer Subscription Form
                </div>
            </div>
        </div>
    </div>
    <br/>
    <aura:handler name="init" action="{!c.doinIt}" value="{!this}"/> 
    <div class="slds-form-element__control">
         <lightning:input label="First Name" name="firstname" type="text" required="true" value="{!v.FirstName}" />
        <br/>
        <lightning:input label="Last Name" name="lastname" type="text" required="true" value="{!v.LastName}" />
        <br/>
        <lightning:input label="Mobile" type="tel" value="{!v.Mobile}"/>
        <br/>
        <lightning:input label="Email" name="email" type="email" required="true" value="{!v.Email}" />
        <br/> 
        <lightning:input label="Store" type="Text" name="Store" value="{!v.Store}" />
        <br/> 
        <lightning:select label="Language" name="Language" value="{!v.SelectedLanguage}">
            <aura:iteration items="{!v.LanguageList}" var="Language">
                <option value="{!Language}" text="{!Language}"></option>
            </aura:iteration>
        </lightning:select>
        <br/>
   <lightning:button variant="brand" disabled="{!v.isHide}" label="{!v.isHide == true ? 'Save' : 'Save'}" onclick="{!c.savecustomerForm}" /> 
    <!--lightning:button variant="brand" disabled="{!v.isSpinner}" label="{!v.isSpinner == true ? 'Saving...' : 'Save'}" onclick="{!c.savecustomerForm}" /--> 

    </div>       
</aura:component>

Controller.js:

({
    doinIt: function(component, event, helper){ 
        var action = component.get('c.getPickListValuesIntoList');          
         // method name i.e. getEntity should be same as defined in apex class         
         // params name i.e. entityType should be same as defined in getEntity method        
        //action.setParams({ "entityType" : component.get('v.componentString') });         
            action.setCallback(this, function(a){             
            var state = a.getState(); // get the response state             
            if(state == 'SUCCESS') {
               component.set('v.LanguageList',a.getReturnValue()); 
            }        
            });         
            $A.enqueueAction(action); 
    },
     savecustomerForm: function(component, event, helper) {
        console.log('Create record');
         var action = component.get("c.save");
        //Setting the Apex Parameter
         action.setParams({"FirstName":component.get("v.FirstName"), "LastName":component.get("v.LastName"),
                           "Email":component.get("v.Email"), "Mobile":component.get("v.Mobile"), 
                           "Store":component.get("v.Store"), "Language":component.get("v.Language")
            });
        //Setting the Callback
        action.setCallback(this,function(a){
            //get the response state
            var state = a.getState();
            var isContactexists = a.getReturnValue();
            //check if result is successfull
           
            if(state == "SUCCESS"){
                //Reset Form
                var newContact = {'sobjectType': 'Contact','FirstName': '','LastName': '','Email': '',
                                  'Mobile': '', 'Store__C': '','Language__c' : ''};
                //resetting the Values in the form
                component.set("v.Contact",newContact);
                if(isContactexists===true){
              //alert('Record Created Successfully');
                    component.find("edit").get("e.recordSave").fireeSuccess : function(cmp, event) {
                     // Display the save status
                     var toastEvent = $A.get("e.force:showToast");
                     toastEvent.setParams({
                     "title": "true!",
                     "message": "My Custom Record Saved Successfully"
 });
 toastEvent.fire();
                    }
                    
                component.set('v.isHide', true);  
                }
                else { 
                   alert('Record already exists'); 
                   
                }
            }
            else if(state == "ERROR"){
            alert('Error in calling server side action');
           
            }
            
        });
                
         $A.enqueueAction(action);}

})

Apex controller:

public class CreateContactrecordController {
@AuraEnabled
     public static List<String> getPickListValuesIntoList()
     {
       List<String> pickListValuesList= new List<String>();
        Schema.DescribeFieldResult fieldResult = Contact.Language__C.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry pickListVal : ple){
            pickListValuesList.add(pickListVal.getLabel());
        }    
        return pickListValuesList;
    }
 @AuraEnabled   
    public static Boolean save(String FirstName, String LastName, String Email, String Mobile, String Store, String Language )
    {
        List<Contact> Contact = [SELECT Id, Email From Contact WHERE Email=:Email];
         if(contact.size() > 0){
             return false;
        }else{
            Contact con=new Contact(); 
            con.FirstName = FirstName;
            con.LastName = LastName;
            con.Email = Email;
            con.MobilePhone = Mobile;
            con.Store__c = Store;
            con.Language__c = Language;
            insert con;
            return true;
        }
    }
    }
 
Hi Community!

So I made a flow for closing a feedback case that works as a standard lightning component. However, when I put the flow in as part of a guided action list. The flow runs but doesn't update anything.

I noticed that this iw why the standard version works is because of this check mark where I pass my feedbackcaseID variable as the recordID:

User-added image

What would be the best way to grab the current record ID in my flow so that I can run it through the guided action list?

More than happy to attach screenshots of my current flow if that helps.

Thank you all this would be amazing if I can get this solved!!

 
trigger Prefix_Dr on Lead (before insert,before update) {
    for(lead L:trigger.new){
       L.FirstName='Dr.'+L.FirstName;
        }
}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@istest
public class Prefix_Dr_test {
    testmethod static void test(){
        Lead L=New Lead();
        L.FirstName='Dr.Midul';
        L.LastName='ahmed';
        L.Company='sfdc';
        L.Status='Working-contacted'; 
        insert L;
        
        Lead Le=[select Id,firstname,lastname from lead where company='sfdc'];
       System.assertEquals(Le.FirstName.ContainsIgnoreCase('Dr.'),'Dr.');
           
    }


here test class is showing error
Has anyone got simple examples of where they were able to add a 3rd column to a section in Lightning? 
 
What is the difference between Salesforce Lightning and Classic.

Guys I have joined a startup coming which is asking me to learn Salesforce and start working on it. As I have learned Java and have also worked in a small firm for 1 year on Java. Now should I start learning Salesforce or look for other job in Java. Is learning Salesforce worth for long run or should I get expertise in java
Hi all,

I would like to implement component having a background color change feature.
I tried to get some information on how to change CSS using Lightning Component controller, I couldn't get much about it.
Please advise me if you have any idea to solve this.

Thanks for your help in advance.

Component :
<aura:component>
<div>
        <lightning:input type="color" label="Color" name="color" value="" onchange="{!c.colorChanger}" aura:id="color"/>
</div>
</aura:component>
Controller :
({
	colorChanger : function(component, event, helper) {
		var color = component.find("color").get("v.value");
        this.css({"background" : color})
    }
})
*tried this.style.background = color;
 
We have a custom lightning component that takes advantage of an external stylesheet (stored in the static resources).

It is included with 
<ltng:require styles="{! $Resource.STYLESHEETNAMEHERE}"/>

My thinking is that the developer adds a sort of 'onExit' handler to unlink the file, but I can't find any documentation for unloading a static resource, or I could be completely wrong and it just be a caching issue

The issue is that some of the styles in that external resource are being carried over to other components that don't explicitly include the file
How can we tackle this?

A screen recording of the issue
  • Open a default modal (FINE)
  • Open a custom component that includes the CSS file named 'fullModalBypass.css'
  • Re-open the first modal, the modal contains the CSS file that was included in the component of the previous step
This page has an error. You might just need to refresh it. Action failed: c:csvSample$controller$loadContactList [component is not defined] Failing descriptor: {c:csvSample$controller$loadContactList}

can we call a lightning componet using flow Builder????

Pls let me know
Thanks in advance
   Arun
There is a requirement where we need to group the business field by rows and group status field by column, In this process, we get a matrix report with business as rows and different status as columns

shown below in the screenshot 
User-added image
this is the exported report from salesforce. 

Now we have a requirement to display pending column after Due column in the above-shown screenshot and the value of the pending column is calculated by the subtraction of Due and delivered columns. how to achieve this?

Appreciate your inputs on this. 

- Naveen K N
Hello! With our switch to lightning a couple months back, we have a minor break that's being caused by a picklist defaulting to the first option, rather than "--None--" or blank. Any advice would be great. Below are two screen shots illustrating why this behavior is not expected.

For company privacy, I've colored over the picklist options, but they aren't important to the issue any way. 

Picklist field configRecord type picklist options config
As you can see, there should be no default set, and I would like it to default to --None-- accordingly.

 
Hello,
I have two LWCs that are connected via an LMS channel.
LWC 1:
     - creates a custom record, and the related child records
     - publish a LMS channel and populate it with the ids
     - navigate to the record page the contains LWC 2  
LWC 2:
     - subscribes the LMS channel published by LWC1
     - retrieve the ids from the channel in connectedCallback
     - load the page with the custom record and related child record data

I can see the IDs in LWC 1 prior to navigating to the LWC 2. When LWC 2 loads connectedCallback is called but no ids are there. A snipet of the code is below. Any feedback on what I'm doing wrong?

// LWC 1 - A modal that contains the custom logic for creating a new Custom Object A record when the object +New Component Button is clicked
// - this component also does the following:
//     ** creates the related child component records
//     ** publishes an LMS channel with the Ids of the child components
//     ** navigates to the record page that contains the Custom Object A that was just created and the child component ids
import { LightningElement, api, wire } from 'lwc';
import { publish, MessageContext } from 'lightning/messageService';
import CUSTOM_OBJECT_A from '@salesforce/schema/Custom_ObjectA__c';
...
import MY_CHANNEL from '@salesforce/messageChannel/My_Id__c';

export default class CustomObjectACreator extends NavigationMixin(LightningElement) {
    @wire(MessageContext)
    messageContext;            
    
    customObjectApiName = CUSTOM_OBJECT_A;    
    
    @api recordId;  //The record Id set by the framework

    ...
    
    //Id's of Child Components. These are set when createRecord is executed in the child component 
    @api childComponent1RecordId = 'XXXXXX11111';
    @api childComponent2RecordId = 'YYYYYY22222';
    @api childComponent3RecordId = 'ZZZZZZ33333;  
       
    ...
    
     handleCreateCustomObject(event) {    

        //publish message with ids here...
        const payload = {
            childcomponent1recordid: this.childComponent1RecordId,
            childcomponent2recordid: this.childComponent2RecordId,
            childcomponent3recordid: this.childComponent3RecordId
        };        
        publish(this.messageContext, MY_CHANNEL, payload);  
        
         
        //Navigating to Record Page        
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: this.recordId,
                objectApiName: this.customObjectApiName,
                actionName: 'view'                
            }            
        });  
        
    }            
    
}


// This component is on the record page responsible for displaying the Custom Object A data with the related child components data
// This component also:
// - subscribes to the LMS channel published by LWC 1above
// - in connectedCallback, call the method to retrieve the related child component ids. NO IDs ARE PRESENT
// - load the related child components data based on the ids received from the LMS channel.
import { LightningElement, api, wire } from 'lwc';
...
import { subscribe, MessageContext } from 'lightning/messageService';
import CUSTOM_OBJECT_A from '@salesforce/schema/Custom_ObjectA__c';
...
import MY_CHANNEL from '@salesforce/messageChannel/My_Id__c';

export default class CustomObjectA extends LightningElement {
    
    ...
    //Id's for child components related to the Custom object 
    childComponent1RecordId;
    childComponent2RecordId;
    childComponent3RecordId;
 
    subscription = null;   
    
    //The Custom Object reference
    customObjectApiName = CUSTOM_OBJECT_A.fieldApiName;

    ...  
    
    connectedCallback() {        
        this.subscribeToMessageChannel();            
    }
    
    @wire(MessageContext)
    messageContext;

    // Encapsulate logic for LMS subscribe.        
    subscribeToMessageChannel() {
        this.subscription = subscribe(
            this.messageContext,
            SUBTASK_ID_CHANNEL,
            (message) => this.handleMessage(message)
        );        
    }    

    //Handler for message received by component. WHY CAN'T AM I NOT GETTING IDs HERE?
    handleMessage(message) {    
        console.log('CustomObjectA.handleMessage - childComponent Ids are: ', JSON.stringify(message));
        this.childComponent1RecordId = message.childcomponent1recordid;            //SHOULD BE: XXXXXX11111
        this.childComponent2RecordId = message.childcomponent2recordid;            //SHOULD BE: YYYYYY22222
        this.childComponent3RecordId = message.childcomponent3recordid;            //SHOULD BE: ZZZZZZ33333        
    }    
   ...    
    
}


 
Hi Team,

I have designed a detail page for the Account using LWC.
I want to display "Created By & Last Modified By" details in the Lightning-record-view-form.
how can we achieve this request?

Please let me know.

Thanks,
Lakshmi.

 
I have a custom object that has an Apex after update trigger that works fine after a record is edited in SF Classic.  However in Lighting Experience the trigger does not fire (no logs in Developer console).  What could be causing this?
Hi everyone,
I'm new to lightning & trying to make a responsive design by media queries like this
@media  all and (max-width : 1280px) {
 .THIS .columngap {    
     color : red;
    }
}

<div class=" columngap">
     Contact Us
 </div>

but I keep getting the above error in inspect and strict MIME checking is enabled.
so anyone can pls tell me the solution for it 

Thanks in advance
is there any way in aura component its navigate to url but there its loading another component how to find that  dinamic component .
Hi Team,

I want to override a Standard Edit button with Aura component for one profile and the remaining profiles need to redirect to the Standard Edit button. How to achieve this in Lightning?
Thanks in advance....

Thanks,
Lakshmi.
We have many users for Different Integration Environments, We want to trigger something in Salesforce so that we can refresh security token for multiple users at once and send it to our external applications to utilize that.
I have done the validation for my from date in lightning web components but it is not working current date.

current date also showing nvalidation if set min value as current date.so can you please help 
 
Hi,
I have create one custon object XYZ. It is having lookup of standard contact object. I have added XYZ related list on contact object page layout. User will add or delet the record from related list. If user deleted XYZ object record from contact related list, I am updating deleted date on contact object using trigger. But when record is deleted, detail page is not getting refreshed. I have to refresh the page manually to see the result.

I am using ligtening stardard pages only. Why detail section fields are not getting refreshed when we delete related record from related tab ? Is it salesforce issue ?
We had a vendor create a Aura component to insert an iFrame into one of our community pages to allow an end user to upload attachments.  This is not working because we need to be using ".secure.fore.com" in the URL.  It is getting the URL like this:  "cmp.get('c.getFileUploadSiteURL');  But in the cmp file I do not see "getFileUploadSiteUrl", so I am trying to understand where this field is coming from???
l want to disply related contacts of currect account record using LWC.
Thank you!

 
  1. Client wants only upto 10 records to be created on the Account object daily. Write code which will run every 15 minutes. It will check for Account object records created in last 24 hour period (12 am to 12 pm).  If the count exceeds 10, delete the additional records. Counter will reset at 12 am to 0.  Please Any Solution.TIA.
HI 
Below is my code.
 
public class LeadEmail
{
public static void SendEmailTolead(list<lead> lstLead)
{
    if(! lstLead.isEmpty())
   {
        list<messaging.SingleEmailMessage> lstEmails = new list<messaging.SingleEmailMessage>();
    for(lead lr : lstLead)
    {
        messaging.SingleEmailMessage email = new messaging.SingleEmailMessage();
        string[] toEmailsIds = new string[]{lr.Email};
            email.settoAddresses(toEmailsIds);
        
        
        email.setSenderDisplayName('lead Record Creation Alert');
        
        email.setReplyTo('support@RFI.com');
        
        string emailsubject = 'congralutions'+lr.Name+'you have been registerd';
        
        email.setSubject(emailsubject);
        
        string emailHTMLContent = 'Dear'+lr.name+',<br/> <br/>'+
               '<br/><br/> here are your details... <br/><br/>'+
            
                '<br/> Your Company....'+lr.Company+
                '<br/> Your tile for the Role'+lr.Title+
                '<br/> your Status for The record'+lr.Status+
            'thanks & Regards';
        
        email.setHtmlBody(emailHTMLContent);
        
        lstEmails.add(email);
        
    }
   if(!lstEmails.isempty())
    {
        Messaging.sendEmail(lstEmails);    }
    
    } 
}
}

Execute window

list<lead> lstLead = [select id,name,email,company,title,status from lead];
LeadEmail.SendEmailTolead(lstLead);



Getting error 
Line: 38, Column: 1
System.EmailException: SendEmail failed. First exception on row 5; first error: SINGLE_EMAIL_LIMIT_EXCEEDED, Email limit exceeded: []

Any assistance

​​​​​​​Thanks in advance
Hi All , 
We are facing an issue with name field from User table in production . The issue is that when we lookup the employee details and save the request . In display mode, it is showing ID instead of Employee name and Its happening on in production . We have just used standard lookup user table and there is no custom coding. Does anybody have faced similar issue ?
how to pass design attribute from one component to another. I have a design attribute of type boolean which is set as false "@api isiframe=false".after it is checked the value should be passed to another component-"documentCheckItemCard".
on true of isiframe i want to display the iframe section.
 
public with sharing class met1x_DVIMarkerController {
    @AuraEnabled(cacheable=true)
    public static boolean getcheckboxvalue(String recordid){
        String objName=findObjectNameFromRecordId(recordid);
        try{
            System.debug('objName'+objName);
            System.debug('recordid'+recordid);
            if(objName=='Account'){
                
                return [select GiDP_DomesticViolenceIndicator__c from Account where id=:recordid and GiDP_DomesticViolenceIndicator__c=true limit 1].GiDP_DomesticViolenceIndicator__c;
                //return obj.get(0).GiDP_DomesticViolenceIndicator__c;
            }
            else if(objName == 'Asset'){
                return [select GiDP_DomesticViolenceIndicator__c from Asset where id=:recordid and GiDP_DomesticViolenceIndicator__c=true limit 1].GiDP_DomesticViolenceIndicator__c;
            }
            else if(objName == 'vlocity_ins__InsuranceClaim__c'){
                return [select GiDP_DomesticViolenceIndicator__c from vlocity_ins__InsuranceClaim__c where id=:recordid and GiDP_DomesticViolenceIndicator__c=true limit 1].GiDP_DomesticViolenceIndicator__c;
                
            }
            else if(objName=='GiDP_ImageMetadataRepo__c'){
                // List<GiDP_ImageMetadataRepo__c> metadatarepos=[select id,]
                List<GiDP_ImageMetadataRepo__c> metadatrepos= [select id,GiDP_PolicyRecord__r.GiDP_FraudIndicator__c from GiDP_ImageMetadataRepo__c where id=:recordid and GiDP_PolicyRecord__r.GiDP_DomesticViolenceIndicator__c=true limit 1];
                if(metadatrepos.size()>0){
                    return true;
                }
            }
            /*if(Test.isRunningTest()){
                
                throw new DMLException('Static DML Exception to cover catch block');
                
            }*/
            return false;
        }
        catch (Exception ex) {
            ExceptionLogUtility.createException('getcheckboxvalue method', 'Exception', ex.getStackTraceString(), 
                                                'met1x_DVIMarkerController Class', 'Application', objName+' Object', ex.getMessage());
            return null;
        }
    }
    @AuraEnabled(cacheable=true)
    public static boolean getFraudIndicatorInfo(String recordid){
        String objName=findObjectNameFromRecordId(recordid);
        try{
            System.debug('objName'+objName);
            System.debug('recordid'+recordid);
            if(objName=='Account'){
                return [select GiDP_FraudIndicator__c from Account where id=:recordid and GiDP_FraudIndicator__c=true limit 1].GiDP_FraudIndicator__c;
                //return obj.get(0).GiDP_DomesticViolenceIndicator__c;
            }
            else if(objName == 'Asset'){
                return [select GiDP_FraudIndicator__c from Asset where id=:recordid and GiDP_FraudIndicator__c=true limit 1].GiDP_FraudIndicator__c;
            }
            else if(objName == 'vlocity_ins__InsuranceClaim__c'){
                return [select GiDP_FraudIndicator__c from vlocity_ins__InsuranceClaim__c where id=:recordid and GiDP_FraudIndicator__c=true limit 1].GiDP_FraudIndicator__c;
                
            }
            else if(objName=='GiDP_ImageMetadataRepo__c'){
                //return true;
                List<GiDP_ImageMetadataRepo__c> metadatrepos= [select id,GiDP_PolicyRecord__r.GiDP_FraudIndicator__c from GiDP_ImageMetadataRepo__c where id=:recordid and GiDP_PolicyRecord__r.GiDP_FraudIndicator__c=true limit 1];
                if(metadatrepos.size()>0){
                    return true;
                }
            }
            return false;
        }
        catch (Exception ex) {
            ExceptionLogUtility.createException('getFraudIndicatorInfo method', 'Exception', ex.getStackTraceString(), 
                                                'met1x_DVIMarkerController Class', 'Application', objName+' Object', ex.getMessage());
            return null;
        }
    }
    @AuraEnabled(cacheable=true)
    public static String findObjectNameFromRecordId(String recordId){
        String objectName = '';
        try{
            //Get prefix from record ID
            //This assumes that you have passed at least 3 characters
            String myIdPrefix = String.valueOf(recordId).substring(0,3);
            
            //Get schema information
            Map<String, Schema.SObjectType> gd =  Schema.getGlobalDescribe(); 
            
            //Loop through all the sObject types returned by Schema
            for(Schema.SObjectType stype : gd.values()){
                if(stype.getDescribe().getKeyPrefix() != null && 
                   (stype.getDescribe().getKeyPrefix() == '001' ||
                    stype.getDescribe().getKeyPrefix() == '02i' ||
                    stype.getDescribe().getKeyPrefix() == 'a')){
                        Schema.DescribeSObjectResult r = stype.getDescribe();
                        String prefix = r.getKeyPrefix();
                        System.debug('Prefix is ' + prefix);
                        
                        //Check if the prefix matches with requested prefix
                        if(prefix!=null && prefix.equals(myIdPrefix)){
                            objectName = r.getName();
                            System.debug('Object Name! ' + objectName);
                            break;
                        }
                    }
            }
        }
        catch (Exception ex) {
            ExceptionLogUtility.createException('findObjectNameFromRecordId method', 'Exception', ex.getStackTraceString(), 
                                                'met1x_DVIMarkerController Class', 'Application', objectName+' Object', ex.getMessage());
        }
        return objectName;
    }
}
Hi,

I have Apex code  output JSON data,

User-added image

I wish to display this json data in my LWC. 
Html:
<template>
    <lightning-card title="Report Data" icon-name="lightning-icon" >
        <div class="slds-m-around_medium">
            <template if:true={lapp}>
                <ul>
               <template for:each={lapp} for:item="app">
                   <li key={app.Id}> {app.Name} </li>
               </template>
            </ul>
           </template>
           <template if:true={error}>
               {error}
           </template>  
        </div>
 </lightning-card>
</template>

Js:
import { LightningElement, wire, track} from 'lwc';
import getURL from '@salesforce/apex/CreateReport.reportgen';
export default class RedirecctedURL extends LightningElement {
       @track lapp;
       @track data;
       @track error;
       wiredActivities;
     @wire(getURL,{
     }
     )
     wiredCases(value){
     this.wiredActivities = value;
     const { data, error } = value;
     
     if(data){
       this.lapp = JSON.stringify(data);
       console.log(JSON.stringify(data));
     
     }else if(error){
       console.log(error);
       this.error = error;
     }
     }
}

Any help??
 
While logged in as particular user having permission set aceess to Send Email , edit Taks, when I an trying to send a new mail from Activites Tab from Case Record page, it is showing that Email was sent, but the reciepeints are not receing the mails,(Contacts, Accounts have read access) I am not able to find why reciepients are not receiving mails, Am I missing some permisision access
I have installed Dropbox for Salesforce using a Business Standard account. Apparently it is working correctly and as we expected but strange Apex exceptions are occurring in one of the managed triggers. We were getting that error every 60 seconds and we can't confirm if there are issues behind the scenes because of this.

It would help us to know what this exception is about and what we can do to avoid it. Thank you in advance.

Failed to process Queueable job for class Dropbox_for_SF.HandleConvertQueue for job ID 7073f00000F75nl.

caused by: Dropbox_for_SF.DropboxClient.UserNotConnectedException: Script-thrown exception

Class.Dropbox_for_SF.DropboxClient.createHttpRequest: line 74, column 1
Class.Dropbox_for_SF.DropboxClient.httpCallout: line 99, column 1
Class.Dropbox_for_SF.DropboxClient.httpCallout: line 96, column 1
Class.Dropbox_for_SF.DropboxClient.httpCallout: line 93, column 1
Class.Dropbox_for_SF.DropboxClient: line 327, column 1
Class.Dropbox_for_SF.RootFinder.findRecordRoot: line 247, column 1
Class.Dropbox_for_SF.RootFinder.findRecordRoot: line 214, column 1
Class.Dropbox_for_SF.RootFinder.findRecordRoot: line 199, column 1
Class.Dropbox_for_SF.HandleConvertQueue.moveFiles: line 32, column 1
Class.Dropbox_for_SF.HandleConvertQueue.execute: line 13, column 1
Component: 

 <lightning:datatable style="width: 50%" data="{! v.ContactList }"
                             aura:id="accountDataTable"
                             columns="{! v.mycolumns }"

                             onrowselection="{!c.handleSelectedRow}"
                             keyField="Id"  onsave ="{!c.onSave}" hideCheckboxColumn="false" onrowaction="{!c.viewRecord }"
<lightning:button variant="Brand" label="Delete Selected Contacts" title="Success" onclick="{! c.handleSelectedRowdelete }"/> 

JS Controller :

handleSelectedRow: function(component, event, helper){
        var abc = event.getParam('selectedRows'); 
        
        var setRows =[];
        for(var i = 0;i<abc.length;i++ ) {
            alert('abc[i].id'+abc[i]);
            setRows.push(abc[i].id);
        } 
        
        component.set("v.selectedRows",setRows);
    },
    handleSelectedRowdelete: function(component, event, helper){
         var conList=component.get("v.selectedRows");
        alert(conList);
        var conIds =[];
        for(var i = 0;i<conList.length;i++ ) {
            
            conIds.push(conList[i].id);

        }
        alert("****Id****",conIds);
        
        var action = component.get("c.DeleteContactlist");
        action.setParams({
            'listcon' : conIds
        });
        action.setCallback(this,function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                //if update is successful
                component.set("v.showdelete",'True');
                component.set("v.ContactList",'');
                location.reload();
            }
        });
        $A.enqueueAction(action);


I want on click of Delete Selected Contacts , all selected contact should deleted. I have use onselected attribute of datatable and on selestion, I am updating selectedRows. On button click I am using SelectedRows and trying to get the id but getting error. 



Error:   Action failed: c:getContactComp$controller$handleSelectedRowdelete [Cannot read property 'id' of undefined]
Hi,
I had written code for 3 fileds (FirstName,LastName,PhysicalAttributes) for inserting record in Contact Object.It was successfully Saving Record.
But when i am trying to insert Record using FirstName and LastName i am getting error like

Error creating record
Upsert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Physical Attributes: value not of required type: : [Physical_Attributes__c]
Close


Because while Inserting Records we can skip some Fields(i.e;Non-Mandatory)Fields.Can any one Plz suggest me.

Here is my code:

<template>
    <lightning-card title="Insert Contact" icon-name="standard:contact">
            <div class="slds-p-around_x-small">
                <lightning-input label="FirstName" value={rec.FirstName} onchange={handleFirstNameChange}></lightning-input>
                <lightning-input label="LastName" value={rec.LastName} onchange={handleLastNameChange}></lightning-input>
                <lightning-input type="text" label="PhysicalAttributes" value={rec.Physical_Attributes__c} onchange={handlePhysicalAttributesChange}></lightning-input><br/>
                <lightning-button label="Save" onclick={handleClick}></lightning-button>
            </div>
        </lightning-card>
</template>

import { LightningElement,track } from 'lwc';
import createContact from '@salesforce/apex/insertContactApexWeb.saveContactRecord';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName__c';
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName__c';
import PHYSICALATTRIBUTES_FIELD from '@salesforce/schema/Contact.Physical_Attributes__c';
export default class InsertContact extends LightningElement {
    @track firstname = FIRSTNAME_FIELD;
    @track lastname = LASTNAME_FIELD;
    @track physicalattributes = PHYSICALATTRIBUTES_FIELD;
   @track  rec = {
        FirstName : this.firstname,
        LastName : this.lastname,
        Physical_Attributes__c: this.physicalattributes
    }
    handleFirstNameChange(event) {
        this.rec.FirstName = event.target.value;
    }
    
    handleLastNameChange(event) {
        this.rec.LastName = event.target.value;
    }
    
    handlePhysicalAttributesChange(event) {
        this.rec.Physical_Attributes__c= event.target.value;
    }
    handleClick() {
        createContact({ con : this.rec })
       .then(result => {
            // Clear the user enter values
            this.rec = {};
            window.console.log('result ===> '+result);
            // Show success messsage
            this.dispatchEvent(new ShowToastEvent({
                title: 'Success!!',
                message: 'Contact Created Successfully!!',
                variant: 'success'
            }),);
        })
        .catch(error => {            
            this.error = error.message;
            window.console.log('error body--'+error.body.message);
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error creating record',
                    message: error.body.message,
                    variant: 'error',
                }),
            );
            window.console.log("error", JSON.stringify(this.error));
        });

    }
    
}


Apex Class:
public with sharing class insertContactApexWeb {
   
    @AuraEnabled
    public static void saveContactRecord(Contact con){
        System.debug('acc--'+con);
        try{
            insert con;
        }
        catch(Exception ex) {
            throw new AuraHandledException(ex.getMessage());
        }
    }
}
I have an active user that has a customer community license.  That user is able to own contact records, but I can't seem to change ownership of an account to that user.

In the documentation, I found this statement: "Community Users can't own community-enabled accounts".  Is that my issue?  What does it mean for an account to be "community-enabled"?  Is there a work-around?  My goal here is to have a community licensed user that can own accounts that are outdated/inactive.

Thanks,

- Randy Trigg
  • September 17, 2019
  • Like
  • 1
Context

I have a custom Lightning Web Component that allows modification of multiple records inside of modal. Once a record is updated, I reload that same record-id, but the old data shows up instead of the new data. After thorough research, I have concluded that the Lightning Data Service is at fault here. It is caching the data in the built-in ViewState most likely. The only way to get a data refresh is by refreshing the entire web page. I found multiple articles that explain how to turn off Secure and Persistent Browser Caching, but this is an unacceptable solution, as the entire Organization will take a performance hit, to support my little Lightning Web Component. Also salesforce insists that you don't do it production:

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/debug_disable_caching.htm

Question

How do I invalidate or send a ChangeNotify Event to the Lightning Data Service (in the context of Lightning Web Components), so my lightning-record-edit-form shows the updated data, instead of the old data (without refreshing the entire web page of course)?
Just wanted to share a problem we had that I haven't seen elsewhere.

We built a Flow Definition with the Process Builder and Added it to our Managed Package

Then we decided to Deactivate the Flow before uploading the Package as some orgs that we support may not use it.

When we tried to install our Managed Package, it failed, saying that the Flow had been Deleted.

It clearly had NOT been deleted, so we were stumped.  Salesforce Support couldn't help us and escalated the Case.

I began studying the Setup Audit Trail and noticed strange entries that happened at the same time I Activated and Deactivated the Flow:

When my Flow was "Activated",  the system was creating a 'Flow Trigger" and a "Workflow Rule" behind the scenes with the same name as my flow, though adding a long id number at the end.

The PROBLEM is that when I deactivated the Flow, the system didn't just deactivate the "backend" Workflow Rule, but THEN it DELETED both the 'Flow Trigger' and the "backend" Workflow Rule!  I don't understand why it was actually deleted? THIS deleted hidden Trigger and Workflow is what caused the package install to fail.

On a hunch I decided to Activate the Flow and build a new package again.  Sure enough, the package uploaded and installed perfectly.

Salesforce needs to put some documentation around this, or at least have a warning popup when you try to Deactivate a Flow that is already in a package.

How are we supposed to know that deactivation is deleting components that we didn't even know were there in the first place?

Hope this saves someone else some time.