• SFDC New learner
  • NEWBIE
  • 95 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 40
    Questions
  • 50
    Replies
When you click 'View All' on Related List, you get a list view of all the records. How can you customize that page?
I want to remove the 'New' action button on that page
Hi Everyone,

I am trying to inline edit the data table.
I followed this example to update the draft values to the server.
http://simpluslabs.com/how-to-use-lightningdatatable/

<lightning:datatable aura:id="contactDatatable" columns="{! v.mycolumns }"
                                             data="{! v.dates }"
                                             keyField="id"
                                             hidecheckboxcolumn="true"
                                                onsave="{! c.saveTable }"
                                             
                                             /> 
saveTable:function (cmp,event,helper)
    {
        console.log('insavetable');
        var draftValues = event.getParam('draftValues');
        helper.onSave(cmp,draftValues);
    },
onSave:function(cmp,draftValues)
    {
        console.log('onsave');
        var tsId = cmp.get("v.timeSheetId");
        alert(tsId);
        console.log(tsId);
        var action=cmp.get("c.updateTime1");
        action.setParams({"tsId":tsId,"updatedTimeList":draftValues});
        action.setCallback(this,function(response)
                           {
                              var state=response.getState();
                               if(state='SUCCESS')
                               {
                                 //  console.log('success'+JSON.stringify(response.getReturnValue()));
                                   console.log('success');
                                   
                               }
                               else 
                               {
                                   console.log(state);
                               }
                                   
                           });
        $A.enqueueAction(action);
    },
@AuraEnabled    
    public static List < TimePeriod__c > updateTime1(String tsId, List < TimePeriod__c > updatedTimeList ) {    
          updatedTimeList=[select  Id, Date__c,IsAlreadySubmitted__c,Status__c, Volunteer_Recurrence_Schedule__c,Volunteer_Hours__r.name, Time__c, Hours_Worked__c from TimePeriod__c where time__c =:tsId];  
        
        for(TimePeriod__c tp: updatedTimeList){   
            system.debug('SignIn__c'+tp.Sign_In__c); --> null values
            system.debug('SignOut'+tp.Sign_Out__c);--> null values
            system.debug('hoursworked'+tp.Hours_Worked__c);--> null values

        }
          system.debug('updated'+updatedTimeList);
            update updatedTimeList;}
Can anyone help me to fix this issue? TIA

Thanks,
Sirisha
Hi All,

I have an object with a start date and an end date. I am trying to create insert weekly dates in one object and a list of dates between the start date and end date in another object.
Object A
start Date    End Date
10/01/2020  10/31/2020
Object B
start date      end date          Object A ID
10/01/2020     10/07/2020
10/07/2020     10/14/2020
10/14/2020     10/21/2020
10/21/2020     10/27/2020
10/27/2020       11/03/2020

Object C
Date              Object BID   Object A ID
10/01/2020
10/02/2020
10/03/2020
---
--
10/31/2020

I have created lookup from Object B to Object A and Object C to Object B and Object C to Object B.
Is it possible to map Object B and Object C. How can I populate Object B Id in Object C? Can anyone send a sample code?

Thanks,
Sirisha
Hi Everyone,

I am trying to pass the current record Id from process builder to apex and then to visual force which embeds lightning component.

public class MyInvocableVariable {
    @InvocableVariable(label='Id' required=true)
    public Id recId;

    }  

<apex:page showHeader="false" sidebar="false">
    <apex:includeLightning />
    
    <div id="lightning" />
    <script>
        $Lightning.use("c:lightningApp", function(){
            $Lightning.createComponent("c:lightningComponent",
                "recId":?, ---> need to pass the Id
                "lightning",
                function(cmp){}
            );
        }            
       );
    </script>

</apex:page>

Anyone, please help with this.

Thanks,
Sirisha
Hi Everyone,

