• nitin sharma 190
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 9
    Replies
Hi All,

I am trying  some experments  in salesforce dev org.I cannot do things which require more data due to restrictions by salesforce.However,I am sure I can get help from you guys.

As per governor limit chart.

Total number of records retrieved by SOQL queries is 50,000

As per governor limts I can retrieve 50,000 records by doing a single query.Now my query is given below.

List<Account> aa = [SELECT Id, Name FROM Account WHERE Name = 'Acme'];

1)If my query retrieves moe than 50,000 records and assign them to the list then governor limit will be in place and It will give an error.Am I right?If the records are equal or less than 50,000 then governore limits will not have any impact .Please correct me if I am wrong

SOQL For loop
for (variable_list : [soql_query]) {
   code_block
}

What will happen in the above given case.if my query in the for loop fetch more than 50,000  then it should hit governor limits and give me an error.Is that correct?.However,if the total number of records retrieved by th query is less than 50,000 then it will not give an erro message of "Total number of records retrieved by SOQL queries 50,000"?Is that correct.

However, I will be having  dml update statement within the for loop  and records are more than 20,000 then I will hit dml limit of 150 per apex transaction because per execution of loop can only process 200 records.In that scenario I cannot use that loop and I need to use use batch apex to update records in the system.Is that Correct?

I am trying to understand above mentioned things from the perpective of salesforce certification So somebody please help and clear my doubts

And do tell me how many maximum records I can reterieve by using a single query.I think i can retrieve 50,000 records by using single query anbywhere in the system be inline soql for loop or single query in a salesfore classs method.Please help



 

Hi Everybody,

I am learining about cross object workflows.I could see that if i craete a workflow then I can update a field on the account which is the parent object whereas when I create a workflow on the contact object I do not have the option to update a field on the account object,Why is it so?

From the contact object I can update the contact object with the values on the account account record.

Why contact is not allowed to update accoint object and opportunity is allowed to update a field on the account object.Can somebody explain?

Thanks,


 

Hi Everybody,

An opp object has stage field.As per my requirement if opporutnity stage field has not been changed for the last 20 days then I would like to inform an opporunity owner by sending him an email.

I am trying to use workflow.I want to capture the number of days an opp has stayed in a particular stage and if the number of days is equal to 20 days then workflow will send an email to the opp owner.

If i can capture the last time an opportunity stage has been changed in a field that would be nice.However,I am not able to do that ,Can somebody please help.


 
I have read that we can update parent object from the child record  using workflows provioded the relrionship is Master detail.However, when i checked the  opporunity field I saw that opporunutity and acount have look up relationship then how come i am abl to update account from the opp object when releationship is look up between them.

Is there something that I am missing?

if the relationship is mater detail between them ,Can i see that in the system?

Please help,
Thanks
Hi All,

I am trying  some experments  in salesforce dev org.I cannot do things which require more data due to restrictions by salesforce.However,I am sure I can get help from you guys.

As per governor limit chart.

Total number of records retrieved by SOQL queries is 50,000

As per governor limts I can retrieve 50,000 records by doing a single query.Now my query is given below.

List<Account> aa = [SELECT Id, Name FROM Account WHERE Name = 'Acme'];

1)If my query retrieves moe than 50,000 records and assign them to the list then governor limit will be in place and It will give an error.Am I right?If the records are equal or less than 50,000 then governore limits will not have any impact .Please correct me if I am wrong

SOQL For loop
for (variable_list : [soql_query]) {
   code_block
}

What will happen in the above given case.if my query in the for loop fetch more than 50,000  then it should hit governor limits and give me an error.Is that correct?.However,if the total number of records retrieved by th query is less than 50,000 then it will not give an erro message of "Total number of records retrieved by SOQL queries 50,000"?Is that correct.

However, I will be having  dml update statement within the for loop  and records are more than 20,000 then I will hit dml limit of 150 per apex transaction because per execution of loop can only process 200 records.In that scenario I cannot use that loop and I need to use use batch apex to update records in the system.Is that Correct?

I am trying to understand above mentioned things from the perpective of salesforce certification So somebody please help and clear my doubts

And do tell me how many maximum records I can reterieve by using a single query.I think i can retrieve 50,000 records by using single query anbywhere in the system be inline soql for loop or single query in a salesfore classs method.Please help



 
I am trying to see why this error is occuring for my query. Help would be greatly appreciated.

 List<ContentVersion> cv = [Select Title, portal_effective_date__c, Portal_Effective_Until_Date__c,description, filetype, createddate, isLatest, id, brand__c, state__c, region__c, 
                                           dealer__c from contentversion where ContentDocumentId in (SELECT ContentDocumentId FROM ContentWorkspaceDoc WHERE ContentWorkspaceId = :workspaceId) 
                                           and (Brand__C ='' and region__C = '' and state__c ='') OR region__C = :selRegion OR state__c = :acc.Physical_State__c OR 
                                           (region__C = :selRegion and state__c = :acc.Physical_State__c) and isLatest = true order by Title ASC];
