Find Jobs
Hire Freelancers

I would like to hire a Programmer

$30-250 USD

Geschlossen
Veröffentlicht vor fast 7 Jahren

$30-250 USD

Bezahlt bei Lieferung
Updating related records via an apex batch: Here is my code; I need all of the EFE and IL numbers to display in their respected lists. global class BatchUpdateEFEandIL5 implements [login to view URL]<sObject>, [login to view URL]{ private static Id oevsRecTypeId; private static Id tvsRecTypeId; // Prepare collections // create a list that is empty but new, so not null. global static List <Account> SubAcct = new List <Account>(); // global static String EFEList = '' ; // global static String ILList = '' ; private List<String> EFEList = new List<String>(); private List<String> ILList = new List<String>(); //private String queryString; private integer Summary = 0; public [login to view URL] start([login to view URL] BC){ // only use accounts that are of OEVS and TVS record type. oevsRecTypeId = [login to view URL]().get('OEVSCompany').getRecordTypeId(); tvsRecTypeId = [login to view URL]().get('TVS Company').getRecordTypeId(); // query string will get us all the info we need for the child accts String queryString = 'select ID, Company_infolease__c, company_ecredit__c ' + 'from Account ' + 'where (recordtypeid = :oevsRecTypeId or recordtypeid = :tvsRecTypeId) ' + 'and parentId = null'; return [login to view URL](queryString); } // excute gets called once per iteration, and iteration is a signle object, '<sObject>'. public void execute([login to view URL] BC, List<sObject> scope) { // variable for rollups //(sObject s : scope) { //if [login to view URL] == 'condition' //do some logic // else // do some logic // update scope //} // create a parent id list List<Account> ParentIds = (List<Account>) scope; // create dictionary of type acccount keyed by Id, will automatically insert all Ids associated w/ Accounts. Map<id, Account> parentMap = new Map<Id, Account>(parentIds); // create a list and set it to a query for the Children account List<Account> Children = [ SELECT Id, Name, ParentID, ECredit__C, ECR_CUST_NUM__C FROM Account WHERE parentId in :ParentIds ]; // create an empty map where key is accountId and value is the list of Accounts. Then iterate through // through the Account list Map<Id, List<Account>> ParentIdToChildAccounts = new Map<Id, List<Account>>(); for(Account a : children){ // for each account 1st chk to see if there's already an entry in the ParentIdToChildAccounts map for the // accounts parent Id (containgssKey method chks to see if that key already in map). if([login to view URL]([login to view URL])){ // use get method to retrieve the list for the current parent Ids account and add that account // to the list. [login to view URL]([login to view URL]).add(a); } else { // if this is the first parentId for an acct u need to create an iniatilize the list of accounts accts // for that account and insert that into the map [login to view URL]([login to view URL], new List<Account>{a}); } } // given a parent account's id, we can grab a list of all child accounts from that map. // create list of accts to update List<Account> toBeUpdated = new List<Account>(); // go over all parent Id in child map for(Id parentId : [login to view URL]()){ String EFEtoAppend = ''; String ILtoAppend = ''; for(Account childAccount: [login to view URL](parentId)){ // verify that and update is actually needed, if it hasen't insert child. if(childAccount.eCredit__c != null){ EFEtoAppend += ', ' + childAccount.eCredit__c; } // grandchild if(childAccount.ECR_CUST_NUM__c != null){ ILtoAppend += ', ' + childAccount.ECR_CUST_NUM__c; // if(childAccount.childAccount.ECR_CUST_NUM__c != null) // ILtoAppend += ', ' + childAccount.childAccount.ECR_CUST_NUM__c; } } // now we have a parent account, with a string of concattenated EFE and IL list entries // so lets update the parent Account updated = [login to view URL](parentId); updated.Company_infolease__c = ILtoAppend + ' ,'; updated.company_ecredit__c = ', ' + EFEtoAppend; [login to view URL](updated); } [login to view URL][] srList = [login to view URL](toBeUpdated, false); // loop through sr list for ([login to view URL] sr : srList) { if ([login to view URL]()) { // Operation was successful, so get the ID of the record that was processed [login to view URL]('Successfully inserted account. Account ID: ' + [login to view URL]()); } else { // Operation failed cause cause there are no records to update. Exit the code & return error msg. for([login to view URL] err : [login to view URL]()) { [login to view URL]('The following error has occurred.'); [login to view URL]([login to view URL]() + ': ' + [login to view URL]()); [login to view URL]('Account fields that affected this error: ' + [login to view URL]()); } } } } // Finish the method by refrencing the sObject public void finish([login to view URL] BC){ // schedulable methods //public void execute(schedulableContex context) { // BatchUpdateEFEandIL5 batchJob = new BatchUpdateEFEandIL5(); // [login to view URL](batchJob); //} } }
Projekt-ID: 14646080

Über das Projekt

10 Vorschläge
Remote Projekt
Aktiv vor 7 Jahren

Möchten Sie etwas Geld verdienen?

Vorteile einer Ausschreibung auf Freelancer

Legen Sie Ihr Budget und Ihren Zeitrahmen fest
Für Ihre Arbeit bezahlt werden
Skizzieren Sie Ihren Vorschlag
Sie können sich kostenlos anmelden und auf Aufträge bieten
10 Freelancer bieten im Durchschnitt $136 USD für diesen Auftrag
Avatar des Nutzers
I am the best choice for you to write code. Strong performer , working in MNC 5 company . strong in apex class, trigger , batch class, Lightning etc. Relevant Skills and Experience Apex class , Visualforce Page , visualforce component , Apex trigger , Batch class , Lightning.. Proposed Milestones $133 USD - Let us connect I can work and provide you multiple developers if required.
$133 USD in 1 Tag
0,0 (0 Bewertungen)
0,0
0,0
Avatar des Nutzers
We are a team of experienced and certified developers who will render services to you. Relevant Skills and Experience We provide work on salesforce platform which includes - APEX,VF,Device-Responsive ,salesforce general features More... Proposed Milestones $100 USD - salesforce project
$100 USD in 7 Tagen
0,0 (0 Bewertungen)
0,0
0,0
Avatar des Nutzers
I have worked on lot of batch classes . I have done a project in data migration from Territory Management to enterprise territory management.
$110 USD in 2 Tagen
0,0 (0 Bewertungen)
0,0
0,0
Avatar des Nutzers
It will finished in guaranteed two days Relevant Skills and Experience Salesforce Apex, Salesforce Integration, Proposed Milestones $155 USD - Everything
$155 USD in 2 Tagen
0,0 (0 Bewertungen)
0,0
0,0

Über den Kunden

Flagge von UNITED STATES
United States
0,0
0
Mitglied seit Juli 13, 2017

Kundenüberprüfung

Danke! Wir haben Ihnen per E-Mail einen Link geschickt, über den Sie Ihr kostenloses Guthaben anfordern können.
Beim Senden Ihrer E-Mail ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.
Registrierte Benutzer Veröffentlichte Jobs
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Vorschau wird geladen
Erlaubnis zur Geolokalisierung erteilt.
Ihre Anmeldesitzung ist abgelaufen und Sie wurden abgemeldet. Bitte melden Sie sich erneut an.