-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
28Questions
-
12Replies
When Milestone SLA "Expired" update Case field Status on the "Expired" ? How to start trigger?I want to update case for the Status =="Expired" when milestone Expired time.
public with sharing class UpdateCaseExpiredMilestoneStatus { private static final String RT_CASE_ALCADA = RecordTypeUtil.getByDevName('Case', 'Al_ada'); public static void execute(){ Set<Id> sIdsCase = new Set<Id> (); List<Case> lstCase = new List<Case> (); for (Case iCase : (List<Case>) Trigger.new) { if (iCase.RecordTypeId == RT_CASE_ALCADA && (TriggerHelper.changedField(iCase, 'Status') && iCase.MilestoneStatus == 'Open Violation' && iCase.Status == 'Novo')) { sIdsCase.add(iCase.Id); lstCase.add(iCase); System.debug('Caiu no if'); } } System.debug('lstCase' + lstCase); if(lstCase.isEmpty()){return;} caseExpiredMilestoneStatus(lstCase); } public static void caseExpiredMilestoneStatus(List<Case> lstCase){ List<Case> lstCasesStatus = new List<Case>(); for(Case iCase : lstCase){ iCase.Status = 'Expirado'; lstCasesStatus.add(iCase); } if(!lstCasesStatus.isEmpty()){ Database.update(lstCasesStatus); } } }
- Thiago Barbosa 1
- March 31, 2019
- Like
- 0
Canvas app in Lightning component showing blank screen
I have a screen problem(Canvas). When clicked on quick action opens screen and then goes blank. This happens the first time I click the quick action
<force:canvasApp developerName="QuotesCanvas" applicationName="QuotesCanvas" parameters="{!v.inputCampo}" width="100%" height="400px"/>
Can you help to me?
<force:canvasApp developerName="QuotesCanvas" applicationName="QuotesCanvas" parameters="{!v.inputCampo}" width="100%" height="400px"/>
Can you help to me?
- Thiago Barbosa 1
- October 03, 2018
- Like
- 0
Canvas app in Lightning component showing blank screen every first time
Hello,
I have a problem with Canvas App clicking it opens a canvas application and displays the canvas blank. When the users clear cache the display open normally.
<force:canvasApp developerName="QuotesCanvas" applicationName="QuotesCanvas" parameters="{!v.inputCampo}" width = "100%" height="400px"/>
Can you help to me?
I have a problem with Canvas App clicking it opens a canvas application and displays the canvas blank. When the users clear cache the display open normally.
<force:canvasApp developerName="QuotesCanvas" applicationName="QuotesCanvas" parameters="{!v.inputCampo}" width = "100%" height="400px"/>
Can you help to me?
- Thiago Barbosa 1
- October 02, 2018
- Like
- 0
How to coverage this methods in class?(bold)
public with sharing class MassReassignOpportunitiesController { public ApexPages.StandardSetController optySetController; public String filterId {get;set;} public String ErrorMsg {get;set;} public String optyQueryString; public List<cOpty> optyList {get;set;} public list<Opportunity> optyToUpdateList {get;set;} public Opportunity searchRecord {get;set;} public Reassign_Helper__c helperRecord{get;set;} public boolean isSuccess{get;set;} public boolean searchPerformed{get;set;} public boolean tooManyResults{get;set;} public boolean isLightning {get;set;} public Map<String, String> mapErros {get; set;} public Integer optyListSize {get{return optylist.size();}} public list<SelectOption> listviewoptions { get{ List<SelectOption> tempList = new List<SelectOption>(); tempList.add(new selectOption('None',System.Label.NoViewSelection)); if (optySetController<>null)tempList.addAll(optySetController.getListViewOptions()); return tempList; } } @AuraEnabled public static List<ListView> getListViews() { List<ListView> listviews = [SELECT Id, Name FROM ListView WHERE SobjectType = 'Opportunity']; return listviews; } @AuraEnabled public static List<account> getAccount(String searchKeyWord) { String searchKey = searchKeyWord + '%'; List < Account > returnList = new List < Account > (); List < Account > lstOfAccount = [select id, Name from account where Name LIKE: searchKey]; for (Account acc: lstOfAccount) { returnList.add(acc); } return returnList; } @AuraEnabled public static List <User> getUsersName(String searchKeyWord) { String searchKey = searchKeyWord + '%'; List <User> returnList = new List <User> (); List <User> lstOfUser = [select id, Name from User where Name LIKE: searchKey]; for (User usr: lstOfUser) { returnList.add(usr); } return returnList; } @AuraEnabled public static Map<string, object> newrefreshOptyListBySearch(String jsonOpp, String accountId, String userId){ MassReassignOpportunitiesController controller = new MassReassignOpportunitiesController(); Map<string, object> objReturn = new Map<string, object>(); try{ controller.searchRecord = new Opportunity(); controller.helperRecord = new Reassign_Helper__c(); controller.mapErros = new Map<String, String>(); Map<String, object> mapaSearch = (Map<String, object>)JSON.deserializeUntyped(jsonOpp); controller.searchRecord.Name = !String.isEmpty((String)mapaSearch.get('Name'))?(String)mapaSearch.get('Name'): null; controller.searchRecord.StageName = !String.isEmpty((String)mapaSearch.get('StageName'))?(String)mapaSearch.get('StageName'): null; controller.searchRecord.AccountId = !String.isEmpty((String)accountId) ? accountId : null; controller.searchRecord.OwnerId = !String.isEmpty((String)userId) ? userId : null; controller.helperRecord.BI_BR_CNPJ_CPF__c = !String.isEmpty((String)mapaSearch.get('BI_BR_CNPJ_CPF__c'))?(String)mapaSearch.get('BI_BR_CNPJ_CPF__c'): null; controller.helperRecord.BI_BR_Identificador__c = !String.isEmpty((String)mapaSearch.get('BI_BR_Numero_da_oportunidade__c'))?(String)mapaSearch.get('BI_BR_Numero_da_oportunidade__c'): null; controller.helperRecord.From__c = mapaSearch.get('From__c') != '' ? Date.valueOf((String)mapaSearch.get('From__c')): null; controller.helperRecord.To__c = mapaSearch.get('To__c') !='' ? Date.valueOf((String)mapaSearch.get('To__c')):null; controller.helperRecord.closedDate_From__c = mapaSearch.get('ClosedDate_From__c') != '' ?Date.valueOf((String)mapaSearch.get('ClosedDate_From__c')):null; controller.helperRecord.closedDate_To__c = mapaSearch.get('ClosedDate_To__c') != '' ?Date.valueOf((String)mapaSearch.get('ClosedDate_To__c')):null; controller.refreshOptyListBySearch(); List<Opportunity> lstOpp = new List<Opportunity>(); for(cOpty Acc : controller.optyList){ lstOpp.add(acc.oOpty); } if(lstOpp.size() == 0){ controller.mapErros.put('Não existem Dados para serem exibidos', 'info'); } objReturn.put('table', lstOpp); }catch(Exception e){ controller.mapErros.put(e.getMessage(), 'error'); } objReturn.put('mensagem' , controller.mapErros); return objReturn; } @AuraEnabled public static Map<String, object> newAssign(String userId, List<Opportunity> lstOpport){ MassReassignOpportunitiesController controller = new MassReassignOpportunitiesController(); Map<String, object> objReturnAssign = new Map<String, object>(); try{ controller.searchRecord = new Opportunity(); controller.helperRecord = new Reassign_Helper__c(); Map<String, object> mapaAssign = new Map<String, object>(); controller.helperRecord.Assign_to__c = !String.isEmpty((String)userId) ? userId : null; for(Opportunity opp : lstOpport){ opp.OwnerId = userId; cOpty pt = new cOpty(opp); pt.selected = true; controller.optyList.add(pt); } controller.Assign(); }catch(exception e){ controller.mapErros.put(e.getMessage(), 'error'); } objReturnAssign.put('mensagemErro', controller.mapErros); return objReturnAssign; } public MassReassignOpportunitiesController(){ //Variable Init optyQueryString = 'SELECT name,StageName,Ownerid, Owner.Name, CloseDate from Opportunity where isDeleted=false'; optyList = new List<cOpty>(); optySetController = new ApexPages.Standardsetcontroller(Database.getQueryLocator(optyQueryString+' limit 1000')); filterId = listviewoptions[0].getValue(); searchRecord = new Opportunity(); helperRecord = new Reassign_Helper__c(); isSuccess = true; searchPerformed = false; tooManyResults = false; isLightning = false; mapErros = new Map<String, String>(); //Apply the default filter //refreshOptyList(); } /*======================================== Applies the View filter to the Opty List ==========================================*/ public void refreshOptyList(){ list<Opportunity> testList = new list<Opportunity>(); optyList.clear(); tooManyResults = false; if (filterId <> null && filterId<> 'None'){ optySetController.setFilterId(filterId); testList = (list<Opportunity>)optySetController.getRecords(); searchPerformed = true; }else searchPerformed = false; Integer counter = 0; for (Opportunity opty:testList){ optyList.add(new cOpty(Opty)); counter++; if (counter == 999){ tooManyResults = true; break; } } } @AuraEnabled public static Map<String, object> newrefreshOptyList(String filterId){ MassReassignOpportunitiesController controller = new MassReassignOpportunitiesController(); controller.filterId = filterId; controller.refreshOptyList(); Map<string, object> objReturn = new Map<String, object>(); List<Opportunity> lstOpp = new List<Opportunity>(); for(cOpty Acc : controller.optyList){ lstOpp.add(acc.oOpty); } objReturn.put('lSelectTable', lstOpp); return objReturn; } public void refreshOptyListBySearch(){ optyList.clear(); //resultList = new List<cResult>(); //Systemdebug String userFilterQuery = ''; if (searchRecord.Name<>null) userFilterQuery = ' and Name like \'%'+searchRecord.Name+'%\''; if (searchRecord.Type<>null) userFilterQuery += ' and Type = \''+searchRecord.type+'\''; if (searchRecord.StageName<>null) userFilterQuery += ' and StageName = \''+searchRecord.StageName+'\''; if (searchRecord.AccountId<>null) userFilterQuery += ' and AccountId = \''+searchRecord.AccountId+'\''; if (searchRecord.OwnerId<>null) userFilterQuery += ' and OwnerId = \''+searchRecord.OwnerId+'\''; if (helperRecord.BI_BR_CNPJ_CPF__c<>null) userFilterQuery += ' and BI_BR_CNPJ_CPF__c = \''+helperRecord.BI_BR_CNPJ_CPF__c+'\''; if (helperRecord.BI_BR_Identificador__c<>null) userFilterQuery += ' and BI_BR_Numero_da_oportunidade__c = \''+helperRecord.BI_BR_Identificador__c+'\''; if (helperRecord.From__c<>null){ DateTime startDate = DateTime.newInstance(helperRecord.From__c, Time.newInstance(0, 0, 0, 0)); userFilterQuery += ' and CreatedDate >= '+startDate.format('yyyy-MM-dd')+'T00:00:00Z'; } if (helperRecord.To__c<>null){ DateTime endDate = DateTime.newInstance(helperRecord.to__c, Time.newInstance(0, 0, 0, 0)); userFilterQuery += ' and CreatedDate <= '+endDate.format('yyyy-MM-dd')+'T00:00:00Z'; } if (helperRecord.closedDate_From__c<>null){ DateTime startDate = DateTime.newInstance(helperRecord.closedDate_From__c, Time.newInstance(0, 0, 0, 0)); userFilterQuery += ' and CloseDate >= '+startDate.format('yyyy-MM-dd'); } if (helperRecord.closedDate_To__c<>null){ DateTime endDate = DateTime.newInstance(helperRecord.closedDate_to__c, Time.newInstance(0, 0, 0, 0)); userFilterQuery += ' and CloseDate <= '+endDate.format('yyyy-MM-dd'); } String optyQueryString = optyQueryString + userFilterQuery ; optyQueryString += ' order by Name limit 1000'; List<Sobject> sortedResults= new List<SObject>(); try{ sortedResults = Database.query(optyQueryString); searchPerformed = true; }catch (Exception e){ if(!isLightning){ mapErros.put(e.getMessage(), 'error'); }else ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); } for (SObject foundObject:sortedResults){ Opportunity opty = (Opportunity)foundObject; optyList.add(new cOpty(opty)); } } /*=============================================== Assign the selected opportunities to a new owner =================================================*/ public void Assign(){ list<Opportunity> optyToUpdateList = new list<Opportunity>(); list<Task> taskToUpdateList = new list<Task>(); list<Event> eventToUpdateList = new List<Event>(); isSuccess = true; for (cOpty opty:optyList){ if (opty.selected && opty.oOpty.StageName != 'F1 - Ganha') if(opty.oOpty.CloseDate < Date.today()) if(!isLightning){ mapErros.put('Os registros com data de fechamento estimado anterior a data atual não foram alterados.', 'warning'); }else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.warning, 'Os registros com data de fechamento estimado anterior a data atual não foram alterados.')); } else optyToUpdateList.add(new Opportunity(id=opty.oOpty.id, OwnerId=helperRecord.Assign_to__c)); if (opty.selected && opty.oOpty.StageName == 'F1 - Ganha') if(!isLightning){ mapErros.put('Os registros em fase F1 - Ganha não foram alterados.', 'warning'); }else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.warning, 'Os registros em fase F1 - Ganha não foram alterados.')); } } //We also need to reassign the open activities to the new owner //To do so, we first loop on all the opportunities to retrieve their Open Activities //Then we loop through the Task or Events and reassign them for(Opportunity tempOpty:[select id,(select id,isTask from OpenActivities order by ActivityDate DESC, LastModifiedDate DESC limit 500) from Opportunity where id in :optyToUpdateList]){ for (OpenActivity tempActivity:tempOpty.OpenActivities){ if (tempActivity.IsTask) taskToUpdateList.add(new Task(id=tempActivity.id,ownerId=helperRecord.Assign_to__c)); else EventToUpdateList.add(new Event(id=tempActivity.id,ownerId=helperRecord.Assign_to__c)); } } if (optyToUpdateList.size()+taskToUpdateList.size()+eventToUpdateList.size()>=10000) { if(!isLightning){ mapErros.put(System.Label.TooManyRowsError,'error'); }else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.TooManyRowsError)); } }else{ try { update optyToUpdateList; }catch (Exception e) { if(!isLightning){ mapErros.put(e.getMessage(), 'error'); }else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); isSuccess = false; } } try { if (taskToUpdateList.size()>0) update taskToUpdateList; if (eventToUpdateList.size()>0) update eventToUpdateList; }catch (Exception e) { if(!isLightning){ mapErros.put(e.getMessage(), 'error'); }else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); isSuccess = false; } } // Update the search results integer n=optyList.size(); for (integer i=n-1;i>=0;i--){ if (optyList[i].selected) optyList.remove(i); } //Display success menssage if(isSuccess) if(!isLightning){ mapErros.put(System.Label.AssignSuccessSummary, 'success'); }else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, System.Label.AssignSuccessSummary)); } } } /*================================================== Inner class helping identify selected opportunities ====================================================*/ public class cOpty{ public Opportunity oOpty {get;set;} public Boolean selected {get;set;} public cOpty(Opportunity oOpty){ this.oOpty = oOpty; selected = false; } } /*public static testmethod void testReassign(){ RecordType RecId = [SELECT Id FROM RecordType WHERE DeveloperName = 'BI_Clientes' and SobjectType = 'Account' LIMIT 1]; Account testAccount = new Account(); testAccount.Name = 'test'; testAccount.BI_Tipo_de_identificador_fiscal__c = 'CNPIJ'; testAccount.BI_No_Identificador_fiscal__c = '12345678'; testAccount.RecordTypeId = RecId.id; insert testAccount; BI_BR_Adabas__c Adabas = BI_DataLoad.getAdabas(); Adabas.BI_BR_ID_Externo__c = 'VALE0000'; insert Adabas; BI_BR_Atendimento_Comercial_e_Carteira__c Scarteira = BI_DataLoad.getAtendimentoComercialECarteira(Adabas.Id, testAccount.Id); insert Scarteira; Opportunity testOpty = new Opportunity(); testOpty.StageName = 'Discover'; testOpty.CloseDate = System.today()+1; testOpty.AccountId = testAccount.Id; testOpty.Name = 'testOpty'; testOpty.Type = 'testType'; testOpty.BI_BR_Adabas__c = Adabas.ID; testOpty.BI_BR_Duracao_do_contrato_em_meses__c = '18'; insert testOpty; MassReassignOpportunitiesController controller = new MassReassignOpportunitiesController(); controller.refreshOptyList(); controller.filterId = controller.listviewoptions[1].getValue(); controller.refreshOptyList(); controller.searchRecord.stageName = 'Discover'; controller.helperRecord.ClosedDate_From__c = System.today(); controller.helperRecord.ClosedDate_To__c = System.today()+2; controller.helperRecord.From__c = System.today(); controller.helperRecord.To__c = System.today()+1; controller.searchRecord.Type = 'testType'; controller.refreshOptyListBySearch(); System.assert(controller.optyList.size()>0); controller.optyList[0].selected = true; controller.helperRecord.Assign_to__c = UserInfo.getUserId(); controller.Assign(); }*/ }
- Thiago Barbosa 1
- June 06, 2018
- Like
- 0
How to coverage this methods?
@AuraEnabled public static Map<string, object> newrefreshOptyListBySearch(String jsonOpp, String accountId, String userId){ MassReassignOpportunitiesController controller = new MassReassignOpportunitiesController(); Map<string, object> objReturn = new Map<string, object>(); try{ controller.searchRecord = new Opportunity(); controller.helperRecord = new Reassign_Helper__c(); controller.mapErros = new Map<String, String>(); Map<String, object> mapaSearch = (Map<String, object>)JSON.deserializeUntyped(jsonOpp); controller.searchRecord.Name = !String.isEmpty((String)mapaSearch.get('Name'))?(String)mapaSearch.get('Name'): null; controller.searchRecord.StageName = !String.isEmpty((String)mapaSearch.get('StageName'))?(String)mapaSearch.get('StageName'): null; controller.searchRecord.AccountId = !String.isEmpty((String)accountId) ? accountId : null; controller.searchRecord.OwnerId = !String.isEmpty((String)userId) ? userId : null; controller.helperRecord.BI_BR_CNPJ_CPF__c = !String.isEmpty((String)mapaSearch.get('BI_BR_CNPJ_CPF__c'))?(String)mapaSearch.get('BI_BR_CNPJ_CPF__c'): null; controller.helperRecord.BI_BR_Identificador__c = !String.isEmpty((String)mapaSearch.get('BI_BR_Numero_da_oportunidade__c'))?(String)mapaSearch.get('BI_BR_Numero_da_oportunidade__c'): null; controller.helperRecord.From__c = mapaSearch.get('From__c') != '' ? Date.valueOf((String)mapaSearch.get('From__c')): null; controller.helperRecord.To__c = mapaSearch.get('To__c') !='' ? Date.valueOf((String)mapaSearch.get('To__c')):null; controller.helperRecord.closedDate_From__c = mapaSearch.get('ClosedDate_From__c') != '' ?Date.valueOf((String)mapaSearch.get('ClosedDate_From__c')):null; controller.helperRecord.closedDate_To__c = mapaSearch.get('ClosedDate_To__c') != '' ?Date.valueOf((String)mapaSearch.get('ClosedDate_To__c')):null; controller.refreshOptyListBySearch(); List<Opportunity> lstOpp = new List<Opportunity>(); for(cOpty Acc : controller.optyList){ lstOpp.add(acc.oOpty); } if(lstOpp.size() == 0){ controller.mapErros.put('Não existem Dados para serem exibidos', 'info'); } objReturn.put('table', lstOpp); }catch(Exception e){ controller.mapErros.put(e.getMessage(), 'error'); } objReturn.put('mensagem' , controller.mapErros); return objReturn; } @AuraEnabled public static Map<String, object> newAssign(String userId, List<Opportunity> lstOpport){ MassReassignOpportunitiesController controller = new MassReassignOpportunitiesController(); Map<String, object> objReturnAssign = new Map<String, object>(); try{ controller.searchRecord = new Opportunity(); controller.helperRecord = new Reassign_Helper__c(); Map<String, object> mapaAssign = new Map<String, object>(); controller.helperRecord.Assign_to__c = !String.isEmpty((String)userId) ? userId : null; for(Opportunity opp : lstOpport){ opp.OwnerId = userId; cOpty pt = new cOpty(opp); pt.selected = true; controller.optyList.add(pt); } controller.Assign(); }catch(exception e){ controller.mapErros.put(e.getMessage(), 'error'); } objReturnAssign.put('mensagemErro', controller.mapErros); return objReturnAssign; } @AuraEnabled public static Map<String, object> newrefreshOptyList(String filterId){ MassReassignOpportunitiesController controller = new MassReassignOpportunitiesController(); controller.filterId = filterId; controller.refreshOptyList(); Map<string, object> objReturn = new Map<String, object>(); List<Opportunity> lstOpp = new List<Opportunity>(); for(cOpty Acc : controller.optyList){ lstOpp.add(acc.oOpty); } objReturn.put('lSelectTable', lstOpp); return objReturn; }
- Thiago Barbosa 1
- June 06, 2018
- Like
- 0
I want to view data table through of list view. When click on the list view, it's visualization datatable. How to do it?
<div class="slds-size_3-of-12"> <lightning:select aura:id="selectOpp" name="selectItem" label="Lista" value="{!v.statusOpp}" onchange="{!c.selectOpp}"> <aura:iteration items="{!v.lstTiposOpp}" var="lstOpp"> <option value="{!lstOpp}">{!lstOpp}</option> </aura:iteration> </lightning:select> </div>
({ searchListViewSelectOption : function(component, event, helper){ var action = component.get("c.getListViews"); action.setCallback(this, function(response){ var state = response.getState(); if(state === "SUCCESS"){ var optionsList = []; var returnValue = response.getReturnValue(); console.log('ReturnValue' + JSON.stringify(returnValue)); optionsList.push('--Nenhum--'); for (var i = 0; i < returnValue.length; i++) { optionsList.push(returnValue[i].Name); } component.set("v.lstTiposOpp", optionsList); }else if (state === 'ERROR') { var errors = response.getError(); if (errors[0] && errors[0].message) { helper.showToast('Erro', errors[0].message, 'error', 'dismissible'); } } else { helper.showToast('Erro', 'Erro desconhecido', 'error', 'dismissible'); } }); $A.enqueueAction(action); }, onSearch : function(component, event, helper){ var oportunidade = component.get("v.opportunity"); var account = component.get("v.selectedRecordAccount"); var user = component.get("v.selectedRecord"); var action = component.get("c.newrefreshOptyListBySearch"); action.setParams({ jsonOpp: JSON.stringify(component.get("v.opportunity")), accountId: component.get("v.selectedRecordAccount").Id, userId : component.get("v.selectedRecord").Id }); action.setCallback(this, function(response){ var state = response.getState(); if(state === "SUCCESS"){ var returnValue = response.getReturnValue(); console.log('returnValue' + JSON.stringify(returnValue)); component.set('v.listOfOpportunities', returnValue['table']); for(var key in returnValue['mensagem']) this.showInfoToast(key, returnValue['mensagem'][key]); }else if (state === 'ERROR') { var errors = response.getError(); if (errors[0] && errors[0].message) { helper.showToast('Erro', errors[0].message, 'error', 'dismissible'); } } else { helper.showToast('Erro', 'Erro desconhecido', 'error', 'dismissible'); } }); $A.enqueueAction(action); }, onAssign : function(component, event, helper){ var checkOpp = []; var getAllId = component.find("boxPack"); if(!Array.isArray(getAllId)){ if (getAllId.get("v.value") == true) { checkOpp.push(getAllId.get("v.text")); } }else{ for (var i = 0; i < getAllId.length; i++) { if (getAllId[i].get("v.value") == true) { checkOpp.push(getAllId[i].get("v.text")); } } } console.log('Check Opp' + JSON.stringify(checkOpp)); var listOpp = component.get("v.listOfOpportunities"); console.log('Lista de Oportunidades Antes' + JSON.stringify(listOpp)); var arrayOpp = []; for(var i= 0 ; i < listOpp.length; i++){ for(var n = 0; n < checkOpp.length; n ++){ if(listOpp[i].Id == checkOpp[n]){ arrayOpp.push(listOpp[i]); listOpp.splice(i,1); } } } console.log('Lista de Opp' + listOpp); console.log('Lista de Oportunidades Após'+ JSON.stringify((arrayOpp))); var user = component.get("v.selectedRecordUser"); if(user.Name == ''){ helper.showToast('Alerta', 'Por Favor insira o úsuario no campo Atribuir Para:', 'warning'); return; } var action = component.get("c.newAssign"); action.setParams({ userId : component.get("v.selectedRecordUser").Id, lstOpport : arrayOpp }); action.setCallback(this, function(response){ var state = response.getState(); if(state === "SUCCESS"){ var returnValue = response.getReturnValue(); console.log('returnValue' + JSON.stringify(returnValue)); if(returnValue['mensagemErro'] != ''){ component.set("v.listOfOpportunities", listOpp); for(var key in returnValue['mensagemErro']){ this.showInfoToast(key, returnValue['mensagemErro'][key]); break; } } }else if (state === 'ERROR') { var errors = response.getError(); if (errors[0] && errors[0].message) { helper.showToast('Erro', errors[0].message, 'error', 'dismissible'); } } else { helper.showToast('Erro', 'Erro desconhecido', 'error', 'dismissible'); } }); $A.enqueueAction(action); }, clear :function(component,event,heplper){ var pillTarget = component.find("lookup-pill"); var lookUpTarget = component.find("lookupField"); $A.util.addClass(pillTarget, 'slds-hide'); $A.util.removeClass(pillTarget, 'slds-show'); $A.util.addClass(lookUpTarget, 'slds-show'); $A.util.removeClass(lookUpTarget, 'slds-hide'); component.set("v.SearchKeyWord",null); component.set("v.listOfSearchRecords", null ); }, handleComponentEvent : function(component, event, helper) { var selectedUserGetFromEvent = event.getParam("userByEvent"); component.set("v.selectedRecord" , selectedUserGetFromEvent); var forclose = component.find("lookup-pill"); $A.util.addClass(forclose, 'slds-show'); $A.util.removeClass(forclose, 'slds-hide'); var forclose = component.find("searchRes"); $A.util.addClass(forclose, 'slds-is-close'); $A.util.removeClass(forclose, 'slds-is-open'); var lookUpTarget = component.find("lookupField"); $A.util.addClass(lookUpTarget, 'slds-hide'); $A.util.removeClass(lookUpTarget, 'slds-show'); }, clearAcc : function(component, event, helper){ var pillTarget = component.find("lookup-pillAcc"); var lookUpTarget = component.find("lookupFieldAcc"); $A.util.addClass(pillTarget, 'slds-hide'); $A.util.removeClass(pillTarget, 'slds-show'); $A.util.addClass(lookUpTarget, 'slds-show'); $A.util.removeClass(lookUpTarget, 'slds-hide'); component.set("v.SearchKeyWordAcc",null); component.set("v.listOfSearchRecordsAccount", null ); }, clearUser : function(component, event, helper){ var pillTarget = component.find("lookup-pillUser"); var lookUpTarget = component.find("lookupFieldUser"); $A.util.addClass(pillTarget, 'slds-hide'); $A.util.removeClass(pillTarget, 'slds-show'); $A.util.addClass(lookUpTarget, 'slds-show'); $A.util.removeClass(lookUpTarget, 'slds-hide'); component.set("v.searchKeyWordUser",null); component.set("v.listOfSearchRecordsUser", null); }, handleComponentEventAccount: function(component, event, helper){ var selectedAccountGetFromEvent = event.getParam("accountByEvent"); component.set("v.selectedRecordAccount" , selectedAccountGetFromEvent); var forclose = component.find("lookup-pillAcc"); $A.util.addClass(forclose, 'slds-show'); $A.util.removeClass(forclose, 'slds-hide'); var forclose = component.find("searchResAcc"); $A.util.addClass(forclose, 'slds-is-close'); $A.util.removeClass(forclose, 'slds-is-open'); var lookUpTarget = component.find("lookupFieldAcc"); $A.util.addClass(lookUpTarget, 'slds-hide'); $A.util.removeClass(lookUpTarget, 'slds-show'); }, handleComponentEventUser : function(component, event, helper){ var selectedUserGetFromEvent = event.getParam("userTwoByEvent"); component.set("v.selectedRecordUser" , selectedUserGetFromEvent); var forclose = component.find("lookup-pillUser"); $A.util.addClass(forclose, 'slds-show'); $A.util.removeClass(forclose, 'slds-hide'); var forclose = component.find("searchResAtt"); $A.util.addClass(forclose, 'slds-is-close'); $A.util.removeClass(forclose, 'slds-is-open'); var lookUpTarget = component.find("lookupFieldUser"); $A.util.addClass(lookUpTarget, 'slds-hide'); $A.util.removeClass(lookUpTarget, 'slds-show'); }, searchHelper : function(component,event,getInputkeyWord) { var action = component.get("c.getUsersName"); action.setParams({ 'searchKeyWord': getInputkeyWord }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var storeResponse = response.getReturnValue(); if (storeResponse.length == 0) { component.set("v.Message", 'Nenhum Resultado Encontrado...'); } else { component.set("v.Message", 'Buscando Resultado...'); } component.set("v.listOfSearchRecords", storeResponse); } }); $A.enqueueAction(action); }, searchHelperAccount : function(component,event,getInputkeyWord) { var action = component.get("c.getAccount"); action.setParams({ 'searchKeyWord': getInputkeyWord }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var storeResponse = response.getReturnValue(); if (storeResponse.length == 0) { component.set("v.messageAccount", 'Nenhum Resultado Encontrado...'); } else { component.set("v.messageAccount", 'Buscando Conta...'); } component.set("v.listOfSearchRecordsAccount", storeResponse); } }); $A.enqueueAction(action); }, searchHelperUser : function(component,event,getInputkeyWord) { var action = component.get("c.getUsersName"); action.setParams({ 'searchKeyWord': getInputkeyWord }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var storeResponse = response.getReturnValue(); if (storeResponse.length == 0) { component.set("v.messageUser", 'Nenhum Resultado Encontrado...'); } else { component.set("v.messageUser", 'Buscando Usuario...'); } component.set("v.listOfSearchRecordsUser", storeResponse); } }); $A.enqueueAction(action); }, showInfoToast : function(message, type) { var mode; switch(type) { case "info": mode = 'dismissible'; break; case "success": mode = 'pester'; break; case "error": mode = 'pester'; break; case "warning": mode = 'dismissible'; break; default: mode = 'dismissible'; } var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ title : 'Atenção!', message: message, duration:' 5000', key: 'info_alt', type: type, mode: mode }); toastEvent.fire(); }, showToast: function (title, message, type, mode) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ "title": title, "mode": mode, "type": type, "message": message, "duration": 10000 }); toastEvent.fire(); }, })
- Thiago Barbosa 1
- June 06, 2018
- Like
- 0
lightning:inputField console.log is undefinied
selectStageName : function(component, event, helper){ var stageName = component.find("stgName").get("v.value"); console.log("Stage Name" + stageName); },
<lightning:inputField aura:id="stgName" fieldName="StageName" value="{!v.opportunity.StageName}" onchange="{!c.selectStageName}" />
- Thiago Barbosa 1
- June 05, 2018
- Like
- 0
ApexPages.StandardSetController in lightning (filterId)
public void refreshOptyList(){ list<Opportunity> testList = new list<Opportunity>(); optyList.clear(); tooManyResults = false; if (filterId <> null && filterId<> 'None'){ optySetController.setFilterId(filterId); testList = (list<Opportunity>)optySetController.getRecords(); searchPerformed = true; }else searchPerformed = false; System.debug('Filter used=>'+filterId); System.debug('Result #=>'+ optySetController.getResultSize()); Integer counter = 0; for (Opportunity opty:testList){ optyList.add(new cOpty(Opty)); counter++; if (counter == 999){ tooManyResults = true; break; } } }
public MassReassignOpportunitiesController(){ //Variable Init optyQueryString = 'SELECT name,StageName,Ownerid, Owner.Name, CloseDate from Opportunity where isDeleted=false'; optyList = new List<cOpty>(); optySetController = new ApexPages.Standardsetcontroller(Database.getQueryLocator(optyQueryString+' limit 1000')); filterId = listviewoptions[0].getValue(); searchRecord = new Opportunity(); helperRecord = new Reassign_Helper__c(); isSuccess = true; searchPerformed = false; tooManyResults = false; isLightning = false; mapErros = new Map<String, String>(); //Apply the default filter //refreshOptyList(); }
- Thiago Barbosa 1
- June 01, 2018
- Like
- 0
Uncaught Action failed: lightning:recordEditForm$controller$handleSubmit [Cannot read property 'record' of null]
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId" controller="MassReassignOpportunitiesController" access="global"> <aura:attribute name="listOfOpportunities" type="List"/> <aura:attribute name="isExpanded" type="Boolean"/> <aura:attribute name="isExpandedPesq" type="Boolean" /> <aura:attribute name="lstTiposOpp" type="List"/> <aura:attribute name="lstTiposStage" type="List"/> <aura:attribute name="searchRecord" type="String"/> <aura:attribute name="lUser" type="User"/> <aura:attribute name="recordId" type="Id"/> <aura:attribute name="mapSearch" type="map" default="{}" /> <aura:attribute name="opportunity" type="Opportunity" default="{ 'sobjectType': 'Opportunity' }"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <div class="slds-grid slds-wrap"> <div class="slds-col slds-size_12-of-12"> <div class="slds-page-header"> <div class="slds-media"> <div class="slds-media__figure"> <span class="slds-icon_container slds-icon-standard-opportunity" title="Description of icon when needed"> <lightning:icon iconName="custom:custom18" size="xx-small" alternativeText="Indicates approval"/> </span> </div> <div class="slds-media__body"> <h1 class="slds-page-header__title slds-truncate slds-align-middle" title="Gestão de Mudança da Oportunidades">Gestão de mudança da oportunidades</h1> </div> </div> </div> </div> </div> <br/> <lightning:recordEditForm aura:id="recordViewForm" recordId="{!v.recordId}" objectApiName="Opportunity"> <div class="slds-page-header" style="background-color:#f4f6fe;"> <div class="slds-grid slds-wrap"> <div class="slds-col slds-size_12-of-12"> <div class="slds-box" style="background-color:#007add;"> <div class="demo-only demo-only--sizing slds-grid slds-wrap"> <div class="slds-size_12-of-12"> <h4 class="slds-text-title_caps" id="treeheading" style="color:#fff;">Pesquisar Oportunidades</h4> </div> </div> </div> <ul class="slds-tree" role="tree" aria-labelledby="treeheading"> <li role="treeitem" aria-level="1" aria-expanded="{!v.isExpanded}" aria-label="Tree Branch"> <br></br> <div class="slds-tree__item slds-is-selected"> <button class="slds-button slds-button_icon slds-button_icon slds-m-right_x-small" aria-hidden="{!v.isExpanded}" onclick="{!c.changeState}" tabindex="-1" title="Expand Tree Branch"> <lightning:icon iconName="utility:chevronright" size="xx-small" alternativeText="Indicates approval"/> <span class="slds-assistive-text">Pesquisa com Lista</span> </button> <span class="slds-size_1-of-1"> <span class="slds-tree__item-label slds-truncate" title="Pesquisa com Lista">Pesquisa com Lista</span> </span> </div> <ul role="group"> <li role="treeitem" aria-level="2" aria-selected="false"> <div class="demo-only demo-only--sizing slds-grid slds-wrap"> <div class="slds-size_3-of-12"> <lightning:select name="selectItem" label="Lista" onchange="{!c.selectOpp}"> <aura:iteration items="{!v.lstTiposOpp}" var="lstOpp"> <option value="{!lstOpp}">{!lstOpp}</option> </aura:iteration> </lightning:select> </div> </div> </li> <a href="/lightning/o/Opportunity/list?filterName=Recent" target="_new" >Criar novo modo de exibição</a> </ul> </li> </ul> </div> <br></br> <div class="slds-col slds-size_12-of-12"> <ul class="slds-tree" role="tree" aria-labelledby="treeheading"> <li role="treeitem" aria-level="1" aria-expanded="{!v.isExpandedPesq}" aria-label="Tree Branch"> <div class="slds-tree__item slds-is-selected"> <button class="slds-button slds-button_icon slds-button_icon slds-m-right_x-small" aria-hidden="{!v.isExpandedPesq}" onclick="{!c.changeStateTwo}" tabindex="-1" title="Pesquisar Oportunidades"> <lightning:icon iconName="utility:chevronright" size="xx-small" alternativeText="Indicates approval"/> <span class="slds-assistive-text">Pesquisa com um critério de busca</span> </button> <span class="slds-size_1-of-1"> <span class="slds-tree__item-label slds-truncate" title="Pesquisa com um critério de busca">Pesquisa com um critério de busca</span> </span> </div> <ul role="group"> <li role="treeitem" aria-level="2"> <div class="demo-only"> <div class="slds-form slds-form_compound"> <div class="slds-col slds-size_8-of-12"> <fieldset class="slds-form-element"> <div class="slds-form-element__group"> <div class="slds-form-element__row"> <div class="slds-form-element slds-size_1-of-2"> <lightning:inputField fieldName="Name"/> </div> <div class="slds-p-horizontal--xx-large"></div> <div class="slds-form-element slds-size_1-of-2"> <lightning:inputField fieldName="StageName" /> </div> </div> </div> </fieldset> </div> <div class="slds-col slds-size_8-of-12"> <fieldset class="slds-form-element"> <div class="slds-form-element__row"> <div class="slds-form-element slds-size_1-of-2"> <lightning:inputField fieldName="AccountId" /> </div> <div class="slds-p-horizontal--xx-large"></div> <div class="slds-form-element slds-size_1-of-2"> <lightning:inputField fieldName="OwnerId" /> </div> </div> </fieldset> </div> <div class="slds-col slds-size_8-of-12"> <fieldset class="slds-form-element"> <div class="slds-form-element__row"> <div class="slds-form-element slds-size_1-of-2"> <label class="slds-form-element__label" for="input-01">CNPJ/CPF</label> <input type="text" id="input-01" value="{!v.opportunity.BI_BR_CNPJ_CPF__c}" class="slds-input" /> </div> <div class="slds-p-horizontal--xx-large"></div> <div class="slds-form-element slds-size_1-of-2"> <label class="slds-form-element__label" for="input-01">Número da Oportunidade</label> <input type="text" id="input-01" value="{!v.opportunity.BI_BR_Identificador__c}" class="slds-input" /> </div> </div> </fieldset> </div> <div class="slds-col slds-size_8-of-12"> <fieldset class="slds-form-element"> <div class="slds-form-element__row"> <div class="slds-form-element slds-size_1-of-2"> <legend class="slds-form-element__label slds-text-title_caps">Data de Criação</legend> <label class="slds-form-element__label" for="input-01">A partir de</label> <input type="date" id="input-01" class="slds-input" value="{!v.opportunity.From__c}" /> <label class="slds-form-element__label" for="input-01">Até</label> <input type="date" id="input-01" class="slds-input" value="{!v.opportunity.To__c}" /> </div> <div class="slds-p-horizontal--xx-large"></div> <div class="slds-form-element slds-size_1-of-2"> <legend class="slds-form-element__label slds-text-title_caps">Data de fechamento estimado</legend> <label class="slds-form-element__label" for="input-01">A partir de</label> <input type="date" id="input-01" class="slds-input" value="{!v.opportunity.ClosedDate_From__c}" /> <label class="slds-form-element__label" for="input-01">Até</label> <input type="date" id="input-01" class="slds-input" value="{!v.opportunity.ClosedDate_To__c}"/> </div> </div> </fieldset> </div> </div> </div> </li> </ul> </li> </ul> </div> </div> </div> </lightning:recordEditForm>
- Thiago Barbosa 1
- May 28, 2018
- Like
- 0
Opportunity Owner in lightning
How to create Opportunity Owner in lightning?(Apex and cmp(controller, helper)
- Thiago Barbosa 1
- May 24, 2018
- Like
- 0
Selection options and ApexPages.StandardSetController in lightning
I want to create new method in lightning. public ApexPages.StandardSetController optySetController; public list<SelectOption> listviewoptions { get{ List<SelectOption> tempList = new List<SelectOption>(); tempList.add(new selectOption('None',System.Label.NoViewSelection)); if (optySetController<>null)tempList.addAll(optySetController.getListViewOptions()); return tempList; } }
- Thiago Barbosa 1
- May 24, 2018
- Like
- 0
How to coverage this class test?
@AuraEnabled public static Map<String, object> botaoExportarNovo(Map<String, object> btnExportar){ Map<String, object> mapaObj = new Map<String, object>(); CaseExpCsvController controller = new CaseExpCsvController(); try{ controller.lInicio = Date.valueOf((String)btnExportar.get('dataInicio')); controller.lfim = Date.valueOf((String)btnExportar.get('dataFinal')); controller.lAtualizar = Boolean.valueOf(btnExportar.get('lAtualizar')); controller.lFltTipoCaso = String.valueOf(btnExportar.get('lFltTipoCaso')); controller.lFltStatusCaso = String.valueOf(btnExportar.get('lFltStatusCaso')); controller.llCsvGerado = true; controller.botaoExportar(); mapaObj.put('lSelect', controller.ldisplay); }catch(exception e){ controller.errors.add(e.getMessage()); } mapaObj.put('Errors', controller.errors); return mapaObj; }
- Thiago Barbosa 1
- May 21, 2018
- Like
- 0
[Unexpected token u in JSON at position 0]
({ onSelectTipoCaso : function(component, event, helper){ var action = component.get("c.retornaOpcoesTipoCasoLightning"); action.setCallback(this,function(response){ var state = response.getState(); console.log('State' + state); if(state === "SUCCESS"){ var optionsList = []; var objreturn= response.getReturnValue(); for (var key in objreturn['lTipoAcaoApresentacao']) { optionsList.push({value: key, label: objreturn['lTipoAcaoApresentacao'][key] ,selected: response.getReturnValue()['lTiposApresentacao'] == key }); }; console.log("Option" + JSON.stringify(optionsList)); component.set("v.lstTiposApresentacao", optionsList); component.set('v.acaoTipos' , response.getReturnValue()['lTiposApresentacao']); }else if (state === 'ERROR') { var errors = response.getError(); if (errors[0] && errors[0].message) { helper.showToast('Erro', errors[0].message, 'error', 'dismissible'); } } else { helper.showToast('Erro', 'Erro desconhecido', 'error', 'dismissible'); } }); $A.enqueueAction(action); }, onExport : function(component, event, helper){ var mapExportar = component.get('v.mapExportar'); mapExportar["dataInicio"] = component.get("v.nomeCase").Data_Inicio__c; mapExportar["dataFinal"] = component.get("v.nomeCase").Data_Fim__c; mapExportar["lAtualizar"] = component.get('v.lAtualiza'); mapExportar["lFltTipoCaso"] = JSON.parse(component.find("selectItemCaso").get("v.value"))[0].value; mapExportar["lFltStatusCaso"] = component.get('v.lFltStatusCaso'); mapExportar["num_atc"] = component.get('v.num_atc'); mapExportar["lSysSoqlLimit"] = component.get('v.sql'); component.set('v.mapExportar', mapExportar); for(var key in mapExportar){ console.log('Map' + mapExportar["dataInicio"]); var isTipoData = (key == "dataInicio" || key == "dataFinal"); var isDateEmpty = (mapExportar['dataInicio'] == '' || mapExportar['dataInicio'] == null) || (mapExportar['dataFinal'] == '' || mapExportar['dataFinal'] == null); var isDateIniMaiorFim = (mapExportar['dataInicio'] > mapExportar['dataFinal']); if((isTipoData) && (isDateEmpty) || (isDateIniMaiorFim)) helper.showToast('Erro', 'Data não preenchida ou Data de inicio maior que a data fim!', 'error'); } var action = component.get("c.botaoExportarNov o"); action.setParams({ btnExportar : mapExportar }); action.setCallback(this, function(response){ var state = response.getState(); if(state === "SUCCESS"){ var returnValue = JSON.stringify(response.getReturnValue()['lSelect']); var errors = JSON.stringify(response.getReturnValue()['Errors']); console.log('Erros' + JSON.stringify(errors)); console.log('ReturnValue' + JSON.stringify(returnValue)); var retornoMapa = JSON.parse(returnValue); console.log('Retorno Mapa' + retornoMapa); }else if (state === 'ERROR') { var errors = response.getError(); if (errors[0] && errors[0].message) { helper.showToast('Erro', errors[0].message, 'error', 'dismissible'); } } else { helper.showToast('Erro', 'Erro desconhecido', 'error', 'dismissible'); } }); $A.enqueueAction(action); }, showToast: function (title, message, type, mode) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ "title": title, "mode": mode, "type": type, "message": message, "duration": 10000 }); toastEvent.fire(); }, })
- Thiago Barbosa 1
- May 17, 2018
- Like
- 0
Method does not exist or incorrect signature: void year() from the type String /Method does not exist or incorrect signature: void month() from the type String
//I'm with errors following . @AuraEnabled public static List<String> botaoExportarNovo(String lInicio, String lFim, boolean lAtualizar, String lCsvGerado, String lFltStatusCaso, String lFltTipoCaso, Integer NUM_ATCC, Integer lSysSoqlLimit, Mensagem_erro__c mensagem){ Date lInicioDate = Date.valueOf(lInicio); Date lfimDate = Date.valueOf(lFim); System.debug('Inicio' + lInicio); System.debug('lFim' + lFim); NUM_ATCC = 40; List<String> lretorno = new List<String>(); if (lInicioDate == null || lfimDate == null || lInicioDate > lfimDate) { String cMensagem = (mensagem.VF_importar_erro_data__c != null) ? mensagem.VF_importar_erro_data__c : 'Data não preenchida ou Data de inicio maior que a data fim!'; setMensagemNovo(cMensagem); lretorno.add(cMensagem); System.debug('Retorno' + lretorno); return lretorno; } boolean cLimiteEstourado = true; String query = 'SELECT COUNT() FROM Case '; String cWhere = ' WHERE RecordTypeId = \'' + lFltTipoCaso + '\''; if (lFltStatusCaso != 'Todos') cWhere += ' AND Status = \'' + lFltStatusCaso + '\''; if (lInicioDate != null) cWhere += ' AND CreatedDate > ' + lInicioDate.year() + '-' + string.valueof(lInicioDate.month() +100).right(2) + '-' + string.valueof(lInicioDate.day()+100).right(2) + 'T00:00:00Z AND CreatedDate < ' + lFim.year() + '-' + string.valueof(lFim.month() +100).right(2) + '-' + string.valueof(lfimDate.day()+100).right(2) + 'T23:59:59Z'; Integer cCaseCount = Database.countQuery(query + cWhere); if (cCaseCount < lSysSoqlLimit) { query = 'SELECT Id, Solicitante__r.Modelo_de_atuacao__c, Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c, CPF_CNPJ__c, Acao_carteira__c, Razao_Social_Cli__r.Codigo_Grupo__c, Modelo_de_atuacao__c FROM Case '; Set<String> lCodGrupo = new Set<String>(), lCodCli = new Set<String>(), lCpfCnpj = new Set<String>(), lModeloDeAtuacao = new Set<String>(); List<Case> lCasos = Database.query(query + cWhere); for (Case cCaso : lCasos) { if (cCaso.Acao_carteira__c == 'Cód. Cliente') { if (cCaso.Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c != null && !lCodCli.contains(cCaso.Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c)) lCodCli.add(cCaso.Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c); } else if (cCaso.Acao_carteira__c == 'CNPJ/CPF') { if (cCaso.CPF_CNPJ__c != null && !lCpfCnpj.contains(cCaso.CPF_CNPJ__c)) lCpfCnpj.add(cCaso.CPF_CNPJ__c); } else { if (cCaso.Razao_Social_Cli__r.Codigo_Grupo__c != null && !lCodGrupo.contains(cCaso.Razao_Social_Cli__r.Codigo_Grupo__c)) lCodGrupo.add(cCaso.Razao_Social_Cli__r.Codigo_Grupo__c); } if (!lModeloDeAtuacao.contains(cCaso.Solicitante__r.Modelo_de_atuacao__c)) lModeloDeAtuacao.add(cCaso.Solicitante__r.Modelo_de_atuacao__c); } Integer cAcc = [SELECT count() FROM Account WHERE Codigo_Grupo__c = :lCodGrupo OR BI_CAM_Codigo_del_cliente__c = :lCodCli OR BI_No_Identificador_fiscal__c = :lCpfCnpj]; if ((cCaseCount + (cAcc * NUM_ATCC)) < lSysSoqlLimit) cLimiteEstourado = false; } if (!cLimiteEstourado) { PageReference pg = Page.CaseCsv; pg.getParameters().put('Inicio', EncodingUtil.urlEncode( String.valueOf(lInicio), 'UTF-8')); pg.getParameters().put('Fim', EncodingUtil.urlEncode( String.valueOf(lFim), 'UTF-8')); pg.getParameters().put('Status', EncodingUtil.urlEncode(lFltStatusCaso , 'UTF-8')); pg.getParameters().put('Tipo', EncodingUtil.urlEncode(lFltTipoCaso , 'UTF-8')); String cMensagem = (mensagem.Relatorio_Sendo_Gerado__c != null) ? mensagem.Relatorio_Sendo_Gerado__c : 'Dados sendo gerados, aguarde alguns instantes!'; setMensagemNovo(cMensagem); lAtualizar = true; lCsvGerado = pg.getUrl(); lretorno.add(cMensagem); return lretorno; } String cMensagem = (mensagem.VF_importar_erro_limite__c != null) ? mensagem.VF_importar_erro_limite__c : 'Relatório muito extenso, por favor melhore os critérios selecionados!'; setMensagemNovo(cMensagem); lretorno.add(cMensagem); return lretorno; }
- Thiago Barbosa 1
- May 14, 2018
- Like
- 0
Is posible Page Reference in lightning ?
if (!cLimiteEstourado) { PageReference pg = Page.CaseCsv; pg.getParameters().put('Inicio', EncodingUtil.urlEncode( String.valueOf(this.lInicio), 'UTF-8')); pg.getParameters().put('Fim', EncodingUtil.urlEncode( String.valueOf(this.lFim), 'UTF-8')); pg.getParameters().put('Status', EncodingUtil.urlEncode( this.lFltStatusCaso , 'UTF-8')); pg.getParameters().put('Tipo', EncodingUtil.urlEncode( this.lFltTipoCaso , 'UTF-8')); String cMensagem = (this.mensagem.Relatorio_Sendo_Gerado__c != null) ? this.mensagem.Relatorio_Sendo_Gerado__c : 'Dados sendo gerados, aguarde alguns instantes!'; setMensagem(cMensagem, ApexPages.Severity.CONFIRM); this.lAtualizar = true; this.lCsvGerado = pg; return; }
- Thiago Barbosa 1
- May 11, 2018
- Like
- 0
errors in apex?
@AuraEnabled public static List<String> setMensagem(String msgInfo, ApexPages.Severity aSeverity){ //ApexPages.Message msg = new ApexPages.Message(aSeverity, msgInfo); //ApexPages.addMessage(msg);msgInfo List<String> lErros = new List<String>(); lErros.add(msgInfo); return lErros; }
I want to use errors in lightning.
- Thiago Barbosa 1
- May 10, 2018
- Like
- 0
How to migrate report in lightning component?
I want to transform the indexVar for to pass inside div. <apex:outputPanel id="reportResults" layout="block"> <apex:outputText value=" Executando..." rendered="{!reportIsRunning}"/> <apex:outputPanel rendered="{!NOT(reportIsRunning)}"> <div class="slds-scrollable--x"> <table class="slds-table slds-table--bordered slds-table--cell-buffer"> <thead> <tr class="slds-text-title--caps"> <apex:repeat value="{!reportResults.reportMetadata.detailColumns}" var="colName"> <th scope="col"> <div class="slds-truncate">{!UPPER(reportResults.reportExtendedMetadata.detailColumnInfo[colName].label)}</div> </th> </apex:repeat> </tr> </thead> <tbody> <apex:repeat value="{!reportResults.factMap['T!T'].rows}" var="row"> <tr> <apex:repeat value="{!row.dataCells}" var="cell"> <td><div class="slds-truncate">{!cell.label}</div></td> </apex:repeat> </tr> </apex:repeat> </tbody> </table> </div> </apex:outputPanel> </apex:outputPanel>
In lightning
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId" controller="GeolocationActivityReportController" access="global" > <aura:handler event="aura:waiting" action="{!c.showSpinner}"/> <aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/> <aura:attribute name="report" type="Boolean" /> <aura:attribute name="reportMetadata" type="List" /> <aura:attribute name="dataCells" type="List"/> <aura:attribute name="spinner" type="Boolean" /> <aura:attribute name="lgtWrapper" type="GeolocationLgtWrapper"/> <aura:attribute name="cliente" type="String"/> <aura:if isTrue="{!v.spinner}"> <div aura:id="spinnerId" class="slds-spinner_container"> <div class="slds-spinner--brand slds-spinner slds-spinner--large slds-is-relative" role="alert"> <span class="slds-assistive-text">Executando...</span> <div class="slds-spinner__dot-a"></div> <div class="slds-spinner__dot-b"></div> </div> </div> </aura:if> <div class="slds-grid slds-gutters"> <div class="slds-col slds-size_1-of-3" style="z-index:90"> <div class="slds-box slds-box_small"> <lightning:formattedText linkify="true" value="{!v.cliente}" /> <lightning:button aura:id="btnRelatorio" title="Ver relatorio" label="Ver relatorio" variant="neutral" onclick="{!c.openReport}"/> <lightning:button aura:id="fecharModal" title="Voltar" label="Voltar" variant="neutral" onclick="{!c.onExit}"/> </div> </div> <div class="slds-col slds-size_2-of-3" style="z-index:90"> <aura:if isTrue="{!v.report}"> <div class="slds-scrollable_x"> <table class="slds-table slds-table_bordered slds-table_cell-buffer"> <thead> <tr class="slds-text-title_caps"> <aura:iteration items="{!v.lgtWrapper.reportResults.reportMetadata.detailColumns}" var="colName" indexVar="colName"> <th scope="col"> <div class="slds-truncate">{!v.lgtWrapper.reportResults.reportExtendedMetadata.detailColumnInfo[colName].label}</div> </th> </aura:iteration> </tr> </thead> <tbody> <aura:iteration items="{!v.reportResult}" var="row" > <tr> <aura:iteration items="{!v.row.dataCells}" var="cell"> <td data-label="Account Name"> <div class="slds-truncate">{!cell.label}</div> </td> </aura:iteration> </tr> </aura:iteration> </tbody> </table> </div> </aura:if> </div> </div> </aura:component>
- Thiago Barbosa 1
- May 09, 2018
- Like
- 0
Uncaught Action failed: c:GeolocationLeafletMap$controller$accountsLoaded [Cannot read property 'addLayer' of null]
({ jsLoaded: function(component, event, helper) { setTimeout(function() { var map = L.map('map', {zoomControl: false}).setView([-23.6086713, -46.6943538], 14); L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri' }).addTo(map); // Add markers var map = component.get('v.map'); var accounts = component.get('v.accountList'); if(accounts) { for (var i=0; i<accounts.length; i++) { var account = accounts[i]; var latLng = [account.BillingLatitude , account.BillingLongitude]; L.marker(latLng, {account: account}).addTo(map); } } component.set("v.map", map); }); }, accountsLoaded : function(component, event, helper){ var map = component.get('v.map'); var accounts = event.getParam('accounts'); for(var i=0; i<accounts.length; i++){ var account = accounts[i]; var latLng = [account.BillingLatitude, account.BillingLongitude]; L.marker(latLng, {account: account}).addTo(map); } }, accountsSelected : function(component, event, helper){ var map = component.get('v.map'); var account = event.getParam("account"); map.panTo([account.BillingLatitude, account.BillingLongitude]); }, })
- Thiago Barbosa 1
- May 07, 2018
- Like
- 0
How I do to view the map in the page ?I created the function and attributes, but don't get to view the map in the page...
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId" controller="GeolocationLgtController" access="global" > <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <aura:attribute name="lstAccounts" type="List"/> <aura:attribute name="visit" type="String" /> <aura:attribute name="stateList" type="List"/> <aura:attribute name="stageList" type="List"/> <aura:attribute name="modalOpportunities" type="Boolean"/> <aura:attribute name="modalCampanhas" type="Boolean" /> <aura:attribute name="modalVisita" type="Boolean" /> <aura:attribute name="lgtWrapper" type="GeolocationLgtWrapper"/> <aura:attribute name="menuItemAttrState" type="Boolean" default="false"/> <aura:attribute name="menuItemAttrStage" type="Boolean" default="false"/> <aura:attribute name="map" type="Object"/> <ltng:require styles="/resource/leaflet/leaflet.css" /> <ltng:require scripts="/resource/leaflet/leaflet.js" afterScriptsLoaded="{!c.jsLoaded}" /> <div class="slds-grid slds-gutters"> <div class="slds-col slds-size_1-of-5" style="z-index:90"> <div aura:id="sairMenu" class="slds-is-open" aria-haspopup="true"> <lightning:layout horizontalAlign="space"> <div class="demo-only" style="height: 1rem;"> <div class="slds-form-element"> <label class="slds-form-element__label" for="combobox-unique-id-3">Busca:</label> <div class="slds-form-element__control"> <div class="slds-combobox_container"> <div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open" aria-expanded="true" aria-haspopup="listbox" role="combobox"> <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none"> <input aura:id="accountName" type="text" class="slds-input slds-combobox__input" id="combobox-unique-id-1" aria-controls="listbox-unique-id" onkeyup="{!c.filterAccountName}" /> <span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right"> <lightning:icon iconName="utility:search" size="xx-small"/> </span> </div> <div id="listbox-unique-id" role="listbox"> <ul class="slds-listbox slds-listbox_vertical slds-dropdown slds-dropdown_fluid" role="presentation"> <aura:if isTrue="{! v.lgtWrapper.lstAccount.length > 0}"> <aura:iteration items="{!v.lgtWrapper.lstAccount}" var="wpr"> <li role="presentation" class="slds-listbox__item" onclick="{!c.filterAccountId}" data-index="{!wpr.Id}"> <div id="listbox-option-unique-id-01" class="slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta" role="option"> <span class="slds-media__figure"> <span class="slds-icon_container slds-icon-standard-account"> <lightning:icon iconName="standard:account" size="small"/> <span class="slds-assistive-text">{!wpr.Name}</span> </span> </span> <span class="slds-media__body"> <span class="slds-listbox__option-text slds-listbox__option-text_entity">{!wpr.Name}</span> <span class="slds-listbox__option-meta slds-listbox__option-meta_entity">{!wpr.BillingStreet}</span> </span> </div> </li> </aura:iteration> <aura:set attribute="else"> <li> <div> Nenhum resultado encontrado </div> </li> </aura:set> </aura:if> </ul> </div> </div> </div> </div> </div> </div> <div aura:id="filterListId" class="slds-dropdown-trigger slds-dropdown-trigger--click slds-is-hide" style="margin-top:21px;"> <button class="slds-button slds-button--icon-border-filled" aria-haspopup="true" onclick="{!c.toggleFilterList}"> <lightning:icon iconName="utility:filterList" size="xx-small"/> </button> <div class="slds-dropdown slds-dropdown--left slds-dropdown--medium"> <ul class="dropdown__list" role="menu"> <li class="slds-dropdown__item"> <a href="javascript:void(0)" role="menuitem" onclick="{!c.filterAll}"> <p class="slds-truncate">Todos os Clientes</p> </a> </li> <li class="slds-dropdown__item"> <a href="javascript:void(0)" role="menuitem" onclick="{!c.searchCampaigns}"> <p class="slds-truncate">Filtro por Campanha</p> </a> </li> <li class="slds-dropdown__item slds-has-submenu" role="presentation"> <a role="menuitem" href="javascript:void(0);" aria-haspopup="true" aria-expanded="{!v.menuItemAttrState}" tabindex="-1" onclick="{!c.showMenuState}"> <span class="slds-truncate" title="Menu Item Three">Filtro por Estado</span> <lightning:icon iconName="utility:right" size="xx-small"/> </a> <div class="slds-dropdown slds-dropdown_submenu slds-dropdown_submenu-right slds-dropdown_length-with-icon-5"> <ul class="slds-dropdown__list" role="menu"> <aura:iteration items="{!v.stateList}" var="state"> <li class="slds-dropdown__item" role="presentation" aria-haspopup="true" onclick="{!c.filterState}" data-index="{!state}"> <a href="javascript:void(0);" role="menuitem" tabindex="0"> <span class="slds-truncate">{!state}</span> </a> </li> </aura:iteration> </ul> </div> </li> <li class="slds-dropdown__item" onclick="{!c.filterVisited}"> <a href="javascript:void(0)" role="menuitem"> <p class="slds-truncate">Visitado</p> </a> </li> <li class="slds-dropdown__item" onclick="{!c.filterNotVisited}"> <a href="javascript:void(0)" role="menuitem"> <p class="slds-truncate">Não Visitado</p> </a> </li> <li class="slds-dropdown__item slds-has-submenu" role="presentation"> <a role="menuitem" href="javascript:void(0);" aria-haspopup="true" aria-expanded="{!v.menuItemAttrStage}" tabindex="-1" onclick="{!c.showMenuStage}"> <span class="slds-truncate" title="Menu Item Three">Fases da Oportunidade</span> <lightning:icon iconName="utility:right" size="xx-small"/> </a> <div class="slds-dropdown slds-dropdown_submenu slds-dropdown_submenu-right slds-dropdown_length-with-icon-5"> <ul class="slds-dropdown__list" role="menu"> <aura:iteration items="{!v.stageList}" var="stage"> <li class="slds-dropdown__item" role="presentation" onclick="{!c.filterStage}" data-index="{!stage}"> <a href="javascript:void(0);" role="menuitem" tabindex="0"> <span class="slds-truncate">{!stage}</span> </a> </li> </aura:iteration> </ul> </div> </li> </ul> </div> </div> </lightning:layout> </div> </div> <div class="slds-col slds-size_4-of-5"> <div class="slds-col slds-size_1-of-1"> <div class="slds-page-header"> <div class="slds-grid"> <div class="slds-col_bump-right"> <div class="slds-media"> <div class="slds-media__figure"> <span class="slds-icon_container slds-icon-standard-opportunity"> <lightning:icon iconName="custom:custom15" size="medium" class="slds-page-header__icon"/> </span> </div> <div class="slds-media__body"> <h1 class="slds-page-header__title slds-truncate slds-align-middle">Clientes</h1> </div> </div> <div> <div style="margin-top: 5px; margin-left: 45px;"> <aura:if isTrue="{!v.lgtWrapper.resumeAcc.Id != null}"> <button class="slds-button slds-button_neutral" onclick="{!c.openAccount}">Ver</button> </aura:if> {!v.lgtWrapper.resumeAcc.Name} </div> </div> </div> <div> <aura:if isTrue="{!v.lgtWrapper.resumeAcc.Id != null}"> <button class="slds-button slds-button--neutral" style="font-size:12px;" onclick="{!c.novaVisita}">Nova Visita</button> </aura:if> <aura:if isTrue="{!v.lgtWrapper.resumeAcc.Id != null}"> <button class="slds-button slds-button--neutral" style="font-size:12px;" onclick="{!c.visita}">Visita</button> </aura:if> <button class="slds-button slds-button--neutral" style="font-size:12px;" onclick="{!c.onExit}">Sair</button> </div> </div> <ul class="slds-grid slds-page-header__detail-row"> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Endereço">Endereço</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.BillingStreet}</p> </li> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Telefone">Telefone</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.Phone}</p> </li> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Identificador fiscal">Identificador fiscal</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.BI_No_Identificador_fiscal__c}</p> </li> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Segmento">Segmento</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.BI_BR_Organizacao__c}</p> </li> </ul> </div> </div> <b><div class="slds-col slds-size_1-of-1" style="margin-top: 15px"> <div class="map" id="map"></div> </div></b> </aura:component>
({ doInit : function(component, event, helper) { helper.getStateListHlp(component, event, helper); helper.getStageListHlp(component, event, helper); helper.searchAccounts(component, event, helper, {}); window.addEventListener('click', function(e){ if(component.find('filterListId')) { if (component.find('filterListId').getElement().contains(e.target)){ //console.log("Clicked in Box"); } else{ //console.log("Clicked outside Box"); } } }) }, filterAccountName : function(component, event, helper){ var searchCmp = component.find("accountName").getElement(); var accountName = ((!searchCmp) ? null : searchCmp.value); helper.searchAccounts(component, event, helper, {accountName : accountName}); }, filterAccountId : function(component, event, helper){ var targetSource = event.currentTarget; var accId = targetSource.dataset.index; helper.searchAccounts(component, event, helper, {accId : accId}); }, toggleFilterList : function(component, event, helper) { helper.toggleFilterList(component); }, filterAll : function(component, event, helper){ helper.toggleFilterList(component); helper.searchAccounts(component, event, helper, {}); helper.resetSearch(component); }, searchCampaigns : function(component, event, helper){ helper.toggleFilterList(component); helper.searchCampaigns(component, event, helper); }, filterCampaign : function(component, event, helper){ helper.filterCampaign(component, event, helper); }, toCloseCampaign : function(component, event, helper){ component.set("v.modalCampanhas", false); helper.resetSearch(component); }, showMenuState : function(component, event, helper){ var menuItemAttrEstado = component.get("v.menuItemAttrState"); component.set("v.menuItemAttrState", !menuItemAttrEstado); }, filterState : function(component, event, helper){ helper.toggleFilterList(component); var targetSource = event.currentTarget; var state = targetSource.dataset.index; helper.searchAccounts(component, event, helper, {state : state}); helper.resetSearch(component); }, filterVisited : function(component, event, helper){ helper.toggleFilterList(component); helper.searchAccounts(component, event, helper, {"visitado" : "true"}); helper.resetSearch(component); }, filterNotVisited : function(component, event, helper){ helper.toggleFilterList(component); helper.searchAccounts(component, event, helper, {"visitado" : "false"}); helper.resetSearch(component); }, showMenuStage : function(component, event, helper){ var menuItemAttrStage = component.get("v.menuItemAttrStage"); component.set("v.menuItemAttrStage", !menuItemAttrStage); }, filterStage : function(component, event, helper){ helper.toggleFilterList(component); var targetSource = event.currentTarget; var stage = targetSource.dataset.index; helper.searchAccounts(component, event, helper, {stage : stage}); helper.resetSearch(component); }, onExit : function (component, event, helper) { var url = window.location.protocol + '//' + window.location.host + '/home/home.jsp' console.log('url : ' + url); var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "isredirect": true, "url": url }); urlEvent.fire(); }, openAccount : function (component, event, helper) { var accId = component.get("v.lgtWrapper.resumeAcc.Id"); var navEvt = $A.get("e.force:navigateToSObject"); navEvt.setParams({ "recordId": accId, "slideDevName": "detail" }); navEvt.fire(); }, novaVisita : function(component, event, helper){ helper.novaVisita(component, event, helper); }, fillAccountResume : function(component, event, helper){ helper.fillAccountResume(component, event, helper); }, toCloseVisita : function(component, event, helper){ component.set("v.modalVisita", false); }, toCancelVisita : function(component, event, helper){ component.set("v.modalVisita", false); }, toCloseOpp : function(component, event, helper){ component.set("v.modalOpportunities", false); }, jsLoaded: function(component, event, helper) { var map = L.map('map', {zoomControl: false, tap: false}) .setView([37.784173, -122.401557], 14); L.tileLayer( 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri' }).addTo(map); component.set("v.map", map); } })
- Thiago Barbosa 1
- May 07, 2018
- Like
- 0
Canvas app in Lightning component showing blank screen every first time
Hello,
I have a problem with Canvas App clicking it opens a canvas application and displays the canvas blank. When the users clear cache the display open normally.
<force:canvasApp developerName="QuotesCanvas" applicationName="QuotesCanvas" parameters="{!v.inputCampo}" width = "100%" height="400px"/>
Can you help to me?
I have a problem with Canvas App clicking it opens a canvas application and displays the canvas blank. When the users clear cache the display open normally.
<force:canvasApp developerName="QuotesCanvas" applicationName="QuotesCanvas" parameters="{!v.inputCampo}" width = "100%" height="400px"/>
Can you help to me?
- Thiago Barbosa 1
- October 02, 2018
- Like
- 0
Method does not exist or incorrect signature: void year() from the type String /Method does not exist or incorrect signature: void month() from the type String
//I'm with errors following . @AuraEnabled public static List<String> botaoExportarNovo(String lInicio, String lFim, boolean lAtualizar, String lCsvGerado, String lFltStatusCaso, String lFltTipoCaso, Integer NUM_ATCC, Integer lSysSoqlLimit, Mensagem_erro__c mensagem){ Date lInicioDate = Date.valueOf(lInicio); Date lfimDate = Date.valueOf(lFim); System.debug('Inicio' + lInicio); System.debug('lFim' + lFim); NUM_ATCC = 40; List<String> lretorno = new List<String>(); if (lInicioDate == null || lfimDate == null || lInicioDate > lfimDate) { String cMensagem = (mensagem.VF_importar_erro_data__c != null) ? mensagem.VF_importar_erro_data__c : 'Data não preenchida ou Data de inicio maior que a data fim!'; setMensagemNovo(cMensagem); lretorno.add(cMensagem); System.debug('Retorno' + lretorno); return lretorno; } boolean cLimiteEstourado = true; String query = 'SELECT COUNT() FROM Case '; String cWhere = ' WHERE RecordTypeId = \'' + lFltTipoCaso + '\''; if (lFltStatusCaso != 'Todos') cWhere += ' AND Status = \'' + lFltStatusCaso + '\''; if (lInicioDate != null) cWhere += ' AND CreatedDate > ' + lInicioDate.year() + '-' + string.valueof(lInicioDate.month() +100).right(2) + '-' + string.valueof(lInicioDate.day()+100).right(2) + 'T00:00:00Z AND CreatedDate < ' + lFim.year() + '-' + string.valueof(lFim.month() +100).right(2) + '-' + string.valueof(lfimDate.day()+100).right(2) + 'T23:59:59Z'; Integer cCaseCount = Database.countQuery(query + cWhere); if (cCaseCount < lSysSoqlLimit) { query = 'SELECT Id, Solicitante__r.Modelo_de_atuacao__c, Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c, CPF_CNPJ__c, Acao_carteira__c, Razao_Social_Cli__r.Codigo_Grupo__c, Modelo_de_atuacao__c FROM Case '; Set<String> lCodGrupo = new Set<String>(), lCodCli = new Set<String>(), lCpfCnpj = new Set<String>(), lModeloDeAtuacao = new Set<String>(); List<Case> lCasos = Database.query(query + cWhere); for (Case cCaso : lCasos) { if (cCaso.Acao_carteira__c == 'Cód. Cliente') { if (cCaso.Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c != null && !lCodCli.contains(cCaso.Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c)) lCodCli.add(cCaso.Razao_Social_Cli__r.BI_CAM_Codigo_del_cliente__c); } else if (cCaso.Acao_carteira__c == 'CNPJ/CPF') { if (cCaso.CPF_CNPJ__c != null && !lCpfCnpj.contains(cCaso.CPF_CNPJ__c)) lCpfCnpj.add(cCaso.CPF_CNPJ__c); } else { if (cCaso.Razao_Social_Cli__r.Codigo_Grupo__c != null && !lCodGrupo.contains(cCaso.Razao_Social_Cli__r.Codigo_Grupo__c)) lCodGrupo.add(cCaso.Razao_Social_Cli__r.Codigo_Grupo__c); } if (!lModeloDeAtuacao.contains(cCaso.Solicitante__r.Modelo_de_atuacao__c)) lModeloDeAtuacao.add(cCaso.Solicitante__r.Modelo_de_atuacao__c); } Integer cAcc = [SELECT count() FROM Account WHERE Codigo_Grupo__c = :lCodGrupo OR BI_CAM_Codigo_del_cliente__c = :lCodCli OR BI_No_Identificador_fiscal__c = :lCpfCnpj]; if ((cCaseCount + (cAcc * NUM_ATCC)) < lSysSoqlLimit) cLimiteEstourado = false; } if (!cLimiteEstourado) { PageReference pg = Page.CaseCsv; pg.getParameters().put('Inicio', EncodingUtil.urlEncode( String.valueOf(lInicio), 'UTF-8')); pg.getParameters().put('Fim', EncodingUtil.urlEncode( String.valueOf(lFim), 'UTF-8')); pg.getParameters().put('Status', EncodingUtil.urlEncode(lFltStatusCaso , 'UTF-8')); pg.getParameters().put('Tipo', EncodingUtil.urlEncode(lFltTipoCaso , 'UTF-8')); String cMensagem = (mensagem.Relatorio_Sendo_Gerado__c != null) ? mensagem.Relatorio_Sendo_Gerado__c : 'Dados sendo gerados, aguarde alguns instantes!'; setMensagemNovo(cMensagem); lAtualizar = true; lCsvGerado = pg.getUrl(); lretorno.add(cMensagem); return lretorno; } String cMensagem = (mensagem.VF_importar_erro_limite__c != null) ? mensagem.VF_importar_erro_limite__c : 'Relatório muito extenso, por favor melhore os critérios selecionados!'; setMensagemNovo(cMensagem); lretorno.add(cMensagem); return lretorno; }
- Thiago Barbosa 1
- May 14, 2018
- Like
- 0
Uncaught Action failed: c:Geolocation$controller$itemSelected [Cannot read property 'getAttribute' of null]
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId" controller="GeolocationLgtController" access="global" > <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <aura:attribute name="modalOpp" type="String" /> <aura:attribute name="lstCampaign" type="List" /> <aura:attribute name="visita" type="String"/> <aura:attribute name="stateList" type="List"/> <aura:attribute name="lstAccounts" type="List"/> <aura:attribute name="lstStageName" type="List"/> <aura:attribute name="resume" type="Boolean"/> <aura:attribute name="modalOpportunities" type="Boolean"/> <aura:attribute name="modalCampanhas" type="Boolean" /> <aura:attribute name="modalVisita" type="Boolean" /> <aura:attribute name="visit" type="String" /> <aura:attribute name="pageClientes" type="String"/> <aura:attribute name="menuPaiItem" type="Boolean" default="false"/> <aura:attribute name="lgtWrapper" type="GeolocationLgtWrapper"/> <aura:attribute name="habilitaNovaVisita" type="Boolean"/> <aura:attribute name="habilitaVisita" type="Boolean"/> <aura:attribute name="menuItemAttrEstado" type="Boolean" default="false"/> <aura:attribute name="menuItemAttrStage" type="Boolean" default="false"/> <aura:if isTrue="{!v.modalOpportunities}"> <div class="demo-only" style="height: 640px;"> <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open"> <div class="slds-modal__container"> <header class="slds-modal__header"> <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close"> <lightning:icon iconName="utility:close" size="xx-small" class="slds-page-header__icon"/> <span class="slds-assistive-text">Close</span> </button> <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Oportunidades</h2> </header> <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1"> <table class="slds-table slds-table_bordered slds-table_cell-buffer"> <thead> <tr class="slds-text-title_caps"> <th scope="col"> <div class="slds-truncate" title="Opportunity Name">Nome da Oportunidade</div> </th> <th scope="col"> <div class="slds-truncate" title="Account Name">Etapa</div> </th> <th scope="col"> <div class="slds-truncate" title="Close Date">Data de Fechamento</div> </th> <th scope="col"> <div class="slds-truncate" title="Stage">Valor</div> </th> </tr> </thead> <tbody> </tbody> <aura:iteration items="{!v.lstOpportunity}" var="opp"> <tr> <th scope="row" data-label="Opportunity Name"> <div class="slds-truncate" title="Cloudhub"><a href="javascript:void(0);">{!opp.Name}</a></div> </th> <td data-label="Account Name"> <div class="slds-truncate" title="Cloudhub">{!opp.StageName}</div> </td> <td data-label="Close Date"> <div class="slds-truncate" title="4/14/2015"><lightning:formattedText linkify="true" value="" />{!opp.CloseDate}</div> </td> <td data-label="Prospecting"> <div class="slds-truncate" title="Prospecting">{!opp.BI_BR_Valor_Nao_recorrente__c}</div> </td> </tr> </aura:iteration> </table> </div> <footer class="slds-modal__footer"> <button class="slds-button slds-button_neutral">Fechar</button> </footer> </div> </section> <div class="slds-backdrop slds-backdrop_open"></div> </div> </aura:if> <aura:if isTrue="{!v.filterCampaign}"> <ul class="slds-grid slds-page-header__detail-row"> <aura:iteration items="{!v.lstAccounts}" var="cliente"> <li role="presentation" class="slds-page-header__detail-block" onclick=""> <div class="slds-media__body"> <div class="slds-lookup__result-text"><a onclick="">{!cliente.accName}</a></div> <span class="slds-lookup__result-meta slds-text-body--small" style="font-size:12px;">{!cliente.accStreet}</span> </div> </li> </aura:iteration> </ul> </aura:if> <aura:if isTrue="{!v.modalCampanhas}"> <div class="demo-only" style="height: 640px;"> <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open"> <div class="slds-modal__container"> <header class="slds-modal__header"> <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close"> <lightning:icon iconName="utility:close" size="xx-small" class="slds-page-header__icon"/> <span class="slds-assistive-text">Close</span> </button> <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Campanhas</h2> </header> <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1"> <table class="slds-table slds-table_bordered slds-table_cell-buffer"> <thead> <tr class="slds-text-title_caps"> <th scope="col"> <div class="slds-truncate" title="Opportunity Name">Nome da Campanha</div> </th> </tr> </thead> <tbody> </tbody> <aura:iteration items="{!v.lstCampaign}" var="camp" /> <tr> <th scope="row" data-label="Opportunity Name"> <div class="slds-truncate" title="Cloudhub"><a href="javascript:void(0);">{!camp.campName}</a></div> </th> </tr> </table> </div> <footer class="slds-modal__footer"> <button class="slds-button slds-button_neutral">Fechar</button> </footer> </div> </section> <div class="slds-backdrop slds-backdrop_open"></div> </div> </aura:if> <aura:if isTrue="{!v.modalVisita}"> <div class="demo-only" style="height: 640px;"> <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open"> <div class="slds-modal__container"> <header class="slds-modal__header"> <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close"> <lightning:icon iconName="utility:close" size="xx-small" class="slds-page-header__icon"/> <span class="slds-assistive-text">Close</span> </button> <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Nova Visita</h2> </header> <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1"> <lightning:formattedText linkify="true" value="" /> <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Assunto_Visita__c}" /> <lightning:outputField fieldName="Name" value="{!v.visit.StartDateTime}" /> <lightning:outputField fieldName="Name" value="{!v.visit.EndDateTime}"/> <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Status__c}"/> <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Motivo__c}"/> <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Observacao__c}"/> </div> <footer class="slds-modal__footer"> <button class="slds-button slds-button_neutral">Salvar</button> <button class="slds-button slds-button_neutral">Cancelar</button> </footer> </div> </section> <div class="slds-backdrop slds-backdrop_open"></div> </div> </aura:if> <div class="slds-m-left_xx-large" style="margin-left:300px;"> <div class="slds-page-header"> <div class="slds-media"> <div class="slds-media__figure"> <span class="slds-icon_container slds-icon-standard-opportunity"> <lightning:icon iconName="custom:custom15" size="medium" class="slds-page-header__icon"/> </span> </div> <div class="slds-media__body"> <h1 class="slds-page-header__title slds-truncate slds-align-middle">Clientes</h1> <p class="slds-text-body_small slds-line-height_reset"><button class="slds-button slds-button_neutral">Ver</button></p> </div> </div> <div class="slds-grid slds-grid_align-end"> <button class="slds-button slds-button--neutral" style="font-size:12px;">Sair</button> <aura:if isTrue="{!v.habilitaNovaVisita}"> <button class="slds-button slds-button--neutral" style="font-size:12px;">NovaVisita</button> </aura:if> <aura:if isTrue="{!v.habilitaVisita}"> <button class="slds-button slds-button--neutral" style="font-size:12px;">Visita</button> </aura:if> </div> <ul class="slds-grid slds-page-header__detail-row"> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Endereço">Endereço</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.BillingStreet}</p> </li> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Telefone">Telefone</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.Phone}</p> </li> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Identificador fiscal">Identificador fiscal</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.BI_No_Identificador_fiscal__c}</p> </li> <li class="slds-page-header__detail-block"> <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Segmento">Segmento</p> <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.Segmento_do_Cliente__c}</p> </li> </ul> </div> </div> <div aura:id="sairMenu" class="slds-grid slds-grid_vertical-align-start slds-is-open" style="margin-top:-130px;" aria-haspopup="true"> <lightning:layout horizontalAlign="space"> <div class="demo-only" style="height: 10rem;"> <div class="slds-form-element"> <label class="slds-form-element__label" for="combobox-unique-id-1">Busca:</label> <div class="slds-form-element__control"> <div class="slds-combobox_container"> <div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open" aria-expanded="true" aria-haspopup="listbox" role="combobox"> <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none"> <input aura:id="searchAcc" type="text" class="slds-input slds-combobox__input" id="combobox-unique-id-1" aria-controls="listbox-unique-id" onkeyup="{!c.buscaFiltro}" /> <span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right"> <lightning:icon iconName="utility:search" size="xx-small"/> </span> </div> <div id="listbox-unique-id" role="listbox"> <ul class="slds-listbox slds-listbox_vertical slds-dropdown slds-dropdown_fluid" role="presentation"> <aura:iteration items="{!v.lgtWrapper.lstAccount}" var="wpr" indexVar="i"> <li data-selectedIndex="{!wpr.id}" onclick="{!c.itemSelected}" value="{!v.lgtWrapper.lstAccount}" role="presentation" class="slds-listbox__item"> <div id="listbox-option-unique-id-01" class="slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta" role="option"> <span class="slds-media__figure"> <span class="slds-icon_container slds-icon-standard-account"> <lightning:icon iconName="standard:account" size="xx-small"/> </span> </span> <span class="slds-media__body"> <span class="slds-listbox__option-text slds-listbox__option-text_entity">{!wpr.Name}</span> <span class="slds-listbox__option-meta slds-listbox__option-meta_entity">{!wpr.BillingStreet}</span> </span> </div> </li> </aura:iteration> </ul> </div> </div> </div> </div> </div> </div> </aura:component>
({ doInit : function(component, event, helper) { helper.getStateListHlp(component); helper.getStateListOpp(component); helper.searchClientesHlp(component, event); }, buscaFiltro : function(component, event, helper){ helper.searchClientesHlp(component, event); }, itemSelected : function(component, event, helper){ helper.itemSelected(component, event, helper); }, mostraMenuPai : function(component, event, helper) { var menu = component.find("menulistPai"); $A.util.toggleClass(menu, "slds-is-open"); }, mostraMenuEstado : function(component, event, helper){ var menuItemAttrEstado = component.get("v.menuItemAttrEstado"); component.set("v.menuItemAttrEstado", !menuItemAttrEstado); }, mostraMenuStage : function(component, event, helper){ var menuItemAttrStage = component.get("v.menuItemAttrStage"); component.set("v.menuItemAttrStage", !menuItemAttrStage); } })
({ getStateListHlp : function(component) { var action = component.get("c.getStateList"); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var returnValue = response.getReturnValue(); component.set("v.stateList", returnValue); } else if (state === "INCOMPLETE" || state === "ERROR") { var errors = response.getError(); if (errors) { if (errors[0] && errors[0].message) { console.log("Error message: " + errors[0].message); } } else { console.log("Erro desconhecido."); } } }); $A.enqueueAction(action); }, getStateListOpp : function(component) { var action = component.get("c.getLstStageName"); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var returnValue = response.getReturnValue(); component.set("v.lstStageName", returnValue); } else if (state === "INCOMPLETE" || state === "ERROR") { var errors = response.getError(); if (errors) { if (errors[0] && errors[0].message) { console.log("Error message: " + errors[0].message); } } else { console.log("Erro desconhecido."); } } }); $A.enqueueAction(action); }, searchClientesHlp : function(component, event) { var action = component.get("c.searchClientes"); var searchCmp = component.find("searchAcc").getElement(); var searchValue = ((!searchCmp) ? null : searchCmp.value); var conta = event.target; var idAcc = ((!conta) ? null : conta.dataset.rowIndex); console.log('Conta selecionada -> ' + conta); console.dir(conta); console.log('Id Conta selecionada -> ' + idAcc); action.setParams({ idAcc : idAcc, searchAcc : searchValue }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var returnValue = response.getReturnValue(); console.log("Retorno Search Cliente"); console.dir(returnValue); component.set("v.lgtWrapper", returnValue); } else if (state === "INCOMPLETE" || state === "ERROR") { var errors = response.getError(); if (errors) { if (errors[0] && errors[0].message) { console.log("Error message: " + errors[0].message); } } else { console.log("Erro desconhecido."); } } }); $A.enqueueAction(action); }, itemSelected : function(component, event, helper){ var target = event.target.getAttribute('value'); console.log('Target' + target); var selectedIndex = helper.getIndexFrmParent(target,helper,"data-selectedIndex"); if(selectedIndex) { var resultadoServer = component.get("v.lgtWrapper"); var selItem = resultadoServer[selectedIndex]; if(selItem.val){ component.set("v.lgtWrapper", selItem); component.set("v.lgtWrapper", resultadoServer); } component.set("v.lgtWrapper", null); } }, getIndexFrmParent : function(target,helper,attributeToFind){ var SelIndex = target.getAttribute(attributeToFind); while(!SelIndex){ target = target.parentNode ; SelIndex = helper.getIndexFrmParent(target,helper,attributeToFind); } return SelIndex; }, })
- Thiago Barbosa 1
- May 02, 2018
- Like
- 0
Error: Problem with the Trigger or test class// The 'MaintenanceRequest' trigger does not appear to be handling bulk operations correctly. For the positive use case of inserting and updating more than 200 records, it did not produce the expected outcome.
/* Hello, I'm with problem in the trigger or test class. The error this be : System.AssertException: Assertion Failed: Expected: 402, Actual: 1204 The 'MaintenanceRequest' trigger does not appear to be handling bulk operations correctly. For the positive use case of inserting and updating more than 200 records, it did not produce the expected outcome. */ trigger MaintenanceRequest on Case (before update, after update) { List<Case> ClosedList = [SELECT Type, Status, Equipment__c, Date_Due__c, Date_Reported__c, Vehicle__c FROM Case WHERE status = 'Closed']; if(Trigger.isUpdate){ for(Case c : Trigger.New){ if(c.Type == 'Repair' || c.Type =='Routine Maintenance'){ ClosedList.add(c); } } } MaintenanceRequestHelper.updateWorkOrders(ClosedList); }
@isTest public class MaintenanceRequestTest { @isTest static void testSetup(){ List<Product2> equip = new List<Product2>(); equip.add(new Product2(Name ='Test Equipament', Maintenance_Cycle__c = 10, Cost__c = 100, Current_Inventory__c = 10, Lifespan_Months__c = 10, Replacement_Part__c = true, Warehouse_SKU__c = 'abc')); insert equip; System.debug( 'Equip' + equip); Database.insert(equip, false); } @isTest static void testMaintenanceRequest(){ MaintenanceRequestTest.testSetup(); List<Case> listInsert = new List<Case>(); List<Case> listUpdate = new List<Case>(); Id equipId = [SELECT Id FROM Product2 LIMIT 1].Id; System.debug('Product2' + equipId); Vehicle__c vhcl1 = new Vehicle__c(Name = 'VehicleTest1'); Product2 prd1 = new Product2(Name = 'ProductTest1', Maintenance_Cycle__c = 2, Replacement_Part__c = true); for(Integer i = 0 ; i < 300; i++){ Case caseInsert = new Case(Type='Routine Maintenance', Status = 'New', Origin = 'Phone', Subject = 'Routine Maintenance Request', Date_Reported__c = date.today(), Date_Due__c = date.today(), Vehicle__c = vhcl1.id, Equipment__c = prd1.id); caseInsert.Equipment__c = equipId; listInsert.add(caseInsert); System.debug('List Insert' + listInsert.size()); } Test.startTest(); Database.insert(listInsert, false); System.debug('Insert' + listInsert.size()); System.assertEquals(listInsert.size() == 300, true); for(Case c: listInsert){ c.Status = 'Closed'; listUpdate.add(c); } Database.update (listUpdate, false); System.assertEquals(listUpdate.size() == 300, true); User usuario = [SELECT id FROM User WHERE Id =: UserInfo.getUserId()]; System.runAs(usuario){ List<Case> ClosedCaseList = [SELECT Type, Status, Equipment__c, Date_Due__c, Date_Reported__c, Vehicle__c FROM Case WHERE status = 'Closed']; MaintenanceRequestHelper.updateWorkOrders(ClosedCaseList); } Test.stopTest(); } }
- Thiago Barbosa 1
- March 09, 2018
- Like
- 0
'MaintenanceRequest' trigger does not appear to be handling bulk operations correctly. For the positive use case of inserting and updating more than 200 records, it did not produce the expected outcome.
@isTest public class MaintenanceRequestTest { @isTest static void testSetup(){ List<Product2> equip = new List<Product2>(); equip.add(new Product2(Name ='Test Equipament', Maintenance_Cycle__c = 10, Cost__c = 100, Current_Inventory__c = 10, Lifespan_Months__c = 10, Replacement_Part__c = true, Warehouse_SKU__c = 'abc')); insert equip; System.debug( 'Equip' + equip); Database.insert(equip, false); } @isTest static void testMaintenanceRequest(){ MaintenanceRequestTest.testSetup(); List<Case> listInsert = new List<Case>(); List<Case> listUpdate = new List<Case>(); Id equipId = [SELECT Id FROM Product2 LIMIT 1].Id; System.debug('Product2' + equipId); for(Integer i = 0 ; i < 300; i++){ Case caseInsert = new Case(Type='Routine Maintenance', Status = 'New', Origin = 'Phone'); caseInsert.Equipment__c = equipId; listInsert.add(caseInsert); } Database.insert(listInsert, false); Test.startTest(); System.assertEquals(300, listInsert.size()); for(Case c: listInsert){ c.Status = 'Closed'; listUpdate.add(c); } Database.update (listUpdate, false); System.assertEquals(300, listUpdate.size()); User usuario = [SELECT id FROM User WHERE Id =: UserInfo.getUserId()]; System.runAs(usuario){ List<Case> ClosedCaseList = [SELECT Type, Status, Equipment__c, Date_Due__c, Date_Reported__c, Vehicle__c FROM Case WHERE status = 'Closed']; MaintenanceRequestHelper.updateWorkOrders(ClosedCaseList); } Test.stopTest(); } }
- Thiago Barbosa 1
- March 08, 2018
- Like
- 0
How to cover 100% class AuxilioInstalacaoGestor1Ctrl ?
//I want to cover to method consultarEquipeDireta in the return and consultarEquipeIndireta on the equipeIndireta SOQL.
public with sharing class AuxilioInstalacaoGestor1Ctrl { public AuxilioInstalacaoGestor1Ctrl() { } @AuraEnabled public static List<User> consultarEquipeDireta() { List<User> equipeDireta = AuxilioUtil.getInstance().buscarEquipePorIdGestor(UserInfo.getUserId()); if (equipeDireta.isEmpty()) { throw new AuraHandledException('O sistema não encontrou os seus subordinados. Por favor, entre em contato com o Administrador do Sistema'); } return equipeDireta; } @AuraEnabled public static List<User> consultarEquipeIndireta() { //Lista que será retornada List<User> equipeIndireta = new List<User>(); //Lista dos colaboradores imediatamente abaixo do gestor List<User> equipeDireta = [ SELECT Id, Name, FuncionalColaborador__c, Title, Department, ManagerId FROM User WHERE ManagerId = :UserInfo.getUserId() ]; if (equipeDireta.size() > 0) { //Lista dos colaboradores abaixo da equipeDireta do gestor equipeIndireta = [ SELECT Id, Name, FuncionalColaborador__c, Title, Department FROM User WHERE ManagerId IN:equipeDireta OR Manager.ManagerId IN:equipeDireta OR Manager.Manager.ManagerId IN:equipeDireta OR Manager.Manager.Manager.ManagerId IN:equipeDireta ]; } return equipeIndireta; } } ================================================================ @isTest public class AuxilioInstalacaoGestor1CtrlTest { @isTest static void AuxilioInstalacaoGestor1Ctrl(){ new AuxilioInstalacaoGestor1Ctrl(); } @isTest static void consultarEquipeDireta(){ List<User> equipeDireta = new List<User>(); insert equipeDireta; Test.startTest(); try{ AuxilioInstalacaoGestor1Ctrl.consultarEquipeDireta(); }catch(AuraHandledException e){ System.assert(true); System.debug(equipeDireta.isEmpty()); } Test.stopTest(); } @isTest static void consultaEquipeIndireta(){ List<User> equipeIndireta = [SELECT Id, Name, FuncionalColaborador__c, Title, Department FROM User WHERE ManagerId =: UserInfo.getUserId()]; insert equipeIndireta; Test.startTest(); AuxilioInstalacaoGestor1Ctrl.consultarEquipeIndireta(); Test.stopTest(); } }
- Thiago Barbosa 1
- December 20, 2017
- Like
- 0
Increase code coverage in Apex Class Extension
Hello, I have written an Apex Class Extension to override standard create contact for my visualforce page, and it works fine in the Sandbox environment. I am having trouble deploying the class in my production environment - class code coverage is only at 63%. I am not sure how to write a test to see where there is a code issue. Here is my code:
public class ContactSaveExtension {
ApexPages.StandardController controller;
public ContactSaveExtension(ApexPages.StandardController controller) {
this.controller = controller;
}
public PageReference saveAndRedirect() {
controller.save();
PageReference redirect = new PageReference('/apex/Thank_You');
redirect.setRedirect(true);
return redirect;
}
}
Thank you for your help!
Stephanie
public class ContactSaveExtension {
ApexPages.StandardController controller;
public ContactSaveExtension(ApexPages.StandardController controller) {
this.controller = controller;
}
public PageReference saveAndRedirect() {
controller.save();
PageReference redirect = new PageReference('/apex/Thank_You');
redirect.setRedirect(true);
return redirect;
}
}
Thank you for your help!
Stephanie
- Stephanie Stoddard
- December 13, 2017
- Like
- 0
Apex Classes Deployment
Hi,
I am having 'AccountMergeController' apex class in develoer sandbox and have deployed to Fullcopy sandbox. And in developer sandox i have added some logic to the controller and deployed again to fullcopy.
In this deployement will the controller in fullcopy get override with the controller in Developer sandbox? or another calss will create?
Thanks,
Balaji A
I am having 'AccountMergeController' apex class in develoer sandbox and have deployed to Fullcopy sandbox. And in developer sandox i have added some logic to the controller and deployed again to fullcopy.
In this deployement will the controller in fullcopy get override with the controller in Developer sandbox? or another calss will create?
Thanks,
Balaji A
- balaji aluri 16
- November 23, 2017
- Like
- 1