• Amit M 3
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 7
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 8
    Replies
Hi,
I am getting below error while deploying a protected custom settings to enterprise org, which is on Spring'20 release.

Custom Object You can't set the visibility for a Custom Setting to Protected unless you are in a developer or scratch org.

Looks like below release update has impacted the deployment of custom settings,
https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_forcecom_custom_settings_org_visibility.htm

Has anybody faced this issue and know how it can be handled? Thanks in advance.
When I am using Reports.ReportManager.runReport(joinedReportId) method to execute the joined report, I am getting FeatureNotSupported exception.
Has anyone come across this error before? Is this known issue?

Thanks in advance!
I have requirement to do pagination for around 10000 records. However it is not possible with using OFFSET as it has limitation for 2000 records. I cannot use StandardSetController in AuraEnabled method context either. 

Is there any other possible way that can be tried?
Hi,

I am trying to read the connected app metadata, which is in a managed package. I am using Metadata service class to read the metadata. However currently it is throwing exception: System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 66999130-178868 (-1199278215).

But same code works fine when I am reading a connected app metadata which is not inside managed package.

That gives me impression, Salesforce doesn't allow retrieving of connected app metadata from inside a managed package. Is that a fair understanding?

Thanks for help in advance!
I can see the documentation for 'Lightning data grid - In context search' at this link. However it doesn't provide the information on how to use this particular feature. Does anybody has any idea on how to use this? I want to use this feature along with lightning design system data grid.
User-added image
There are few reports which are autmatically added in our managed package creation org. These reports are visible under package components and in the 'included by' column it is showing other reports name which was added to package long back.

We have no clue how and when these reports got added in the org and in the package components. When we are clicking on the name of these reports, it is showing 'Insufficient Priveleges' error. There is no option to delete these reports as well.

If anyone has faced such kind of issue then let me know how to fix this?
I am not able to clear challenge 5 of 'Lightning Experience Specialist superbadge'. It keep giving me below error,
User-added image

However I have tested the approval process multiple times and it is working as expected.
Thanks in advance for any help.
Getting below error while submitting this challenge. However I passed the approval process challenge.
User-added image
Any clue?
I know that there can be 200 maximum records at a time in trigger context. And if we are processing more than 200 records (either through data loader or through DML operation) trigger breaks those records in to chunk of 200 records and then processes it. What I want to know, if this whole processing of more than 200 records in trigger is counted as SINGLE TRANSACTION or more than one TRANSACTION?
I do not see any option on the page, however the challenge section says that 'This unit doesn't have a challenge. You can still earn points by marking the unit as read. Good job!' 
This is for Creating and Customizing Lightning Apps trail.
I am not able to clear challenge 5 of 'Lightning Experience Specialist superbadge'. It keep giving me below error,
User-added image

However I have tested the approval process multiple times and it is working as expected.
Thanks in advance for any help.
I do not see any option on the page, however the challenge section says that 'This unit doesn't have a challenge. You can still earn points by marking the unit as read. Good job!' 
This is for Creating and Customizing Lightning Apps trail.
Hi,
I am getting below error while deploying a protected custom settings to enterprise org, which is on Spring'20 release.

Custom Object You can't set the visibility for a Custom Setting to Protected unless you are in a developer or scratch org.

Looks like below release update has impacted the deployment of custom settings,
https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_forcecom_custom_settings_org_visibility.htm

Has anybody faced this issue and know how it can be handled? Thanks in advance.
I have requirement to do pagination for around 10000 records. However it is not possible with using OFFSET as it has limitation for 2000 records. I cannot use StandardSetController in AuraEnabled method context either. 

Is there any other possible way that can be tried?
Hi everyone,
I have create a apex class,used  for updating the discount fields from account into Opportunity/QuoteLineItem fields.
 
public class DistributorDiscountChangeTriggerClass
{
     