I am getting the following error when trying to callout an external service using trigger and future method and update the object.
trigger TriggerAfterInsertUpdate on CustomObject __c(after insert, after update ) {
if(Trigger.isAfter){
         if(updation.isfutureupdate!=true)
            {
               id lst;
                for(CustomObject e :Trigger.new)
                {
                   // lst=e.Id;
                    system.debug('$$$$$$$$$$$'+e.Id);
                    handler.dofuture(e.Id);
                }
                
                
            }
public with sharing class handler {
@future(callout=true)
    public static void dofuture(Id recordId){
        CustomObject __C  cust = [SELECT Id, Name, , IsChecked,
            Day_H__c, Month_H__c, Year_H__c,  Day_G__c, Month_G__c, Year_G__c FROM CustomObject__c
            WHERE Id = :recordId];
        List<String> hDate = verifyfields(cust ,cust .Day_G__c,cust .Month_G__c,cust .Year_G__c,cust .IsChecked);
                     cust .Year_H__c = hDate[0];
                    cust .Month_H__c = hDate[1];
                    cust .Day_H__c = hDate[2];
        List<CustomObject__c> dec1 = new List<CustomObject__c>();
        dec1.add(cust );
        update dec1;
        updation.isfutureupdate = true;
    }
    public static List<string> verifyfields(SObject sobj, String dayG, String monthG, String yearG, Boolean IsChecked){
        String urlPrefix = 'urlpath'
        String retUrl = urlPrefix;
        retUrl += '&gy=' + yearGregorian;
        retUrl += '&gm=' + monthGregorian;
        retUrl += '&gd=' + dayGregorian;
        retUrl += '&gs=' + (afterSunset ? '1' : '0');
        Http h = new Http();
            
            // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint 
            HttpRequest req = new HttpRequest();
            req.setEndpoint(retUrl);
            req.setMethod('GET');
            
            // Send the request, and return a response 
            HttpResponse res = h.send(req);
                                              
                                          
            if(res.getStatusCode() != 200) {
        System.debug('The status code returned was not expected: ' +
            res.getStatusCode() + ' ' + res.getStatus());
     }else {
        System.debug('********response********'+res.getBody());
     } 
       List<String> ret = new String[3];
        JSONParser parser = System.Json.createParser(res.getBody());
                                                          
        while (parser.nextToken() != null) {
            system.debug('inside while'+JSONToken.FIELD_NAME);
            if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
                if (parser.getText() == 'hy') {
                    // Get the value. 
                    parser.nextToken();
                    ret[0] = parser.getText();
                    System.debug('Year='+ret[0]);
                }
                else if (parser.getText() == 'hm') {
                    // Get the value. 
                    parser.nextToken();
                    ret[1] = parser.getText();
                    if (ret[1].equals('xxx') || ret[1].equals('yyy'))
                        ret[1] = 'yyy';
                    else if (ret[1].equals('zzz'))
                        ret[1] = 'zzz';

                    System.debug('Month='+ret[1]);
                }
                else if (parser.getText() == 'hd') {
                    // Get the value. 
                    parser.nextToken();
                    ret[2] = parser.getText();
                    System.debug('Day='+ret[2]);
                }
            }
        }
        return ret;        
     
                                          
                                      }
    
}
getting the following error:
EXCEPTION_THROWN [25]|System.DmlException: Update failed. First exception on row 0 with id a010U000006kjnSQAQ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TriggerAfterInsertUpdate : execution of AfterUpdate

Please can anyone help me to fix this issue?
Thanks,
Sirisha
 
Hi Everyone,

I have a requirement where I need to call the external webservice and populate the fields on insert or update of record.

Already there is a button on record built using lightning component which will pass few values to external system and in return it populates few fields based on the input fields.

the lightning button code looks like below:
Apex:

@AuraEnabled
    public static object__c updatemethod(Id objId) {
        List<Id> dlist = new List<Id>();
        List< object __c> ret;
        dlist.add(objId);
        if(dlist.size()>0){
            ret = class1.updatemethod2(getDetailsByIds(dlist));}
            return ret.get(0);
    }
Global with sharing class class1{
private static List< object __c> calculateDate(List< object __c> dList) {
                              for (object __c d : dList) {
           
            // If date is not filled in, fetch the values
            if (d.Month__c == null && d.Day__c == null &&
                d.Day_g__c != null && d.Month_g__c != null & d.Year_g__c != null) {
                    String[] hDate = getDateFromG(d.Day_g__c, d.Month_g__c,
                                                                              d.Year_g__c, d.IsChecked__c);
                    d.Year__c = hDate[0];
                    d.Month__c = hDate[1];
                    d.Day__c = hDate[2];
            }
Update dlist;
     }  

public static String[] getDateFromG (String dayg, String monthg,
                                                      String yearg, Boolean IsChecked) {
               String url = geturl(dayg, monthg, yearg, IsChecked);
                              System.debug(url);
        String json = getContent(url);

                              String[] ret = new String[3];
                              JSONParser parser = System.Json.createParser(json);
                                                          
                              while (parser.nextToken() != null) {
            system.debug('inside while');
            if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
               if (parser.getText() == 'hy') {
                               // Get the value.
                           parser.nextToken();
                       ret[0] = parser.getText();
                       System.debug('Year='+ret[0]);
               }
               …..
            }
        }
                              return ret;       
    }   
private static String getContent(String url) {
                              // Instantiate a new http object
            Http h = new Http();
           
            // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
            HttpRequest req = new HttpRequest();
            req.setEndpoint(url);
            req.setMethod('GET');
           
            // Send the request, and return a response
            HttpResponse res = h.send(req);
            return res.getBody();
    }
I added the below code when a new record is inserted or updated , it should fire the trigger and callout the url to retrieve and populate the fields in the record.
trigger TriggerInsertorupdate on object__c (after insert, after update) {

if(Trigger.isAfter){
         if(updation.isfutureupdate!=true)
            {
               id lst;
                for(Deceased__c e :Trigger.new)
                {
                    lst=e.Id;
                    system.debug('$$$$$$$$$$$'+lst);
                }
                if(lst!=null)
                UpdateController.updatemethod(lst);
            }
    }       
}
I am getting the following error. Please can anyone give some idea to achieve this .
TriggerInsertorupdate : execution of AfterInsert caused by: System.CalloutException: Callout from triggers are currently not supported. Class.class1.getContent: line 112, column 1 
Thanks in Advance,
Sirisha
Hi Everyone,

I am trying to reproduce the scenario as below link. Created a user as Salesforce Platform licence, trigger and when I logged in as Salesforce Platform User licence and created contact and updated not able to get the error.

https://www.sundoginteractive.com/blog/triggers-updating-restricted-records

Can anyone suggest me on this?

Thanks,
Sirisha
Hi everyone,

 I have a requirement where we need to display one recordtype picklist value to only one profile. We have around 100 recordtypes on an object. Each recordtype has around 10 picklist fields. Need to identify a picklist value is there in remaining recordtypes. Also there is field dependencies on these fields. Let say if we select Field1 will show the values specific in Field2 specific to that RT.

Example : Case Object -> Multiple RT's-> Multiple Picklist fields -> Values.

Is there any we can retreive the value of picklist field from recordtype using soql? or We need to write code for this instead of selecting the values manually. Any ideas?

Thanks,
Sirisha

 
Hi All,

We have a request to delete the record type in our organization. Is there any way to check the dependencies on record type and page layouts?

Any ideas or suggestions on this? Thanks!
Hi All,
We have a requirement where we need to merge two accounts. Master account has few contacts and other one has few. 

Once we merge the accounts, I think related contacts will not added to Master account. If it is not then how do we update accountid to existing contact using Dataloader / import wizard?

Please let me know.

Thanks,
Sirisha
Hi All,

We have a created a user and given all the required permissions to that user to run batch job. When we run the job manually it is running successfully, but do the same while scheduling it is failing. throwing the error as "System.LimitException: reports:Too many query rows: 50001
".
I have given all the permissions to objects, related fields Custom settings.
1. I have given "Manage custom report" permission and "View All custom setting" permission for custom settings. Do we need to give any other permission related to custom setting or metadata or report. Is there anything I am missing while granting permission.
Can anyone help me on this who have experienced the same issue.

Thanks,
Sirisha
Hi All,
I have couple of questions.
1. I have a class which is using Custom metadata type. Need to know whether this metadata type has permission to user.
How do we know that a user's profile has a permission to a metadata?
2. I have batch class which is having method and passing parameters as SObject and update the SObject. Which object will the user will need permission?
3. How to create report to track for pending approval request?

Any help will be greatly appreciated.

Thanks,
Sirisha

 
Hi All,

 Can anyone please explain to me how do you handle production issues in your project. what is the approach? 
Do you use Jira tool to raise a ticket for the case?

Say for example if we have 100 users and if one user is not receiving the email sent out of 100 users. what approach can be followed? And how can we fix the issue?

Thanks,
Sirisha
Hi All,

I have a user object with a username field. When I try to enter a letter, it should show all the values that start with that letter.

Say, for example, If I enter a letter J, it should display all the names that start with J like John, Jeff and so on.

How to implement this functionality using vf page?

Thanks,
Sirisha
Hi All,

If we have 2 record types with different fields and If we insert or update the records using data loader with specific record type like record type A.

Will it insert in that record type only or both? or If we give data to that both fields in both records irrespective of record type we give it will insert both fields in both records.

Thanks,
Sirisha
Hi All,

I am trying to create a new contact. Once the record is saved in Salesforce, an email need to be sent along with the unique id.

I have created a formula field for the Unique ID and associated record ID to this field.

Now, when I try to send an email with Unique ID, it shows null value.

<apex:page controller="SubmitNewContactController" docType="html-5.0">
   
    <apex:form>
        <apex:slds/>
    <apex:pageMessages></apex:pageMessages>
        <div class="slds-scope slds-box">
         <apex:outputPanel >
            <div class="slds-text-align_center slds-text-heading_medium"><p>Submit New Contact </p></div>
             <div class="slds-form-element">
                    <label class="slds-form-element__label"><abbr class="slds-required"></abbr> FirstName</label>
                <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!FirstName}" styleClass="slds-input" id="FirstName" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> LastName</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!LastName}" styleClass="slds-input" id="LastName" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> Phone</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!Phone}" styleClass="slds-input" id="Phone" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> Email</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!Email}" styleClass="slds-input" id="Email" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> Zipcode</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!Zipcode}" styleClass="slds-input" id="Zipcode" />
                </div>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:commandButton action="{!SubmitContact}" value="Submit"/> 
                </div>
            </div>
         </apex:outputPanel>   
        </div>
        
    
    </apex:form>
