• Surya.236
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 12
    Replies
private List<Finding> processFindings(List<FINDING__C> findings){
        try{
            List<Finding> findingsList = new List<Finding>();
            if(findings!=null){ 
                for(FINDING__C finding : findings){
                    Finding findingObj = new Finding();
                    findingObj.Id=finding.id;
                    findingObj.subject = finding.Name;
                    findingObj.longdescription = finding.Finding_Long_Description__c;
                    findingObj.createdOn = finding.CreatedDate;
                    if(finding.Has_Proposal__c && !finding.Proposals__r.isEmpty()) {
                        if(finding.Proposals__r[0].status==STATUS_CLOSED) {
                            findingObj.approver = finding.Proposals__r[0].contact.name;
                            CASE solution = getApprovedSolution(finding.Proposals__r[0].Id);
                            if(solution!=null){
                                findingObj.tatImpact = solution.TAT_Impact_Estimate__c + 'day(s)';
                                findingObj.costImpact = solution.Financial_Impact__c;
                            }
                        }
                    }
                    findingObj.lstHistories = HistoryController.getSObjectHistories(finding.Id);
                    findingsList.add(findingObj);
                }
            }
            return findingsList;
        }
        catch(Exception e){ throw new UtilExceptions.CustomException(new UtilExceptions.LogBuilder().createClassLogExceptionEvent(e,GenerateHistoryReportController.class.getName()));}
    }


I'm getting 101soql error because of methods in for loop has soql queries. Please help to solve this.
Methods in loop:
getSObjectHistories
getApprovedSolution

 
Multiselect checkbox is working wehn i have one record.
please suggest.
Below is my code. I've copied the code from below Link in my dev Org. If I have 2 or more records it is working.
If I have one record and  if i select the chcek box it is not selecting the all checboxes.
Code from below URL
https://www.biswajeetsamal.com/blog/lightning-table-with-multiple-checkbox-select-options/
Recordtype assignement not working in lightning 'createRecordEvent.setParams'  not assigning the recordtype given in controller instead default recordtype to profile is showing.

