• niraj kumar 45
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 11
    Replies
Hi I am getiing below error 
System.LimitException: Apex CPU time limit exceeded
Below is my code:
                            for(content_description__c cds: contentDesc){
                                        brandNameStringSet = new set<string>();
                                        for(ContentBrand__c cntBrnd : contentBrandMap.values()){
                                            if(cntBrnd.Content_Description__c!=NULL){ 
                                                if(cds.Id == contentBrandMap.get(cntBrnd.Id).Content_Description__c){
                                                    brandNameStringSet.add(cntBrnd.Brand__r.Name);
                                                }
                                            }
                                        }
                                       mapBrand.put(cds.id,brandNameStringSet);
                                 }
I am getting error at the line which is highlighted in bold in the above code.
I am gettin size for ist for loop is 787 and for the seconf for loop size is 848.
I tried reversing the for loop but still no luck.
I need this both for loop. I cannot remove the for loop.
How do I solve this isue?
I need to implenet SOQl query to fetch records form Sep 2016- to April 2106 from todays date for created records.
Suppose Today is May 2017 so need a SOQL query that fetches me the records from Sep 2016 to April 2016 which should be dynamic for createdDate records.
I can get the last 6 months records with this query
SELECT Id,CreatedDate  FROM content_description__c  WHERE CreatedDate = LAST_N_DAYS:180
how do i fetch the other previous 6 months data for created records?
 
I have an object with 40,000 records. There are 2 user one is Admin user and other is user Mode user.
The user mode user has access to only 10,000 records whereas admin user has access to all the 40,000 records.
If I run my SOQL query with Sharing in Apex class then my Soql will first look in all the 40,000 records and then it will give me 10,000 records which he has access to it or it will directly run on only 10,000 reords to which he has access?

 
I have created a dynamic SOSL Query for existing SOQL query.But I am not getting all the records which I am getting 
form SOQL query.

When I compared the records which are missing from the SOSL then I found that those missing records where Created 5 Years ago from now.
So can this be the reason for not showing the records in SOSL?
I am new to SOSL.Please guide me.
I have a validation rule on master object(Opportunity).I have rollup summary field on parent Object. I am checking in the validation that if no records is there in the child object then fire this validation rule. But i am facing issue while deleting the last child object record which is in the related list of parent as the validation rule fire first and does not allow me to delete the last child record. 
Please let me know how do i update my validation ruleso that it allows me to delete all the child records and should fire when when insert or update the parent record. Below is my validation rule:(Total_Resource_Badge__c is a rollup summary field)

AND(OR( 
ISPICKVAL(StageName, '3. Solutioning'), 
ISPICKVAL(StageName, '4. End-Game'), 
ISPICKVAL(StageName, '5. Negotiation'), 
ISPICKVAL(StageName, 'Won') 
), 
INCLUDES(Delivery_Construct__c , "Involves rebadging of resources") ,
Total_Resource_Badge__c=0)
I am getting System.LimitException: Too many query rows: 50001 at line wher I am Iterating  while (it.hasNext()).
I have user records more than 50000 so I am using querylocator but when I am iterating I am getting Too many query rows exception.
Need help regarding this.
below is my code.:(the below code is in execute method of the batch class)

            string allUserQuery = 'Select Id,Name from User';
            Database.QueryLocator q = Database.getQueryLocator(allUserQuery);
            Database.QueryLocatorIterator it =  q.iterator();
            
            // Iterate over the records
            while (it.hasNext())
            {
               UserRec.add((User)it.next());
            
            }
I am getting this below error when I am trying to insert more than 10 records of opportunity and if the batch size is more than 10 through Data Loader. I have a after insert trigger and before update tigger on opportunity which updates the fields of oportunity. But this issue is not coming when I change the batch size to 4 in Data loader. Please let me know how can I resolve this issue.