</apex:page>
public class SubmitNewContactController {
    public Contact c{get;set;}
    public String FirstName{get;set;}
    public String LastName{get;set;}
    public String phone{get;set;}
    public String Email{get;set;}
    public String Zipcode{get;set;}
    
    public SubmitNewContactController(){
        c = new Contact();
    }
    
    public PageReference SubmitContact(){
        c.FirstName = FirstName;
        c.LastName = LastName;
        c.phone = phone;
        c.Email = Email;
        c.MailingPostalCode = Zipcode;
        insert c;
        
        PageReference pr = new PageReference('/apex/ThankYouPage');
        Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
        String[] sendingTo = new String[]{c.Email};
        semail.setToAddresses(sendingTo);
        semail.setSubject('Registration is completed');
        semail.setPlainTextBody('Hi'+ c.name+'Thank you for registering.This is your UniqueID'+ c.Unique_ID__c);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail});
        pr.setRedirect(true);
        return pr;
        
        
        
    }
    

}

I am able to send the email but cannot capture the name and uniqueId in the email. It shows null in the email.
Can anyone please help me to fix the code?

Thanks,
Sirisha
 
Hi All,

 I am trying to pass the contact data from parent to child component on click of a button. Also, hide the parent component and show the child component using the lightning web component.
I have implemented this using lightning component.
Below is the sample code:

Parent component:
-----------------
<aura:component controller="login">
    
    <aura:attribute name="contact" type="Contact"/>
    <aura:registerEvent name="Authorizelogin" type="c:Authorizeloginevent"/>
    <div class="slds-hide" aura:id="login">
        <c:Authorizelogincontactdetails/>
    </div>
    <lightning:input name="UNAME" required="true" type="String" value="{!v.contact.LoginId__c}"/>
    <lightning:input name="PWD" required="true" type="String" value="{!v.contact.Password__c}"/>
    <lightning:button variant="brand" label="Submit" onclick="{!c.handlecontactdetails}"/>
</aura:component>

helper:
------

({
    contact : function(component,event,helper) {
        var action = component.get("c.getcontact");
        action.setParams({
            "uname":component.get("v.UNAME"),
            "pwd" : component.get("v.PWD")
        });
        action.setCallback(this,function(a){
            var response = a.getState();
            if(response==="SUCCESS"){
                var con = response.getReturnvalue();
            var myEvent = $A.get("e.c:Authorizeloginevent"); 
                myEvent.setParams({
                    "contact" : con
                });
                myEvent.fire();
            }
        });
    $A.enqueueAction(action);    
    }
})

child component:
---------------
<aura:component controller="login" >
    <aura:attribute name="FirstName" type="String"/>
    <aura:attribute name="LastName" type="String"/>
    <aura:attribute name="Email" type="String"/>
    <aura:attribute name="Phone" type="Integer"/>
    <aura:handler event="c:Authorizeloginevent" action="{!c.contactdetails}"/>
    <ui:output value="{!v.FirstName}"/>
    <ui:output value="{!v.LastName}"/>
    <ui:output value="{!v.Email}"/>
    <ui:output value="{!v.Phone}"/>
    
</aura:component>
helper:
-------
({
    contactdetails : function(component,event,helper) {
        
        var  con = event.getParam("contact");           
        
        component.find("LastName").set("v.value",con.LastName);
        component.find("FirstName").set("v.value",con.FirstName);
        component.find("Email").set("v.value",con.Email);
        component.find("Phone").set("v.value",con.Phone);
        
    }
})


I have referred to some documentation, recipes. But not able to get the idea on how to do the same in the lightning web component.
Can anyone please give me some sample code or any idea on how to do the same approach using the lightning web component.
Any help would be greatly appreciated.

Thanks
 
Hi All,
Can we make Rest API call from a batch and if so how can we call?

Thanks
Hi All,

 I am trying to push the lightning web component recipes to scratch org.
I have authorized the org, Devhub and created a scratch org.User-added image

I am not able to see the recipes in the scratch org.
User-added image
Please anyone can guide me where I am doing the mistake.
Thanks,
Sirisha
 
Hi All,

I created a user with the Standard User Profile. Now, when I log in as that user and try to clone the profile, it is saying Insufficient Permissions.