var createRecordEvent = $A.get("e.force:createRecord");
                                        createRecordEvent.setParams({
                                            "entityApiName": "Mysales__c",
                                            "recordTypeId" : '01280000000Ln7tAAC',
                                            "defaultFieldValues":
 I need to query the recordtype and then I have to assign ? please help 
How to access the field values in lightning  componenet .
Example:
In java script button directly we can access values like below.
var oppty = "{!amount}";
var opptystatus = "{! .Status}";
Is there a way to get the vaues like this in Lightnig JS controlller ?
 
@InvokableMethod action are not visible in Flow. please Help.
 i tried with suggestions by Mohith and Ali Below link.

https://success.salesforce.com/answers?id=9063A000000pyHMQAY#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Configuration_Data_Management&criteria=OPENQUESTIONS&id=9063A000000pz2OQAQ

 please Help
I have a process builder on Email Message object, from this process builder i am updating case 'last_activity_date__c' with system .now() when a email is sent from case related list "send Email". I have a trigger on case which send an email when case is closed,
Now I am getting SELF_REFERENCE_ERROR. I tried changing the method causing error calling in trigger from before update to after update then I am getting 101 soql.
Can anyone have an idea how to solve this SELF Referece Error?
Error:
Error:Apex trigger CaseTrigger caused an unexpected exception, contact your administrator: CaseTrigger: execution of BeforeUpdate caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “UpdateCaseFromRelatedEmail” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to update records: SELF_REFERENCE_FROM_TRIGGER: Object (id = 50022000002xkHk) is currently in trigger CaseTrigger, therefore it cannot recursively update itself. You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 671972233-138629 (1525238937): []: Class.UOP_CaseHandler.autoPopulateTimeStampAndSendEmail: line 535, column 1
Hi i have a custom visual force page , in this i was unable to use onchange event
My VF Page has Account Lookup and salesDistrict lookup ,when user chnage the account  value i have to populate the accout's sales value in sales lookup field. Folowing is my code

<apex:pageBlockSectionItem helpText=" The End User’s physical location" >
Account Name:
<apex:inputField id="oppAccountId" value="{!thisOpp.AccountId}" required="true">
<apex:actionSupport action="{!populatesalesdistrict}" event="onchange" reRender="salesDistrict" status="pageStatus"/> </apex:inputField>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem helpText="Auto populated from Account; Enter if blank">
Sales District :
<apex:inputField value="{!thisOpp.Sales_District_lkup__c}" id="salesDistrict" required="true"/>
</apex:pageBlockSectionItem>
 controller: Mrthod:
  Public void populatesalesdistrict(){
       Account thisAcc = [SELECT Id, Sales_District__c,SoldTo__c from Account where ID =: thisOpp.AccountId];
       thisOpp.Sales_District_lkup__c = thisAcc.Sales_District__c;
}
What is alternate if onchange will not work for lookup fields.?
Hi All,

Can we calculate the Time in business hours, between casemile stone 'targetdate' when isvoilated is true and TRclose(field in case) in lightning reports  through 'Row-level formula' in sfdc.??.
How to convert the folloeing nested for loop using map.
as it a id, list . how to assign values.
public class SLAandAgeOverSLA {
    public void calculatetime(List<Case> caseids,Map<id,case> casemap){
         
        List<CaseMilestone> milestonelist = [select caseId,id,isCompleted,MilestoneTypeId,StartDate,TargetDate,BusinessHoursId,MilestoneType.name,CompletionDate from 
                                             CaseMilestone where(MilestoneType.name='First Response' or MilestoneType.name='Technical Resolution') 
                                             AND isCompleted=true AND caseid IN:caseids]; 
                                             
        map<string,List<CaseMilestone>> milestonemap = new map<string,List<CaseMilestone>>();
        for(CaseMilestone ml: milestonelist ){
            
            if(milestonemap.get(ml.caseId)==null){
                List<CaseMilestone> mtList=new List<CaseMilestone>();
                mtList.add(ml);
                milestonemap.put(ml.CaseId,mtList);
            }else if(milestonemap.get(ml.caseId)!=null){
                List<CaseMilestone> mtList=milestonemap.get(ml.caseId);
                mtList.add(ml);
            }
        }
        for(Case c: caseids){
            if(c.Request_for_Closure_Date__c!=null && milestonemap.containskey(c.id) ){
            
                for(CaseMilestone ml:milestonemap.get(c.id)){
                
                    if(ml.MilestoneType.name=='First Response'){
                        c.Test_Ignore__c = ml.CompletionDate;
                    }
                    else if(ml.MilestoneType.name=='Technical Resolution'){
                        c.Test_Ignore_2__c = ml.CompletionDate;
                    }
                }
            }
        }
    }
}
public void UpdateFieldsOnChildrenLeads(Map<Id,Lead> leadMap) {
    
        Map<ID,Lead> childrenLeads = new Map<ID,Lead>();
        Map <ID,List<Lead>> childrenPerLead = new Map <ID, List <Lead>> ();
        Set <String> updatedLeads = new Set <String> ();

       
        for(Lead thisLead:leadMap.values()){
            updatedLeads.add(thisLead.Id);
        }
        
        if(updatedLeads.size()>0)
        childrenLeads = new Map<ID,Lead> ([Select a.Id,
        a.Parent_Lead__c, 
        a.Dosages_Offered__c
         From Lead a
        where a.Parent_Lead__c in :updatedLeads]);
        
         if(childrenLeads.size()>0)
        for (Lead childLead : childrenLeads.values()){
           
            List <Lead> theList = childrenPerLead.get(childLead.Parent_Lead__c);
           
            
            if(theList != null){
                theList.add(childLead); 
            }
          
            else{
                List <Lead> newList = new List <Lead> ();
                newList.add(childLead);
                childrenPerLead.put(childLead.Parent_Lead__c,newList);
            } 
        }
        List <Lead> LeadsToUpdate = new List < Lead>();

        for(Lead thisLead:leadMap.values()){
            List <Lead> lineitems = childrenPerLead.get(thisLead.id);
            if(lineitems != null)
            {
              
                for(Lead li : lineitems)
                {
                    li.State = thisLead.State;
                    li.PostalCode = thisLead.PostalCode;
                 }
                 LeadsToUpdate.addAll(lineitems); 
            }
        }
            if( !LeadsToUpdate.isEmpty() ) 
            update LeadsToUpdate;
    }
System.DmlException: Insert failed. First exception on row 0; first error: LIMIT_EXCEEDED, limit exceeded: [].
While Inserting the user im Getting this error.
I tried Changing Account Owner. i have given permission "Modify all" also even though im not able to attach file.
When i try to open the file im getting this error.
im getting this  error if i try to open the file. when i gone through the path in that i got this following explanation.User-added image
how to solve this error . im new to salesforce. please help me .
Hi , i have a in line vf button which in that -----oncomplete="window.top.location = '/{!Case.id}' "---- this oncomplete funtionalityworking in VF properly but not in Lightning?? i need make that command button to work in both vf and lightning.
Multiselect checkbox is working wehn i have one record.
please suggest.
Below is my code. I've copied the code from below Link in my dev Org. If I have 2 or more records it is working.
If I have one record and  if i select the chcek box it is not selecting the all checboxes.
Code from below URL
https://www.biswajeetsamal.com/blog/lightning-table-with-multiple-checkbox-select-options/
Recordtype assignement not working in lightning 'createRecordEvent.setParams'  not assigning the recordtype given in controller instead default recordtype to profile is showing.

var createRecordEvent = $A.get("e.force:createRecord");
                                        createRecordEvent.setParams({
                                            "entityApiName": "Mysales__c",
                                            "recordTypeId" : '01280000000Ln7tAAC',
                                            "defaultFieldValues":
 I need to query the recordtype and then I have to assign ? please help 
How to access the field values in lightning  componenet .
Example:
In java script button directly we can access values like below.
var oppty = "{!amount}";
var opptystatus = "{! .Status}";
Is there a way to get the vaues like this in Lightnig JS controlller ?
 
Hi i have a custom visual force page , in this i was unable to use onchange event
My VF Page has Account Lookup and salesDistrict lookup ,when user chnage the account  value i have to populate the accout's sales value in sales lookup field. Folowing is my code

<apex:pageBlockSectionItem helpText=" The End User’s physical location" >
Account Name:
<apex:inputField id="oppAccountId" value="{!thisOpp.AccountId}" required="true">
<apex:actionSupport action="{!populatesalesdistrict}" event="onchange" reRender="salesDistrict" status="pageStatus"/> </apex:inputField>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem helpText="Auto populated from Account; Enter if blank">
Sales District :
<apex:inputField value="{!thisOpp.Sales_District_lkup__c}" id="salesDistrict" required="true"/>
</apex:pageBlockSectionItem>
 controller: Mrthod:
  Public void populatesalesdistrict(){
       Account thisAcc = [SELECT Id, Sales_District__c,SoldTo__c from Account where ID =: thisOpp.AccountId];
       thisOpp.Sales_District_lkup__c = thisAcc.Sales_District__c;
}
What is alternate if onchange will not work for lookup fields.?
Hi All,

Can we calculate the Time in business hours, between casemile stone 'targetdate' when isvoilated is true and TRclose(field in case) in lightning reports  through 'Row-level formula' in sfdc.??.
public void UpdateFieldsOnChildrenLeads(Map<Id,Lead> leadMap) {
    
        Map<ID,Lead> childrenLeads = new Map<ID,Lead>();
        Map <ID,List<Lead>> childrenPerLead = new Map <ID, List <Lead>> ();
        Set <String> updatedLeads = new Set <String> ();

       
        for(Lead thisLead:leadMap.values()){
            updatedLeads.add(thisLead.Id);
        }
        
        if(updatedLeads.size()>0)
        childrenLeads = new Map<ID,Lead> ([Select a.Id,
        a.Parent_Lead__c, 
        a.Dosages_Offered__c
         From Lead a
        where a.Parent_Lead__c in :updatedLeads]);
        
         if(childrenLeads.size()>0)
        for (Lead childLead : childrenLeads.values()){
           
            List <Lead> theList = childrenPerLead.get(childLead.Parent_Lead__c);
           
            
            if(theList != null){
                theList.add(childLead); 
            }
          
            else{
                List <Lead> newList = new List <Lead> ();
                newList.add(childLead);
                childrenPerLead.put(childLead.Parent_Lead__c,newList);
            } 
        }
        List <Lead> LeadsToUpdate = new List < Lead>();

        for(Lead thisLead:leadMap.values()){
            List <Lead> lineitems = childrenPerLead.get(thisLead.id);
            if(lineitems != null)
            {
              
                for(Lead li : lineitems)
                {
                    li.State = thisLead.State;
                    li.PostalCode = thisLead.PostalCode;
                 }
                 LeadsToUpdate.addAll(lineitems); 
            }
        }
            if( !LeadsToUpdate.isEmpty() ) 
            update LeadsToUpdate;
    }
System.DmlException: Insert failed. First exception on row 0; first error: LIMIT_EXCEEDED, limit exceeded: [].
While Inserting the user im Getting this error.