Find Jobs
Hire Freelancers

I would like to hire a Programmer

$30-250 USD

Cerrado
Publicado hace casi 7 años

$30-250 USD

Pagado a la entrega
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); //} } }
ID del proyecto: 14646080

Información sobre el proyecto

10 propuestas
Proyecto remoto
Activo hace 7 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
10 freelancers están ofertando un promedio de $136 USD por este trabajo
Avatar del usuario
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 en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 7 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 2 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
It will finished in guaranteed two days Relevant Skills and Experience Salesforce Apex, Salesforce Integration, Proposed Milestones $155 USD - Everything
$155 USD en 2 días
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
United States
0,0
0
Miembro desde jul 13, 2017

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.