Only a System Administrator can create and Clone Profile? Can a Standard User profile clone a profile?

Thanks,
Sirisha
 
Hi All,

 I am trying to update the account upon lead update.
Need help to optimize my code. Just want to avoid multiple for loops.

public class LeadAfterUpdateHandler {
    
    public static void updateRelatedAccount(List<Lead> newLeads, Map<Id,Lead> LeadOldMap){
        List<Lead> ChangedLeads = new List<Lead>();
        Map<String,String> LeadAccFieldsMap = new Map<String,String>();
        List<Account> accList = new List<Account>();
        List<Lead_to_Account_Sync__c> csList = [Select Id,Account_Field_Name__c,Lead_field_Name__c from Lead_to_Account_Sync__c];
        for(Lead_to_Account_Sync__c cs : csList){
           
            LeadAccFieldsMap.put(cs.Lead_field_Name__c,cs.Account_Field_Name__c) ;  
            }
        }
        for(Lead l : newLeads){
            for(String cs1 : LeadAccFieldsMap.keySet()){
                if(l.get(cs1) != LeadOldMap.get(l.id).get(cs1)){
                    ChangedLeads.add(l);
                    break;
                }
            }
        }
        
        for(Lead l : ChangedLeads){
            Account a = new Account(Id = l.Account_Id__c);
            a.Name = (String)l.get('LastName');
            for(String cs1 : LeadAccFieldsMap.keySet()){
                
                a.put(LeadAccFieldsMap.get(cs1),(String)l.get(cs1));
                system.debug('for a :::' + a);
            }
            system.debug('a:::' + a);
            accList.add(a);
            
        }
        
        if(accList.size() > 0){
            update accList;
        }
    }

}
Thanks,
Sirisha
Hi All,

I have created login form with username and passsword.I have created new custom fields in the contact object.
On click of submit button.It will validates the contact is existing or not and returns contact's FirstName,LastName,Email,Phone.

For this I created a RESTAPI which will take the username and password as a parameters and validates against the credentials and  returns the contact details for that valid user.Login form i have created in my org. using lightning.

Now my challenge is  when the user clicks on submit button it should get the contact details from the RESTAPI and maps with the contact object fields and   reload or refresh the page with contact details and displays the field values FirstName,LastName,Email and Phone.
I am trying to pass the variables or map the variables which are returned from REST API to APEX.

How can I acheive this scenario.Do I need to create another lightning component to refresh the parent component to child component and returns the login contact details.

If anyone can provide a sample code that would be a great help.

Any help would be greatly appreciated.

Thanks,
Sirisha
Hi All,

I have an object with a start date and an end date. I am trying to create insert weekly dates in one object and a list of dates between the start date and end date in another object.
Object A
start Date    End Date
10/01/2020  10/31/2020
Object B
start date      end date          Object A ID
10/01/2020     10/07/2020
10/07/2020     10/14/2020
10/14/2020     10/21/2020
10/21/2020     10/27/2020
10/27/2020       11/03/2020

Object C
Date              Object BID   Object A ID
10/01/2020
10/02/2020
10/03/2020
---
--
10/31/2020

I have created lookup from Object B to Object A and Object C to Object B and Object C to Object B.
Is it possible to map Object B and Object C. How can I populate Object B Id in Object C? Can anyone send a sample code?

Thanks,
Sirisha
Hi Everyone,

I am trying to pass the current record Id from process builder to apex and then to visual force which embeds lightning component.

public class MyInvocableVariable {
    @InvocableVariable(label='Id' required=true)
    public Id recId;

    }  

<apex:page showHeader="false" sidebar="false">
    <apex:includeLightning />
    
    <div id="lightning" />
    <script>
        $Lightning.use("c:lightningApp", function(){
            $Lightning.createComponent("c:lightningComponent",
                "recId":?, ---> need to pass the Id
                "lightning",
                function(cmp){}
            );
        }            
       );
    </script>

</apex:page>

Anyone, please help with this.

Thanks,
Sirisha
Hi Everyone,

I have a requirement where I need to call the external webservice and populate the fields on insert or update of record.

Already there is a button on record built using lightning component which will pass few values to external system and in return it populates few fields based on the input fields.

the lightning button code looks like below:
Apex:

@AuraEnabled
    public static object__c updatemethod(Id objId) {
        List<Id> dlist = new List<Id>();
        List< object __c> ret;
        dlist.add(objId);
        if(dlist.size()>0){
            ret = class1.updatemethod2(getDetailsByIds(dlist));}
            return ret.get(0);
    }