   @future /* Due to Apex CPU Time Limit issue we used @future annotation */
     public static void DisupdService(set<Id> accByIds) /* Get the value from Apex */
    {
       if(checkrecursive.runonce()) 
           /*checkRecursive Class - used for run the trigger one time */
    
{
    try // Try -block
  {
       // Get the Open Opportunity Id, Distributor (Account ID) of the particular account. //
         Map<Id, Opportunity> oppByIds = new Map<Id,Opportunity>([SELECT Id,Distributor__c FROM Opportunity WHERE Distributor__c IN:accByIds AND IsClosed = FALSE]);        
         System.debug('Opportunity ID' +oppByIds.size());
      
        // Get the Quotelineitem details by using filtered Open Opportunity(oppByids) //
         List<QuoteLineItem> qlitmp= new List<QuoteLineItem>([select id,quote.opportunity.Distributor__c,Disti_Service_Product_Temp_Hidden__c,quote.opportunity.Override_Renewal_Discount__c,quote.opportunity.RecordType.name,Distributor_Discount_1__c,quote.opportunity.Distributor__r.Distributor_Discount_Renewal__c,product2.family,quote.opportunity.Distributor__r.Distributor_Discount_Service__c ,quote.opportunity.Distributor__r.Distributor_Discount_Product__c from quotelineitem where quote.opportunityID IN: oppByIds.keyset() and product2.family='Service']); 
     System.debug('qlitmp -list'+qlitmp.size());  
      
        //Get the details of Open opportunity for Record Type
       List<Opportunity> oppqt= new List<Opportunity>([ SELECT Id,RecordType.name ,Override_Renewal_Discount__c,Distributor__r.Distributor_Discount_Renewal__c,Distributor__r.Distributor_Discount_Product__c,Distributor__r.Distributor_Discount_Service__c,Distributor_Discount_Product_Temp__c,Distributor_Discount_Service_Temp__c,Distributor__c FROM Opportunity WHERE Id IN: oppByIds.keySet() /*FOR UPDATE*/]);
      System.debug('Opportunity -list'+oppqt.size());   
   if ( !accByIds.isEmpty() )  // If account(accbyIds) Id is not null , the process enter into the IF loop
    {
     
        System.debug('Inside if Loop');
       
       
         for ( Opportunity qt: oppqt ) 
         {
        // NST's Record Type == Service Renewal //   
         if(qt.RecordType.name=='Service Renewal' && qt.Override_Renewal_Discount__c==false)
        { 
            System.debug('inside if SR false');
            qt.Distributor_Discount_Service_Temp__c=  qt.Distributor__r.Distributor_Discount_Renewal__c;
             qt.Distributor_Discount_Product_Temp__c= qt.Distributor__r.Distributor_Discount_Product__c;
             System.debug('Distributor_Discount_Renewal__c '+  qt.Distributor_Discount_Service_Temp__c); 
          
        }
      else  if(qt.RecordType.name=='Service Renewal' && qt.Override_Renewal_Discount__c==true)
        { 
            System.debug('inside if SR true');
            qt.Distributor_Discount_Service_Temp__c=  qt.Distributor__r.Distributor_Discount_Service__c;
            qt.Distributor_Discount_Product_Temp__c=qt.Distributor__r.Distributor_Discount_Product__c;
             System.debug('Distributor_Discount_Service__c '+  qt.Distributor_Discount_Service_Temp__c); 
          
        }
             
              //EOF NST's Record Type == Service Renewal //

    else if ( qt.Distributor__c != null) 
    {
                System.debug('Distributor__c!= null');
               qt.Distributor_Discount_Service_Temp__c= qt.Distributor__r.Distributor_Discount_Service__c;
                qt.Distributor_Discount_Product_Temp__c=qt.Distributor__r.Distributor_Discount_Product__c;
             System.debug('opportunity.Distributor_Discount_Service_Temp__c '+  qt.Distributor_Discount_Service_Temp__c); 

           }   
               
         }
         update oppqt;//opp
         }
      for(opportunity optyid : oppqt)
      {
          system.debug('optyid'+optyid.Distributor_Discount_Service_Temp__c);
          system.debug('optyid'+optyid.id);
      }
  /*
 for(quotelineitem qlitemp: qlitmp)
 {
   if(qlitemp.quote.opportunity.RecordType.name=='Service Renewal' && qlitemp.quote.opportunity.Override_Renewal_Discount__c==false && qlitemp.product2.family=='Service')
        { 
            system.debug('1-false');
           
           qlitemp.Disti_Service_Product_Temp_Hidden__c=qlitemp.quote.opportunity.Distributor__r.Distributor_Discount_Renewal__c;
         }
     else if(qlitemp.quote.opportunity.RecordType.name=='Service Renewal' && qlitemp.quote.opportunity.Override_Renewal_Discount__c==true && qlitemp.product2.family=='Service')
        { 
            system.debug('1-false');
           
           qlitemp.Disti_Service_Product_Temp_Hidden__c=qlitemp.quote.opportunity.Distributor__r.Distributor_Discount_Service__c;
         }
  else if(qlitemp.product2.family=='Service' && qlitemp.quote.opportunity.Distributor__c != null)
        {
            system.debug('12');
                 qlitemp.Disti_Service_Product_Temp_Hidden__c=qlitemp.quote.opportunity.Distributor__r.Distributor_Discount_Service__c ; 
        }
        
             }
        update qlitmp;  
  */
        Map<Id, NST__c> nstdisByIds = new Map<Id,NST__c>( [ SELECT Id, Distributor_Account__c FROM NST__c WHERE  Distributor_Account__c IN: accByIds AND NST_Status__c = 'Draft']);                
       System.debug('nstdisByIds ID' +nstdisByIds.size());

     List<NST__c> nstdis = [ SELECT Id,recordtype.id,recordtype.name,Distributor_Account__r.Distributor_Discount_Renewal__c,Distributor_Account__r.Distributor_Discount_Product__c,Distributor_Account__r.Distributor_Discount_Service__c, Product_Contractual_Discount_Temp__c,Service_Contractual_Discount_Temp__c,Distributor_Account__c FROM NST__c WHERE Id IN: nstdisByIds.keySet()];
    System.debug('nstdis -list'+nstdis.size());   
           for ( NST__c qt: nstdis ) 
         {
            System.debug('Inside FOr');
             // NST's Record Type == Service Renewal //
        if(qt.RecordType.name=='Service Renewal')
        { 
            System.debug('inside if');
            qt.Service_Contractual_Discount_Temp__c=  qt.Distributor_Account__r.Distributor_Discount_Renewal__c;
             System.debug('Distributor_Discount_Renewal__c '+  qt.Service_Contractual_Discount_Temp__c); 
        }
        
         // End of NST's Record Type == Service Renewal //
    else if ( qt.Distributor_Account__c != null) 
    {

               qt.Service_Contractual_Discount_Temp__c= qt.Distributor_Account__r.Distributor_Discount_Service__c;
             System.debug('opportunity.Service_Contractual_Discount_Temp__c '+  qt.Service_Contractual_Discount_Temp__c);  
           }       
         }

      update nstdis;  
        system.debug('Updated'+nstdis.size());
           system.debug('Updated'+nstdis);
        
    }

    catch(Exception e)
    {
       system.debug('e'+e);
       

    }
    }
}
}