All,
 
I woul appreciate any help with my requirement below .  I am kind of new in coding and I would appreciate any assitance

REQUIREMENT
 
When Opportunity record is connected to one or more Matter__c  record, Sum all currency values in the Total_Fees__c currency field and add Sum total value in the Engagement_Total_Fees__c field in the related Opportunity record
 
OBJECTS
Opportunity (parent object)
Matter__c  (Child object) custom object.
 
 
OPPORTUNITY FIELD
Engagement_Total_Fees__c - currency (16,2) custom field
 
MATTER__C field
Total_Fees__c - currency (16,2) custom field
Deal__c  - Lookup(Opportunity) custom field
 

WHAT I HAD DONE
 
Below is a trigger I created based on website https://github.com/abhinavguptas/Salesforce-Lookup-Rollup-Summaries .
 
I am requesting if you can review my code because I received the error below
 
“Error: Compile Error: Invalid type: LREngine.Context at line 26 column 33”
 The data on line 26 is “LREngine.Context ctx = new LREngine.Context(Opportunity.SobjectType, // parent object

Trigger Below

/* Updated version on 17 June 16

*/

trigger OppRollupOnEngagement on Matter__c (after insert, after update, 
                                        after delete, after undelete) 

// modified objects whose parent records should be updated
     {Matter__c[] objects = null;

if (Trigger.isDelete) {
         objects = Trigger.old;

 /*
      Handle any filtering required, specially on Trigger.isUpdate event. If the rolled up fields
      are not changed, then please make sure you skip the rollup operation.
      We are not adding that for sake of similicity of this illustration.
 */ 
        objects = Trigger.new;
     }

/*
      First step is to create a context for LREngine, by specifying parent and child objects and
      lookup relationship field name
*/
     LREngine.Context ctx = new LREngine.Context(Opportunity.SobjectType, // parent object
                                            Matter__c.SobjectType,  // child object
                                            Schema.SObjectType.Matter__c.fields.Deal__c // relationship field name
                                            ); 

/*
      Next, one can add multiple rollup fields on the above relationship. 
      Here specify 
       1. The field to aggregate in child object
       2. The field to which aggregated value will be saved in master/parent object
       3. The aggregate operation to be done i.e. SUM, AVG, COUNT, MIN/MAX
*/

ctx.add(
            new LREngine.RollupSummaryField(
                                            Schema.SObjectType.Opportunity.fields.Engagement_Total_Fees__c,
                                            Schema.SObjectType.Matter__c.fields.Total_Fees__c,
                                            LREngine.RollupOperation.Sum 
                                         )); 
/* 
      Calling rollup method returns in memory master objects with aggregated values in them. 
      Please note these master records are not persisted back, so that client gets a chance 
      to post process them after rollup
*/ 

Sobject[] masters = LREngine.rollUp(ctx, objects);    

     // Persiste the changes in master
     update masters;

}



I would appreciate the help . 
 

Hi All,

Can someone give me the logic to write a trigger to update a parent object's comment field when a child object's comment field is updated.
 

Hi Everybody,

I am learining about cross object workflows.I could see that if i craete a workflow then I can update a field on the account which is the parent object whereas when I create a workflow on the contact object I do not have the option to update a field on the account object,Why is it so?

From the contact object I can update the contact object with the values on the account account record.

Why contact is not allowed to update accoint object and opportunity is allowed to update a field on the account object.Can somebody explain?

Thanks,


 

Hi Everybody,

An opp object has stage field.As per my requirement if opporutnity stage field has not been changed for the last 20 days then I would like to inform an opporunity owner by sending him an email.

I am trying to use workflow.I want to capture the number of days an opp has stayed in a particular stage and if the number of days is equal to 20 days then workflow will send an email to the opp owner.

If i can capture the last time an opportunity stage has been changed in a field that would be nice.However,I am not able to do that ,Can somebody please help.


 
I have read that we can update parent object from the child record  using workflows provioded the relrionship is Master detail.However, when i checked the  opporunity field I saw that opporunutity and acount have look up relationship then how come i am abl to update account from the opp object when releationship is look up between them.

Is there something that I am missing?

if the relationship is mater detail between them ,Can i see that in the system?

Please help,
Thanks