Global with sharing class class1{
private static List< object __c> calculateDate(List< object __c> dList) {
                              for (object __c d : dList) {
           
            // If date is not filled in, fetch the values
            if (d.Month__c == null && d.Day__c == null &&
                d.Day_g__c != null && d.Month_g__c != null & d.Year_g__c != null) {
                    String[] hDate = getDateFromG(d.Day_g__c, d.Month_g__c,
                                                                              d.Year_g__c, d.IsChecked__c);
                    d.Year__c = hDate[0];
                    d.Month__c = hDate[1];
                    d.Day__c = hDate[2];
            }
Update dlist;
     }  

public static String[] getDateFromG (String dayg, String monthg,
                                                      String yearg, Boolean IsChecked) {
               String url = geturl(dayg, monthg, yearg, IsChecked);
                              System.debug(url);
        String json = getContent(url);

                              String[] ret = new String[3];
                              JSONParser parser = System.Json.createParser(json);
                                                          
                              while (parser.nextToken() != null) {
            system.debug('inside while');
            if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
               if (parser.getText() == 'hy') {
                               // Get the value.
                           parser.nextToken();
                       ret[0] = parser.getText();
                       System.debug('Year='+ret[0]);
               }
               …..
            }
        }
                              return ret;       
    }   
private static String getContent(String url) {
                              // Instantiate a new http object
            Http h = new Http();
           
            // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
            HttpRequest req = new HttpRequest();
            req.setEndpoint(url);
            req.setMethod('GET');
           
            // Send the request, and return a response
            HttpResponse res = h.send(req);
            return res.getBody();
    }
I added the below code when a new record is inserted or updated , it should fire the trigger and callout the url to retrieve and populate the fields in the record.
trigger TriggerInsertorupdate on object__c (after insert, after update) {

if(Trigger.isAfter){
         if(updation.isfutureupdate!=true)
            {
               id lst;
                for(Deceased__c e :Trigger.new)
                {
                    lst=e.Id;
                    system.debug('$$$$$$$$$$$'+lst);
                }
                if(lst!=null)
                UpdateController.updatemethod(lst);
            }
    }       
}
I am getting the following error. Please can anyone give some idea to achieve this .
TriggerInsertorupdate : execution of AfterInsert caused by: System.CalloutException: Callout from triggers are currently not supported. Class.class1.getContent: line 112, column 1 
Thanks in Advance,
Sirisha
Hi Everyone,

I am trying to reproduce the scenario as below link. Created a user as Salesforce Platform licence, trigger and when I logged in as Salesforce Platform User licence and created contact and updated not able to get the error.

https://www.sundoginteractive.com/blog/triggers-updating-restricted-records

Can anyone suggest me on this?

Thanks,
Sirisha
Hi All,
We have a requirement where we need to merge two accounts. Master account has few contacts and other one has few. 

Once we merge the accounts, I think related contacts will not added to Master account. If it is not then how do we update accountid to existing contact using Dataloader / import wizard?

Please let me know.

Thanks,
Sirisha
Hi All,

We have a created a user and given all the required permissions to that user to run batch job. When we run the job manually it is running successfully, but do the same while scheduling it is failing. throwing the error as "System.LimitException: reports:Too many query rows: 50001
".
I have given all the permissions to objects, related fields Custom settings.
1. I have given "Manage custom report" permission and "View All custom setting" permission for custom settings. Do we need to give any other permission related to custom setting or metadata or report. Is there anything I am missing while granting permission.
Can anyone help me on this who have experienced the same issue.

Thanks,
Sirisha
Hi All,

 Can anyone please explain to me how do you handle production issues in your project. what is the approach? 
Do you use Jira tool to raise a ticket for the case?

Say for example if we have 100 users and if one user is not receiving the email sent out of 100 users. what approach can be followed? And how can we fix the issue?

Thanks,
Sirisha
When you click 'View All' on Related List, you get a list view of all the records. How can you customize that page?
I want to remove the 'New' action button on that page
If any contact or lead have the birthday, they should receive SMS
  • July 04, 2019
  • Like
  • 0
Hi All,

I am trying to create a new contact. Once the record is saved in Salesforce, an email need to be sent along with the unique id.

I have created a formula field for the Unique ID and associated record ID to this field.

Now, when I try to send an email with Unique ID, it shows null value.

<apex:page controller="SubmitNewContactController" docType="html-5.0">
   
    <apex:form>
        <apex:slds/>
    <apex:pageMessages></apex:pageMessages>
        <div class="slds-scope slds-box">
         <apex:outputPanel >
            <div class="slds-text-align_center slds-text-heading_medium"><p>Submit New Contact </p></div>
             <div class="slds-form-element">
                    <label class="slds-form-element__label"><abbr class="slds-required"></abbr> FirstName</label>
                <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!FirstName}" styleClass="slds-input" id="FirstName" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> LastName</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!LastName}" styleClass="slds-input" id="LastName" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> Phone</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!Phone}" styleClass="slds-input" id="Phone" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> Email</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!Email}" styleClass="slds-input" id="Email" />
                </div>
                 <label class="slds-form-element__label"><abbr class="slds-required"></abbr> Zipcode</label>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:input value="{!Zipcode}" styleClass="slds-input" id="Zipcode" />
                </div>
                 <div class=" slds-scope slds-form-element__control">
                    <apex:commandButton action="{!SubmitContact}" value="Submit"/> 
                </div>
            </div>
         </apex:outputPanel>   
        </div>
        
    
    </apex:form>
</apex:page>
public class SubmitNewContactController {
    public Contact c{get;set;}
    public String FirstName{get;set;}
    public String LastName{get;set;}
    public String phone{get;set;}
    public String Email{get;set;}
    public String Zipcode{get;set;}
    
    public SubmitNewContactController(){
        c = new Contact();
    }
    
    public PageReference SubmitContact(){
        c.FirstName = FirstName;
        c.LastName = LastName;
        c.phone = phone;
        c.Email = Email;
        c.MailingPostalCode = Zipcode;
        insert c;
        
        PageReference pr = new PageReference('/apex/ThankYouPage');
        Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
        String[] sendingTo = new String[]{c.Email};
        semail.setToAddresses(sendingTo);
        semail.setSubject('Registration is completed');
        semail.setPlainTextBody('Hi'+ c.name+'Thank you for registering.This is your UniqueID'+ c.Unique_ID__c);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail});
        pr.setRedirect(true);
        return pr;
        
        
        
    }
    

}

I am able to send the email but cannot capture the name and uniqueId in the email. It shows null in the email.
Can anyone please help me to fix the code?

Thanks,
Sirisha
 
Hi All,

 I am trying to pass the contact data from parent to child component on click of a button. Also, hide the parent component and show the child component using the lightning web component.
I have implemented this using lightning component.
Below is the sample code:

Parent component:
-----------------
<aura:component controller="login">
    
    <aura:attribute name="contact" type="Contact"/>
    <aura:registerEvent name="Authorizelogin" type="c:Authorizeloginevent"/>
    <div class="slds-hide" aura:id="login">
        <c:Authorizelogincontactdetails/>
    </div>
    <lightning:input name="UNAME" required="true" type="String" value="{!v.contact.LoginId__c}"/>
    <lightning:input name="PWD" required="true" type="String" value="{!v.contact.Password__c}"/>
    <lightning:button variant="brand" label="Submit" onclick="{!c.handlecontactdetails}"/>
</aura:component>

helper:
------

({
    contact : function(component,event,helper) {
        var action = component.get("c.getcontact");
        action.setParams({
            "uname":component.get("v.UNAME"),
            "pwd" : component.get("v.PWD")
        });
        action.setCallback(this,function(a){
            var response = a.getState();
            if(response==="SUCCESS"){
                var con = response.getReturnvalue();
            var myEvent = $A.get("e.c:Authorizeloginevent"); 
                myEvent.setParams({
                    "contact" : con
                });
                myEvent.fire();
            }
        });
    $A.enqueueAction(action);    
    }
})

