You need to sign in to do that
Don't have an account?
Carly Probasco 14
Adding a method to an existing controller
I am trying to add this piece of code into an existing controller. The code is to display either a date field or a string of text depending on the condition. When i debug this, it appears my function is not being called.
Here is the class i need to add the above to:
//Returns the Rating Release date or the rating pending IF (Today < currentQRpCase.Rating_Externally_Visible_Date__c){ RatingRelease = 'Rating Pending'; } else IF(Today > currentQRpCase.Rating_Externally_Visible_Date__c){ RatingRelease = currentQRpCase.Rating_Externally_Visible_Date__c.format(); } else { RatingRelease = ''; } System.debug('Rating Pending is now' + RatingRelease);
Here is the class i need to add the above to:
allExistingPrograms = new List<Program__c>(); existingPrograms = new List<Program__c>(); allExistingProviderCases = new List<Provider_Case__c>(); existingProviderCase = new List<Provider_Case__c>(); Boolean programEnrollmentFlag = false, providerCaseQEFlag = false, providerCaseQRFlag = false; programEARTId = [Select ID from RecordType Where SObjectType = 'Program__c' AND DeveloperName = 'Early_Achievers'].Id; qualityEnrollmentRTId = [Select ID from RecordType Where SObjectType = 'Provider_Case__c' AND DeveloperName = 'Quality_Enrollment'].Id; qualityRatingRTId = [Select ID from RecordType Where SObjectType = 'Provider_Case__c' AND DeveloperName = 'Quality_Rating'].Id; allExistingProviderCases = [Select Id, Quality_Rating_Level__c, Licensee_Signee_Name__c, Licensee_Signature_Date__c, RecordTypeId, Status__c, RecordType_Name__c, Parent_Provider_Case__c, ERS_Score__c, CLASS_Score__c, Rating_Externally_Visible_Date__c, Provider_Rating_Visible_Date__c, Quality_Rating_Expiration_Date__c, Approved_By_Supervisor__c, Quality_Standard_Score__c, appealed__c, Rating_Due_Date__c, L2_Activities_Due__c, L2_Application_Submission_Date__c, Case_Creation_Option__c, Renewal_Requested__c, Account__r.Current_EA_Program_Rec_ID__c, QRIS_Scoring_Mode__c,Rerate_Status__c, count_appeals__c, (Select Id From Appeal_Details__r) FROM Provider_Case__c WHERE Account__C = :currentAccId ORDER BY Completed_Date__c desc]; Map<Id, ProviderRating> ratingMap = populateProviderRatingHistorMap(allExistingProviderCases); for(Provider_Case__c pCase : allExistingProviderCases) { if(pCase.RecordTypeId == qualityEnrollmentRTId && pCase.Status__c == 'In Progress') { existingProviderCase.add(pCase); } else if(pCase.RecordTypeId == qualityEnrollmentRTId && pCase.Status__c == 'Completed') { providerCaseQEFlag = true; } else if(pCase.RecordTypeId == qualityRatingRTId && pCase.Status__c != 'Application Withdrawn') { providerCaseQRFlag = true; } system.debug('Record type name is '+pCase.RecordType_Name__c); //logic to split providercases based on quality rating and its sub types if(pCase.RecordTypeId==qualityRatingRTId){ if(pcase.status__c=='In Progress') { currentQRpCase = pcase; /*commenting this out because this logic is moved under and will only execute of the conditions are met for(Appeal_Detail__c ad : pCase.Appeal_Details__r) { AppealDetailURL = '/apex/VIPFORM__VIP_FormWizard?id='+ad.Id; AppealDetailExists = true; break; } */ } system.debug('Appeal detail URL '+AppealDetailURL); system.debug('Rating visible date is '+pCase.Provider_Rating_Visible_Date__c); system.debug('Provider case status is '+pcase.status__c); system.debug('Provider case is '+pcase.id); if(pCase.Provider_Rating_Visible_Date__c<=date.today() && pcase.status__c=='Completed'){ System.debug('current QR Case is '+currentQRpCase); if(String.isBlank(DymanicRerateButtonText) && String.isNotBlank(pCase.Case_Creation_Option__c)){ system.debug('Completed Prov Id is '+pCase.id); DymanicRerateButtonText=pCase.Case_Creation_Option__c; if(DymanicRerateButtonText!='Request a Rerate') DymanicRerateButtonURL = '/PP_DynamicRerateFlow?AccountId='+currentAccountId+'&ProvCaseId='+pCase.id+'&caseCreationType='+pCase.Case_Creation_Option__c; if(DymanicRerateButtonText=='Appeal' ){ system.debug('Externally visible date'+pcase.Rating_Externally_Visible_Date__c); system.debug('Count appeals'+pcase.Count_Appeals__c); if(pcase.Rating_Externally_Visible_Date__c>date.today() && (pcase.Count_Appeals__c==null || pcase.Count_Appeals__c == 0)){ currentQRProviderCase=pcase.id; system.debug('Appeal end date in future'); //appeal detail code here for(Appeal_Detail__c ad : pCase.Appeal_Details__r) { system.debug('Appeal details'); AppealDetailURL = '/apex/VIPFORM__VIP_FormWizard?id='+ad.Id; DymanicRerateButtonURL='/apex/VIPFORM__VIP_FormWizard?id='+ad.Id; AppealDetailExists = true; //currentQRProviderCase=pcase.id; break; } }else{ renderDynamicRerateButton=false; } } system.debug('appeal detail URL '+AppealDetailURL); if(dymanicRerateButtonText=='Renewal'){ currentQRProviderCase=pcase.id; renderDynamicRerateButton=true; } if(DymanicRerateButtonText=='Renewal' && pcase.Renewal_Requested__c){ renderDynamicRerateButton=false; } if(pcase.Rerate_Status__c!=null && pcase.Rerate_Status__c!='' && (pcase.Case_Creation_Option__c == 'Paid Rerate' || pcase.Case_Creation_Option__c == 'Free Rerate')){ renderDynamicRerateButton=false; } } }else{ } if(pCase.Provider_Rating_Visible_Date__c<=date.today() && pcase.Approved_By_Supervisor__c==true){ system.debug('case creation is '+pCase.Case_Creation_Option__c); system.debug('Before assigning is '+DymanicRerateButtonText); system.debug('Prov case QR'); ProviderRating pr; if(ratingMap.containsKey(pcase.Id)){ pr = ratingMap.get(pcase.Id); } else { pr =new ProviderRating(); } pr.prCase = pCase; pr.RatingLevel = pCase.Quality_Rating_Level__c; pr.QRProvCaseId = pCase.Id; pr.RatingReleaseDate = pCase.Provider_Rating_Visible_Date__c; pr.status = pCase.status__c; ProviderRatingHistory.add(pr); } } //Returns the Rating Release date or the rating pending IF (Today < currentQRpCase.Rating_Externally_Visible_Date__c){ RatingRelease = 'Rating Pending'; } else IF(Today > currentQRpCase.Rating_Externally_Visible_Date__c){ RatingRelease = currentQRpCase.Rating_Externally_Visible_Date__c.format(); } else { RatingRelease = ''; } System.debug('Rating Pending is now' + RatingRelease); } existingProviderCaseSignatures = new List<Provider_Case_Signature__c>(); if(!existingProviderCase.isEmpty() && existingProviderCase.size()>0) { existingProviderCaseSignatures = [Select Id, Description__c, Sort_Order__c, Status__c, Data_Capture_Option__c, Captured_Value__c From Provider_Case_Signature__c Where Provider_Case__c = :existingProviderCase[0].Id order by Sort_Order__c ASC]; } allExistingPrograms = [Select Id, Effective_Datetime__c, EA_Latest_Enrollment_Date__c from Program__c Where Account__c =: currentAccId AND Status__c = 'Active' AND RecordTypeId =: programEARTId]; for(Program__c prog : allExistingPrograms) { if(prog.Effective_Datetime__c < currentDateTime) { existingPrograms.add(prog); } programEnrollmentFlag = true; currentEAProgram = prog; } av = getAgreementValues(); displayContacts = (!existingPrograms.isEmpty() && !existingProviderCase.isEmpty()) ? true : false; displayEnrollment = (programEnrollmentFlag && providerCaseQEFlag && providerCaseQRFlag) ? false : true; System.debug('programEnrollmentFlag*********** ' + programEnrollmentFlag); System.debug('providerCaseQEFlag*********** ' + providerCaseQEFlag); System.debug('providerCaseQRFlag*********** ' + providerCaseQRFlag); //populate EAContactDropDown List eaContact1Records = getEAContact1Records(); eaContact2Records = getEAContact2Records(); ///////////////////////// EA part /////////////////////////////// }//end Constructor