Too many retries of batch save in the presence of Apex triggers with failures: when triggers are present partial save requires that some subset of rows save without any errors in order to avoid inconsistent side effects from those triggers
My custom object(Resource) has a master-details realtionship with Opportunity object.
In the Opportunity page layout I need to craete a custom button to ovrride the new button in the related list.
My custom button is working in classic view but not working in Lightining view.
How can I create a custom button for the related list that works on both classic and in lightning view?
Please suggest as I am new to Salesforce Lightning.
The Review_c object have a lookup relationship to the job_Application_c object.The job_Application_c object has a master detail relationship up to the position_c object.The relationship is based on the auto populated defaults?
What is the recommended way to display field data from the related Review _C records a Visualforce page for a single Position_c record?
A. Utilize the Standard Controller for Position_c and cross -object Formula Fields on the Job_Application c object to display Review_c data.
B. Utilize the Standard Controller for Position_c and a Controller Extension to query for Review _ C data.
c) Utilize the Standard Controller for Position_c and expression syntax in the Page to display related Review_c through me Job_Applicacion_c inject.
D. Utilize the Standard Controller for Position_c and cross -object Formula Fields on the Review_c object to display Review_c data.
 

A candidate may apply to multiple jobs at the company Universal Containers by submitting a single application per job posting, that application cannot be modified to be resubmitted to a different job posting.
What can the administrator do to associate an application with each job posting in the schema for the organization?
A. Create a lookup relationship on both objects to a junction object called Job Posting Applications.
B. Create a master -detail relationship in the Job Postings custom object to the Applications custom object.
C. Create a master -detail relationship in the Application custom object to the Job Postings custom object.
D. Create a lookup relationship in the Applications custom object to the Job Postings custom object.
Hi I am getiing below error 
System.LimitException: Apex CPU time limit exceeded
Below is my code:
                            for(content_description__c cds: contentDesc){
                                        brandNameStringSet = new set<string>();
                                        for(ContentBrand__c cntBrnd : contentBrandMap.values()){
                                            if(cntBrnd.Content_Description__c!=NULL){ 
                                                if(cds.Id == contentBrandMap.get(cntBrnd.Id).Content_Description__c){
                                                    brandNameStringSet.add(cntBrnd.Brand__r.Name);
                                                }
                                            }
                                        }
                                       mapBrand.put(cds.id,brandNameStringSet);
                                 }
I am getting error at the line which is highlighted in bold in the above code.
I am gettin size for ist for loop is 787 and for the seconf for loop size is 848.
I tried reversing the for loop but still no luck.
I need this both for loop. I cannot remove the for loop.
How do I solve this isue?
I have a validation rule on master object(Opportunity).I have rollup summary field on parent Object. I am checking in the validation that if no records is there in the child object then fire this validation rule. But i am facing issue while deleting the last child object record which is in the related list of parent as the validation rule fire first and does not allow me to delete the last child record. 
Please let me know how do i update my validation ruleso that it allows me to delete all the child records and should fire when when insert or update the parent record. Below is my validation rule:(Total_Resource_Badge__c is a rollup summary field)

AND(OR( 
ISPICKVAL(StageName, '3. Solutioning'), 
ISPICKVAL(StageName, '4. End-Game'), 
ISPICKVAL(StageName, '5. Negotiation'), 
ISPICKVAL(StageName, 'Won') 
), 
INCLUDES(Delivery_Construct__c , "Involves rebadging of resources") ,
Total_Resource_Badge__c=0)
I am getting this below error when I am trying to insert more than 10 records of opportunity and if the batch size is more than 10 through Data Loader. I have a after insert trigger and before update tigger on opportunity which updates the fields of oportunity. But this issue is not coming when I change the batch size to 4 in Data loader. Please let me know how can I resolve this issue.

Too many retries of batch save in the presence of Apex triggers with failures: when triggers are present partial save requires that some subset of rows save without any errors in order to avoid inconsistent side effects from those triggers

A candidate may apply to multiple jobs at the company Universal Containers by submitting a single application per job posting, that application cannot be modified to be resubmitted to a different job posting.
What can the administrator do to associate an application with each job posting in the schema for the organization?
A. Create a lookup relationship on both objects to a junction object called Job Posting Applications.
B. Create a master -detail relationship in the Job Postings custom object to the Applications custom object.
C. Create a master -detail relationship in the Application custom object to the Job Postings custom object.
D. Create a lookup relationship in the Applications custom object to the Job Postings custom object.