child component:
---------------
<aura:component controller="login" >
    <aura:attribute name="FirstName" type="String"/>
    <aura:attribute name="LastName" type="String"/>
    <aura:attribute name="Email" type="String"/>
    <aura:attribute name="Phone" type="Integer"/>
    <aura:handler event="c:Authorizeloginevent" action="{!c.contactdetails}"/>
    <ui:output value="{!v.FirstName}"/>
    <ui:output value="{!v.LastName}"/>
    <ui:output value="{!v.Email}"/>
    <ui:output value="{!v.Phone}"/>
    
</aura:component>
helper:
-------
({
    contactdetails : function(component,event,helper) {
        
        var  con = event.getParam("contact");           
        
        component.find("LastName").set("v.value",con.LastName);
        component.find("FirstName").set("v.value",con.FirstName);
        component.find("Email").set("v.value",con.Email);
        component.find("Phone").set("v.value",con.Phone);
        
    }
})


I have referred to some documentation, recipes. But not able to get the idea on how to do the same in the lightning web component.
Can anyone please give me some sample code or any idea on how to do the same approach using the lightning web component.
Any help would be greatly appreciated.

Thanks
 
Hi All,

 I am trying to push the lightning web component recipes to scratch org.
I have authorized the org, Devhub and created a scratch org.User-added image

I am not able to see the recipes in the scratch org.
User-added image
Please anyone can guide me where I am doing the mistake.
Thanks,
Sirisha
 
Hi All,

I created a user with the Standard User Profile. Now, when I log in as that user and try to clone the profile, it is saying Insufficient Permissions.

Only a System Administrator can create and Clone Profile? Can a Standard User profile clone a profile?

Thanks,
Sirisha
 
Hi All,

 I am trying to update the account upon lead update.
Need help to optimize my code. Just want to avoid multiple for loops.

public class LeadAfterUpdateHandler {
    
    public static void updateRelatedAccount(List<Lead> newLeads, Map<Id,Lead> LeadOldMap){
        List<Lead> ChangedLeads = new List<Lead>();
        Map<String,String> LeadAccFieldsMap = new Map<String,String>();
        List<Account> accList = new List<Account>();
        List<Lead_to_Account_Sync__c> csList = [Select Id,Account_Field_Name__c,Lead_field_Name__c from Lead_to_Account_Sync__c];
        for(Lead_to_Account_Sync__c cs : csList){
           
            LeadAccFieldsMap.put(cs.Lead_field_Name__c,cs.Account_Field_Name__c) ;  
            }
        }
        for(Lead l : newLeads){
            for(String cs1 : LeadAccFieldsMap.keySet()){
                if(l.get(cs1) != LeadOldMap.get(l.id).get(cs1)){
                    ChangedLeads.add(l);
                    break;
                }
            }
        }
        
        for(Lead l : ChangedLeads){
            Account a = new Account(Id = l.Account_Id__c);
            a.Name = (String)l.get('LastName');
            for(String cs1 : LeadAccFieldsMap.keySet()){
                
                a.put(LeadAccFieldsMap.get(cs1),(String)l.get(cs1));
                system.debug('for a :::' + a);
            }
            system.debug('a:::' + a);
            accList.add(a);
            
        }
        
        if(accList.size() > 0){
            update accList;
        }
    }

}
Thanks,
Sirisha
Hi All,

I am trying to get all the cases and related email that is recently sent to the customer.
 I am able to display all the casenumbers, but not the last email sent. 
Below is my code. 

public class CaseRelatedListApex {
    
    @AuraEnabled
    public static List<Case> getObject(Id  sessId){
        LIST< session__c > objsessList = new LIST< session__c >();
        LIST< Case > objCaseList = new LIST< Case >();
      
        
             if(sessId!=null)
        {
           objCaseList =[select id,session_ID__c,CaseNumber from case where  session_ID__c =:sessId  limit 4];
          
        }
         return  objCaseList;
        }
       @AuraEnabled
    public Static List<Datetime> getmessagedt(List<Case> objCaseList){
     // Case  objCase = new Case (); 
     List<DateTime> dt = new List<DateTime>();
        if(objCaseList.size()>0)
        {
            for(Case objCase :[select id,session_ID__c,CaseNumber,(select id,MessageDate from EmailMessages where incoming = False order by MessageDate desc limit 1) MessageDt from case where ID = :objCaseList ]){
                for(EmailMessage e : objCase.EmailMessages){
                    dt.add(e.MessageDate);
                }
            }
           
        } 
        return  dt;
    }
   
}
Component:
<aura:component controller = "CaseRelatedListApex" implements="force:appHostable,flexipage:availableForAllPageTypes,home:availableForDesktop,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
    <aura:attribute name="sessId" type="String"/>
    <aura:attribute name="cases" type="Case[]"/>
    <aura:attribute name="caseId" type="Id"/>
    <aura:attribute name ="cas" type="Case"/>
    <aura:attribute name="LastEmail" type="Datetime"/>
    <aura:handler name="init" value="{!this}" action="{!c.check}" />
    <aura:attribute name="totalCases" type="String"/>
   

    
    <form class="slds-form_horizontal" role ="list">
        <article class="slds-card">
                            <div class="slds-card__header slds-grid" >
                                <header class="slds-media slds-media--center slds-has-flexi-truncate">
                                    <div class="slds-media__figure">
                                        <lightning:icon iconName="standard:case" size ="small" alternativeText="Case" />
                                    </div>
                                    <div class="slds-media__body slds-truncate">
                                        <h2> <b> <span class="slds-text-heading--small">Cases ({!v.totalCases})   </span> </b></h2>
                                    </div>
                                </header>
                                 </div>
       <table  style ="margin-left :10px;">
           <thead>
               <tr >
                   <th scope="col" style ="font-weight:normal" >
                           <h1> <span >Case Number:</span></h1>
                    </th>
                    <th scope="col" style ="font-weight:normal">
                        <h1> <span >Last Email:</span></h1>
                    </th>
                    
               </tr>
           </thead><br/>
            <tbody>
                <aura:iteration items="{!v.cases}" var="ocas">
                  <tr class="slds-text-title" style ="font-size: .8125rem" >                  
                    <!--<td style =" color: rgb(22, 50, 92); text-decoration: dotted underline;">-->
                      <td>
                        <a href="#"  data-recId="{!ocas.Id}"  onclick="{!c.handleClick}">{!ocas.CaseNumber}</a>
                      </td>
                    <!--</td>-->
                    <td>
                        {!v.LastEmail}
                    </td>
                                       
                  </tr>
                </aura:iteration> 
            </tbody>
        </table><br/>
        </article>
    </form>
       
      