Please advice.
Thanks in advance.

Regards
Sumitha P
Hello Folks. I have four custom pick up fields in Opportunity. Every opportunity has a look up relationship with Campaign. My trigger will loop through all the opportunity records and if any of the custom pick lists is saved with a value 'Completed '  it updates the count in Campaign's custom field. I coded a trigger an it is working perfect. I need help in optimizing this code cause I feel like I have used too many try-catch blocks and also SOQL statements inside  for loops. Thanks in Advance.
trigger Site_visit_update_in_campaign on Opportunity (after insert,after 
    update,after delete) 
{
    public Boolean s1NullCheck=false;
    public Boolean s2NullCheck=false;
    public Boolean s3NullCheck=false;
    Public Boolean s4NullCheck=false;
    List <Campaign> campaigns=[select id from campaign];
    Set<Id> keysForOpp=new Set<Id>();
    Map<Id,List<Opportunity>> oppList=new Map<Id,List<Opportunity>>();
    List<Id> filteredIds=new List<Id>();
    Campaign[] campaign=new Campaign[]{};
    Map<Id,Campaign> campaignToUpdate=new Map<Id,Campaign>([Select Id,Completed_Site_Visit_1__c,Completed_Site_Visit_2__c,Completed_Site_Visit_3__c,Completed_Site_Visit_4__c From campaign]);

    for(Opportunity oppor:Trigger.new)
    {
        for(Campaign c:campaigns)
        {
            keysForOpp.add(c.Id);
        }

        for(Opportunity o:[Select 
       CampaignId,Site_Visit_1__c,Site_Visit_2__c,Site_Visit_3__c,Site_Visit_4__c From Opportunity Where CampaignId=:keysForOpp])
        {

            try
            {
                List<Opportunity> temp=oppList.get(o.CampaignId);
                if(temp==null)
                {
                    oppList.put(o.CampaignId, new List<Opportunity>{o});
                    filteredIds.add(o.CampaignId);
                }
                else
                {
                    temp.add(o);
                }

            }
            catch(NullPointerException e)
            {
                System.debug('Exception at custom Map setting : 
            '+e.getMessage());
            }

        }

        System.debug('opportunity debug'+opplist);

        for(Id i:filteredIds)
        {
             Integer siteVisitOneCounter=0;
             Integer siteVisitTwoCounter=0;
             Integer siteVisitThreeCounter=0;
             Integer siteVisitFourCounter=0;

            for(Opportunity o:oppList.get(i))
            {



                System.debug('Opportunity after calling key : '+o);

                try
                {
                    if(o.Site_Visit_1__c !=null)
                    {
                        s1NullCheck=true;
                        System.debug('S1check : '+s1NullCheck);
                    }
                }
                catch(NullPointerException e)
                {
                    System.debug('Exeeption at siteVisitOne : '+e.getMessage());
                    System.debug('S1check : '+s1NullCheck);
                }

                try
                {
                    if(o.Site_Visit_2__c !=null)
                    {
                        s2NullCheck=true;
                        System.debug('S2check : '+s2NullCheck);
                    }
                }
                catch(NullPointerException e)
                {
                    System.debug('Exeeption at siteVisitOne : '+e.getMessage());
                    System.debug('S2check : '+s2NullCheck);
                }

                try
                {
                    if(o.Site_Visit_3__c !=null)
                    {
                        s3NullCheck=true;
                        System.debug('S3check : '+s3NullCheck);
                    }
                }
                catch(NullPointerException e)
                {
                    System.debug('Exeeption at siteVisitOne : '+e.getMessage());
                    System.debug('S13heck : '+s3NullCheck);
                }

                try
                {
                    if(o.Site_Visit_4__c !=null)
                    {
                        s4NullCheck=true;
                        System.debug('S4check : '+s4NullCheck);
                    }
                }
                catch(NullPointerException e)
                {
                    System.debug('Exeeption at siteVisitOne : '+e.getMessage());
                    System.debug('S4check : '+s4NullCheck);
                }

                if(s1NullCheck==true)
                {   
                   if(o.Site_Visit_1__c=='Completed')
                   {
                       System.debug('Opportunity : '+o.Site_Visit_1__c);
                       siteVisitOneCounter=siteVisitOneCounter+1;

                   }
                   s1NullCheck=false;
                }

                if(s2NullCheck==true)
                {   
                    if(o.Site_Visit_2__c=='Completed')
                    {
                        System.debug('Opportunity : '+o.Site_Visit_2__c);
                        siteVisitTwoCounter=siteVisitTwoCounter+1;

                    }
                    s2NullCheck=false;
                }

                if(s3NullCheck==true)
                {   
                    if(o.Site_Visit_3__c=='Completed')
                    {
                        System.debug('Opportunity : '+o.Site_Visit_3__c);
                        siteVisitThreeCounter=siteVisitThreeCounter+1;

                    }
                    s3NullCheck=false;
                }

                if(s4NullCheck==true)
                {   
                    if(o.Site_Visit_4__c=='Completed')
                    {
                        System.debug('Opportunity : '+o.Site_Visit_4__c);
                        siteVisitFourCounter=siteVisitFourCounter+1;

                    }
                    s4NullCheck=false;
                }

            }

            System.debug('Site Visit One Total : '+siteVisitOneCounter);
            System.debug('Site Visit two Total : '+siteVisitTwoCounter);
            System.debug('Site Visit three Total : '+siteVisitThreeCounter);
            System.debug('Site Visit four Total : '+siteVisitFourCounter);
            Campaign cam=campaignToUpdate.get(i);
            cam.Completed_Site_Visit_1__c=siteVisitOneCounter;
            cam.Completed_Site_Visit_2__c=siteVisitTwoCounter;
            cam.Completed_Site_Visit_3__c=siteVisitThreeCounter;
            cam.Completed_Site_Visit_4__c=siteVisitFourCounter;

            campaign.add(cam);

            try
            {
                update campaign;
                System.debug('Campaign update Success');
            }
            catch(Exception e)
            {
                System.debug('Failed to update campaig : '+e.getMessage());
            }
        }
    }
}

I have a scenario where a dcotor cannot have more than 8 appointments in a day. I need to write a trigger on Appointment. I have three custom object Patient,Docator and appointment. Appointment have a lookup of both patient and doctor.

I do not see any option on the page, however the challenge section says that 'This unit doesn't have a challenge. You can still earn points by marking the unit as read. Good job!' 
This is for Creating and Customizing Lightning Apps trail.