• sites1.3909952495827087E12
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
global class BatchAccountUserCount implements Database.Batchable<SObject>, Database.Stateful{
   
    global Database.queryLocator start(Database.BatchableContext ctx){
     return Database.getQueryLocator([Select id,Total_Accounts__c, (Select id,Parent.id From Accounts__r) From User u where id=:userinfo.getuserid()]);
    }
    
    global   void execute(Database.BatchableContext ctx, List<Sobject> scope){
        List<User> userList = (List<User>)scope;
        System.debug('@@@@@userList@@@@@@@@'+userList.size());
        for(Integer i = 0; i < userList.size(); i++){
            List<Account> accList = userList[i].Accounts__r;
            System.debug('@@@@@accList@@@@@@@@'+accList.size());
            userList[i].Total_Accounts__c  = accList.size();
        }
       // ProcessorControl.inFutureContext = true;
        //List<Database.SaveResult> dsrs = Database.update(userList, false);
        update userList;
    }
   
    global   void finish(Database.BatchableContext ctx){   
   
    }
}
I  Hav one batch class on Accoun running every hour. and  on account object one more trigger calling the @future method in class.


wen i run te batch iam getting this error. How to avoid thsi error.


 
Hi All,
I am an administrator that hasn't written any apex code or created any triggers.
I'm needing to have the ability to create a case from an opportunity, have some of the opportunity fields and preferably  the opportunity products also visible in the case.
What I would really like is to have a trigger that once the opportunity stage reaches a certain percentage and includes any installation product lines the case is automatically created.
Any help, advise, information, a starting point would be much appreciated.
Thank you in advance.
I need assistance with a trigger or Apex (i think it's Apex).

When a new lead comes in:

1) If the lead has a company name, check for that company in Accounts
2) If found, assign the new lead to the account owner.

Thanks for any assistance.

Mike


Write a trigger to create a CAPA and Cortex/CAPA records when these conditions are met:
Confirmed Late Delivery field is ticked
Cortex/Order field equals Order
Delivered Status (Final) field = Delivered Late

When you are creating the CAPA record, populate the fields with these values:

CAPA field                                  Value

CAPA Status                              New
Date/Time CAPA created        Time record is created
Category                                     Corrective Action
Source                                         Late Delivery
Initial Description                       From hearing field Late Code (enter key)
                                                       From hearing field Late Code Sub Category (enter key)
                                                       From hearing field Reason for Late Delivery (enter key)
Immediate Action Taken           Wording always:  Transcript merged and sent.
Employee (s) Involved                From hearing field Merger Responsible
Hearing Number (s)                    Wording always: See CAPA Cortex records

If a following fields changes value and the linked CAPA has a Status that is not Closed and CAPA Source of “Late Delivery”, Quality Team would like to know about it. For the purpose of this test, please send email to llau@fortherecord.com.
- When Hearing.Confirmed Late Delivery is changed to unticked
- When Delivered Status is changed to a value that is not "Delivered Late"
- When Late Code is changed
- When Late Code Subcategory is changed

Hints:
Create your own email template (text only) with appropriate subject.


How get start with this and could you please provide me the code . as iam not aware od triggers and how to write triggers
I  Hav one batch class on Accoun running every hour. and  on account object one more trigger calling the @future method in class.


wen i run te batch iam getting this error. How to avoid thsi error.