</aura:component>
Helper:
({
    getCases : function(Component,event,helper) {
        var action= Component.get("c.getObject");
        var sessId = Component.get("v.recordId");
        
        action.setParams({
            "sessId" :sessId
        });
        action.setCallback(this,function(response){
            var state=response.getState();
                       
            if (Component.isValid() && state === "SUCCESS") {               
                //alert('Cases');
                 Component.set("v.cases",response.getReturnValue());
                 var caseCount = Component.get("v.cases").length;
                 Component.set("v.totalCases",caseCount);
                 console.log("caseCount "+caseCount);
                 var action1 = component.get("c.getmessagedt");
                 var cas = Componenet.get("v.cases");
                 action1.setParams({
                    "objCaseList":cas
                });
                action1.setCallback(this,function(response){
                var state=response.getState();
                       
                if (Component.isValid() && state === "SUCCESS") {               
                //alert('Cases');
                Component.set("v.LastEmail",response.getReturnValue());
                
            }
        });
           $A.enqueueAction(action1);     
            }
        });
        
        $A.enqueueAction(action);
    },
    navigateTorecordDetails :function(Component,event,helper){
       console.log('@@@ MovetoDetailPage method calls');
        var idstr = event.target.getAttribute("data-recId")
        console.log('@@@ CaseId ==> ' + idstr);
       var navEvt = $A.get("e.force:navigateToSObject");
       if(navEvt!=undefined){
           navEvt.setParams({
               "recordId": idstr
           });
           navEvt.fire();
       }
        $A.enqueueAction(action);
    }
})

getting error as "This page has an error. You might just need to refresh it. Error in $A.getCallback() [component is not defined] Callback failed: apex://CaseRelatedListApex/ACTION$getObject" 
Please help me to fix the error.

Thanks,
Sirisha
Hi All,

I am trying to get the object prefix of Parent objects from child object.
In Case, I have the lookup to Opportunity and 2 custom objects. Here In my scenario, I am trying to create 2 records if an email is sent out to the customer. So, If an email is sent related to Opportunity object, my custom object field need to populate only opportunity id. Similarly with other objects should populate the caseid and that objectid.
I have written my code something like this.
 for(Case cs : Trigger.New){
        
        if(cs.Email_Template__c != Null && cs.Email_Template__c != ''){
            
            e = new EmailNotifications();
            e.CaseId= cs.id;
            e.OpporunityId = cs.Opportunity__c;
            e.EngagementId = cs.Engagement_ID__c;
            e.SessionId = cs.Session_ID__c;
            EmailList.add(e);            
        } 
        
    }
        if(EmailList.size()>0){
            CaseHandler.sendEmail(EmailList,MapEmailTemplate);
        }
public static void sendEmail(List <EmailNotifications> EmailList ,Map <String , CaseEN__c > MapParentEmailTemplate){
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
        List<Email_Notification__c> reminderNotification = new List<Email_Notification__c>();
        List<Email_Notification__c> updatereminderNotification = new List<Email_Notification__c>();
Map<Id, Id> map_Formfields = new Map<Id, Id>();
        
        for(EmailNotifications en:Emaillist){
           
            string myIdPrefix;
            myIdPrefix = String.valueOf(en.CaseId).substring(0,3);
            if(myIdPrefix == '006'){
            map_Formfields.put(en.CaseId,en.OpporunityId);
            }
            if(myIdPrefix == 'a00'){
                map_Formfields.put(en.CaseId,en.EngagementId);
            }
            if(myIdPrefix == 'a05'){
                map_Formfields.put(en.CaseId,en.SessionId);
            }
            Messaging.SingleEmailMessage mail =  new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[] {'abc@abc.com'};
                system.debug('toAddresses' +toAddresses);
            mail.setToAddresses(toAddresses);
            mail.setSubject('Hi');
            system.debug('hi');
            mail.setSenderDisplayName('Hi');
            system.debug('xyz');
           
            String body = 'Dear ' + cas.ContactEmail + ', ';
            body += 'First mail';
            system.debug('body'+body);
            mail.setHtmlBody(body);
            mail.setWhatId(cas.Id);
            mails.add(mail);
           
            List<Messaging.SendEmailResult> list_mr =Messaging.sendEmail(mails);
             Integer i=0;
            for(Messaging.SendEmailResult ser : list_mr){
                if(ser.isSuccess()){
                    Messaging.SingleEmailMessage maill = mails[i];
                    Id caseId = maill.getwhatId();
                    system.debug('caseId'+caseId);
                    Id ObjId = map_Formfields.get(caseId);
                   ManageEmailNotification( etname , myIdPrefix , ObjId,caseId,Emaillist);
                }
            }
             public static void ManageEmailNotification(String EmailTemplateName , String ObjectType , String ObjectId , Id caseId,List <EmailNotifications> EmailList){
                   list<Email_Notification__c> notificationlist = new list<Email_Notification__c>();
                List<Email_Notification__c> reminderNotification = new List<Email_Notification__c>();
                List<Email_Notification__c> updatereminderNotification = new List<Email_Notification__c>();
                for(EmailNotifications en : EmailList){
                    if (ObjectType == '006') 
                {
                     en.OpporunityId = ObjectId;  
                } 
               if (ObjectType == 'a00') 
                {
                     en.EngagementId= ObjectId;  
                } 
                if (ObjectType == 'a05')
                {
                    system.debug('ObjectType'+ObjectType);
                    en.SessionId = ObjectId; 
                    system.debug('ObjectId'+ObjectId);
                   system.debug('ObjectId'+en.SessionId); 
                }
            /*After Sending the Scheduled Email , Details will be updated to  Email Notification Object*/ 
            Email_Notification__c em= new Email_Notification__c();
            if(en.ScheduledFlag == False){
                system.debug('scheduled flag'+en.ScheduledFlag);
                if(en.OpporunityId != null)
                             {
                                 em.opportunity__c = en.OpporunityId;
                             }
                             else if (en.SessionId != NUll){
                                 em.Session__c = en.SessionId;
                             }
                             else if (en.EngagementId != NULL){
                                 em.Engagement__c = en.EngagementId;
                             }
                em.Case__c = en.CaseId; 
                em.Status__c = 'Sent';
               
                em.Email_Template__c = en.EmailName;
                notificationlist.add(em);    
            }
            /*After Sending the Scheduled Email , Details will be updated to  Email Notification Object*/  
            system.debug('Scheduled Flag boolean'+en.ScheduledFlag);
            system.debug('EmailTemplateName'+en.EmailTemplateName);
            
            if(en.ScheduledFlag == True){
                system.debug('update ');
                Email_Notification__c updatelist = new Email_Notification__c();
                system.debug('opp id'+en.OpporunityId);
                system.debug('Email_Template__c :::'+ en.EmailName );
                
                updatelist = [select id,status__c,Sent_Date__c from Email_Notification__c where   Opportunity__c = :en.OpporunityId ];
               
                updatelist.Status__c = 'Sent';
                
                updatereminderNotification.add(updatelist);
                break;
                
            }
           
            /*Check if the any remainder emails need scheduled*/
            if(en.ParentEmail == em.Email_Template__c ){
                
                Email_Notification__c em1 = new Email_Notification__c();
                if(en.OpporunityId != null)
                             {
                                 em1.opportunity__c = en.OpporunityId;
                             }
                             else if (en.SessionId != NUll){
                                 em1.Session__c = en.SessionId;
                             }
                             else if (en.EngagementId != NULL){
                                 em1.Engagement__c = en.EngagementId;
                             }
                em1.Case__c = en.CaseId;
               
                em1.Status__c = 'Scheduled';
                system.debug('em1'+em1.Status__c);
               
                system.debug('em1'+em1.Scheduled_Date__c);
                em1.Email_Template__c = en.getParentname(en.ParentEmail).Name;
                system.debug('em1'+em1.Email_Template__c);
                
               
                reminderNotification.add(em1); 
                
                
            }
        }
        if(notificationlist.size()>0){
           
            insert notificationlist;
        }
        if(updatereminderNotification.size()>0){
           
            Update updatereminderNotification;
        }
        if(reminderNotification.size()>0){
           
            
            insert reminderNotification;
        }
    }

1) How to dynamically I pass the object Id for that particular case?
2) Is there any way I can pass the object name and get the Opportunity prefix or other custom objects?
3) How to avoid writing code multiple times?
4) How to pass id dynamically in Update query 
select id,status__c,Sent_Date__c from Email_Notification__c where   Opportunity__c = :en.OpporunityId

