Find Jobs
Hire Freelancers

I would like to hire a Programmer

$30-250 USD

Zavřený
Zveřejněno skoro před 7 roky

$30-250 USD

Zaplaceno při doručení
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); //} } }
IČ projektu: 14646080

O projektu

10 nabídky
Vzdálený projekt
Aktivní před 7 roky

Chcete si vydělat nějaké peníze?

Výhody podávání nabídek na Freelancer

Stanovte si rozpočet a časový rámec
Získejte za svou práci zaplaceno
Načrtněte svůj návrh
Registrace a podávání nabídek je zdarma
10 freelanceři nabízejí v průměru $136 USD za tuto práci
Avatar uživatele
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 v 1 dni
0,0 (0 recenze)
0,0
0,0
Avatar uživatele
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 v 7 dnech
0,0 (0 recenze)
0,0
0,0
Avatar uživatele
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 v 2 dnech
0,0 (0 recenze)
0,0
0,0
Avatar uživatele
It will finished in guaranteed two days Relevant Skills and Experience Salesforce Apex, Salesforce Integration, Proposed Milestones $155 USD - Everything
$155 USD v 2 dnech
0,0 (0 recenze)
0,0
0,0

O klientovi

Pochází z UNITED STATES
United States
0,0
0
Členem od čvc 13, 2017

Ověření klienta

Díky! Poslali jsme vám e-mailem odkaz pro získání kreditu zdarma.
Při odesílání e-mailu se něco pokazilo. Zkuste to prosím znovu.
Registrovaných uživatelů Zveřejněných projektů
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Načítání náhledu
Bylo uděleno povolení ke geolokaci.
Vaše doba přihlášení vypršela a byli jste odhlášeni. Přihlaste se znovu.