Please anyone help me on this?
Any help will be greatly appreciated.

Thanks,
Sirisha         
Hi All,

I have 10 fields in my lead which are common in Account.Im trying to insert Account record before i insert in lead and get that accountid and populate the acctid in lead.
I tried below code.It is inserting the record in Account object and also getting the accountId in lead ,but i want remaining fields need to be populate in that record when account record is inserted.I see fields are showing the values but in my UI the fields are blank.
below is the code i tried:

trigger AccountCreationOnLead on Lead (before insert,after Insert,after Update) {
   
    list<Account> accountlist = new List<Account>();
    List<Lead> updateleadacctId = new List<Lead>();
     
   
   
     //Collect list of leads being inserted without an account
    List<Lead> needAccounts = new List<Lead>();
    for (Lead c : trigger.new) {
        if (String.isBlank(c.Account_Id__c)) {
            needAccounts.add(c);
        }
    }
        
        if (needAccounts.size() > 0) {
        List<Account> newAccounts = new List<Account>();
        Map<String,Lead> LeadsByNameKeys = new Map<String,Lead>();
        Map<String,Lead> LeadsByPhoneKeys = new Map<String,Lead>();
        Map<String,Lead> LeadsByWebsiteKeys = new Map<String,Lead>();
        //Create account for each lead
        for (Lead c : needAccounts) {
            String accountName = c.firstname + ' ' + c.lastname;
            
            String phone = c.Phone;
            String website = c.Website;
            LeadsByNameKeys.put(accountName,c);
            LeadsByPhoneKeys.put(phone,c);
            LeadsByWebsiteKeys.put(website,c);
            Account a = new Account(name=accountName,Phone = phone,Website = website);
            newAccounts.add(a);
            system.debug('new account'+newAccounts);
        }
            insert newAccounts;
            system.debug('inserted'+newAccounts);
        
        
        for (Account a : newAccounts) {
            //Put account ids on leads
            if (LeadsByNameKeys.containsKey(a.Name)) {
                LeadsByNameKeys.get(a.Name).Account_Id__c = a.Id;
            }
            
        }
        
       
        
    }
}
            
 Account a = new Account(name=accountName,Phone = phone,Website = website)
above line shows me value in debug log as 04:20:02:180 USER_DEBUG [35]|DEBUG|inserted(Account:{Name=sai Not Assigned, Phone=8987879, Website=www.test.com, Id=0014D00000EnHcWQAV})     
    Please can anyone help me on this.Any help will be greatly appreciated.

Thanks,
Sirisha
       
        
        
    
    
    
 
Hello,

I have an issue executing a report from Apex. I am getting the Fatal Error "Too many query rows: 50001" when I execute the method "Reports.ReportManager.runReport(reportId, reportMetadata, includeDetails)".

The report returns 13.000 contacts, but when I execute it from apex, it only return the first 2,000 contacts. To get all the records y execute the same report adding a new filter to exclude the contacts I already got adding "Reports.ReportFilter('Contact.Id', 'greaterThan', lastContactId);"

So if the report must return 13,000 records, I will have to run the report 8 times. Every time I run the report I consult the limits and I always get 3 in "Limits.getQueryRows()", but when is executing the report for 5th time I get this exception "System.LimitException: reports:Too many query rows: 50001"

My conclusion is that as the report has 13,000 records, it adds to the limit 13,000 records to the limit everytime the report is executed, so if the report has 50,000 record I will not be able to execute the report not eve once. But if I check the limit with "Limits.getQueryRows()" I will always get 3 records, and never 50,001.

Can anyone help me with this issue? Has anyone launched a report with more than 50,000 records from apex?

Thank you