- Angello Camacho Drago
- NEWBIE
- 10 Points
- Member since 2017
- Salesforce Developer
- SOS Children's Village International
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
13Questions
-
14Replies
jQuery Control doesn't work in visualforce page
I have an issue, I tried to use a [jQuery Time Range Slider][1] inside a visualforce page but doesn't work, I tried different jquery versions, can any one help me?
this is my code:
this is my code:
<apex:page controller="SeekerController" sidebar="false" title="Posiciones Fuerza de Ventas" docType="html-5.0"> <script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyAtxPCGB4rExpez5r0kzHibcs94FsPpj9U"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script> <style type="text/css" media="print"> #time-range p { font-family:"Arial", sans-serif; font-size:14px; color:#333; } .ui-slider-horizontal { height: 8px; background: #D7D7D7; border: 1px solid #BABABA; box-shadow: 0 1px 0 #FFF, 0 1px 0 #CFCFCF inset; clear: both; margin: 8px 0; -webkit-border-radius: 6px; -moz-border-radius: 6px; -ms-border-radius: 6px; -o-border-radius: 6px; border-radius: 6px; } .ui-slider { position: relative; text-align: left; } .ui-slider-horizontal .ui-slider-range { top: -1px; height: 100%; } .ui-slider .ui-slider-range { position: absolute; z-index: 1; height: 8px; font-size: .7em; display: block; border: 1px solid #5BA8E1; box-shadow: 0 1px 0 #AAD6F6 inset; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px; background: #81B8F3; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(0%, #A0D4F5), color-stop(100%, #81B8F3)); background-image: -webkit-linear-gradient(top, #A0D4F5, #81B8F3); background-image: -moz-linear-gradient(top, #A0D4F5, #81B8F3); background-image: -o-linear-gradient(top, #A0D4F5, #81B8F3); background-image: linear-gradient(top, #A0D4F5, #81B8F3); } .ui-slider .ui-slider-handle { border-radius: 50%; background: #F9FBFA; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(0%, #C7CED6), color-stop(100%, #F9FBFA)); background-image: -webkit-linear-gradient(top, #C7CED6, #F9FBFA); background-image: -moz-linear-gradient(top, #C7CED6, #F9FBFA); background-image: -o-linear-gradient(top, #C7CED6, #F9FBFA); background-image: linear-gradient(top, #C7CED6, #F9FBFA); width: 22px; height: 22px; -webkit-box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset; -moz-box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset; box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset; -webkit-transition: box-shadow .3s; -moz-transition: box-shadow .3s; -o-transition: box-shadow .3s; transition: box-shadow .3s; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 22px; height: 22px; cursor: default; border: none; cursor: pointer; } .ui-slider .ui-slider-handle:after { content:""; position: absolute; width: 8px; height: 8px; border-radius: 50%; top: 50%; margin-top: -4px; left: 50%; margin-left: -4px; background: #30A2D2; -webkit-box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 #FFF; -moz-box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 white; box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 #FFF; } .ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.6em; } .ui-slider a:focus { outline:none; } #slider-range { width: 90%; margin: 0 auto; } #time-range { width: 400px; } </style> <script> $j = jQuery.noConflict(); //this function will be called as soon as page load is complete $j("#slider-range").slider({ range: true, min: 0, max: 1440, step: 15, values: [540, 1020], slide: function (e, ui) { var hours1 = Math.floor(ui.values[0] / 60); var minutes1 = ui.values[0] - (hours1 * 60); if (hours1.length == 1) hours1 = '0' + hours1; if (minutes1.length == 1) minutes1 = '0' + minutes1; if (minutes1 == 0) minutes1 = '00'; if (hours1 >= 12) { if (hours1 == 12) { hours1 = hours1; minutes1 = minutes1 + " PM"; } else { hours1 = hours1 - 12; minutes1 = minutes1 + " PM"; } } else { hours1 = hours1; minutes1 = minutes1 + " AM"; } if (hours1 == 0) { hours1 = 12; minutes1 = minutes1; } $j('.slider-time').html(hours1 + ':' + minutes1); var hours2 = Math.floor(ui.values[1] / 60); var minutes2 = ui.values[1] - (hours2 * 60); if (hours2.length == 1) hours2 = '0' + hours2; if (minutes2.length == 1) minutes2 = '0' + minutes2; if (minutes2 == 0) minutes2 = '00'; if (hours2 >= 12) { if (hours2 == 12) { hours2 = hours2; minutes2 = minutes2 + " PM"; } else if (hours2 == 24) { hours2 = 11; minutes2 = "59 PM"; } else { hours2 = hours2 - 12; minutes2 = minutes2 + " PM"; } } else { hours2 = hours2; minutes2 = minutes2 + " AM"; } $j('.slider-time2').html(hours2 + ':' + minutes2); } }); </script> <div id="time-range"> <p>Time Range: <span class="slider-time">9:00 AM</span> - <span class="slider-time2">5:00 PM</span> </p> <div class="sliders_step1"> <div id="slider-range"></div> </div> </div> </apex:page>
- Angello Camacho Drago
- March 11, 2018
- Like
- 0
- Continue reading or reply
Integration with Azure stopped working
Hello, I have a problem, I have an integration with Azure to upload the salesforce data into a SQL Server in Azure through a web service in Azure, but since today the integration stopped working, I only get status 504, but if I send a request from another system or the browser works fine, can any one help me please?
- Angello Camacho Drago
- March 10, 2018
- Like
- 0
- Continue reading or reply
Geolocation has been disabled in this document by feature policy Salesforce1
I have a Visualforce page enabled for Lightning, which has one button that gets the geolocation in coordinates and shows the location in a Google map embedded in the page.
This was working until last Friday, but now I get this error:
Geolocation has been disabled in this document by feature policy
When I call the method navigator.geolocation.getCurrentPosition in the browser, it worked fine. I also checked the permissions in the mobile.
Is this feature no longer supported? If not, is there any workaround?
This was working until last Friday, but now I get this error:
Geolocation has been disabled in this document by feature policy
When I call the method navigator.geolocation.getCurrentPosition in the browser, it worked fine. I also checked the permissions in the mobile.
Is this feature no longer supported? If not, is there any workaround?
- Angello Camacho Drago
- February 07, 2018
- Like
- 0
- Continue reading or reply
Map get blank value when I call get method
Hi every one, I have a trigger that when I insert data into a custom object create a map with the id of a contact as a key and a list of the custom object as the value, when I check if the key is contained in the map I get true, but when I try to get the value I get (), but when I filled the map I check if the list has items with an if list.size()>0, this is my code:
Map<Id, List<npe03__Recurring_Donation__c>> rdsMap = new Map<Id, List<npe03__Recurring_Donation__c>>(); for(Id id : Ids){ List<npe03__Recurring_Donation__c> rdOld = new List<npe03__Recurring_Donation__c>(); for(npe03__Recurring_Donation__c rd : rds){ if(rd.npe03__Organization__c != null){ if(id == rd.npe03__Organization__c){ rdOld.add(rd); } } else if(rd.npe03__Contact__c != null){ if(id == rd.npe03__Contact__c){ rdOld.add(rd); } } } if(rdOld.size()>0){ rdsMap.put(id, rdOld); } } for(npe03__Recurring_Donation__c rdNew : trigger.new){ else if(rdNew.npe03__Contact__c != null){ if(rdsMap.containsKey(rdNew.npe03__Contact__c)){ List<npe03__Recurring_Donation__c> rdsSort = new List<npe03__Recurring_Donation__c>(); List<npe03__Recurring_Donation__c> rdsOld = rdsMap.get(rdNew.npe03__Contact__c);//here I get an empty list integer targetsize = rdsOld.size(); while(rdsSort.size() != targetsize){ datetime dt = Datetime.newInstance(1900, 1, 1, 00, 00, 00); integer i = 0; integer mini = 0; for(i = 0; i != rdsOld.size(); i ++){ if(rdsOld[i].CreatedDate > dt){ dt = rdsOld[i].CreatedDate; mini = i; } } rdsSort.add(rdsOld[mini]); rdsOld.remove(mini); } if(rdsSort[0].npe03__Amount__c < rdNew.npe03__Amount__c){ } else{ rdNew.addError('No puede crear un Compromiso de Donación con el Tipo de Compormiso "Nuevo por Aumento", porque el monto ingresado es menor o igual que el monto del Compromiso de Donación Anterior'); } } } } }
- Angello Camacho Drago
- September 01, 2017
- Like
- 0
- Continue reading or reply
add section on quote template when pdf is creating
I need to add a section to the quote template programatlicaly, but I don't know how to make this, any one can help me please?
- Angello Camacho Drago
- April 13, 2017
- Like
- 0
- Continue reading or reply
session expiration API call after 2 hours
down votefavoriteI was reading about the session expiration in this link and I want to know if I can set the session time out to 24 hours for API calls
- Angello Camacho Drago
- March 08, 2017
- Like
- 0
- Continue reading or reply
commandButton does not rerender
I have a visualforce page that call a method that return a String with the URL to download a contentdocument (chatter document), but when I make click the button doesn't rerender anything, this is my vfp:
<apex:page standardController="npe03__Recurring_Donation__c" extensions="ReporteCompromisosExportacionController" action="{!getFile}" tabStyle="Reporte_Compromisos__tab"> <apex:form id="form"> <apex:pageMessages id="errors"/> <apex:pageBlock id="page"> <apex:pageBlockSection columns="1" title="Descargar Archivo de Cobranza" collapsible="false" id="descargar"> <apex:pageBlockSectionItem > <apex:image url="{!$Resource.excelIcon}" width="30" height="30" rendered="{!download}"/> <apex:outputText id="name" value="{!fileName}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom" id="buttons"> <apex:CommandButton id="download" value="Descargar Archivo" action="{!downloadFile}" rerender="form,errors,page,buttons,download" disabled="{!!download}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
- Angello Camacho Drago
- January 20, 2017
- Like
- 0
- Continue reading or reply
apex:commandButton redirect with rerender tag
I have a commandButton that call two actionfunctions the two actionfunctions call to methods that return a String, but one of the methods some time return null, and when the method return null the visualforce page is reloaded , I try putting a rerender attribute but is not working the visualforce page reload everything when the method return null, the button is "Exportar" this is my code:
<apex:page standardController="npe03__Recurring_Donation__c" extensions="ReporteCompromisosExportacionController" tabStyle="Reporte_Compromisos__tab">
<script type="text/javascript">
function loading(val) {
//document.getElementById('{!$Component.theForm1.theBlock.theSection.theSectionItemTipo.typeCard}').value;
if (val) {
document.getElementById('contentLoading').style.display = 'block';
document.getElementById('contentLoaded').style.display = 'none';
} else {
document.getElementById('contentLoading').style.display = 'none';
document.getElementById('contentLoaded').style.display = 'block';
}
}
</script>
<apex:form id="theForm1">
<apex:pageBlock title="Reporte Donaciones Recurrentes" id="theBlock">
<apex:pageMessages id="errors" />
<apex:actionFunction name="showbn" action="{!chooseCardType}" reRender="theSection,theSectionItemBanco,theSectionItemBlank" status="loading">
<apex:param name="mediodePago" value="" />
</apex:actionFunction>
<apex:actionFunction name="showpn" action="{!showPreNotificacion}" reRender="theSection,theSectionItemBlank" status="loading">
<apex:param name="nombreBanco" value="" />
</apex:actionFunction>
<apex:actionFunction name="generate" action="{!generateURL}" reRender="{!If(cards=='Visa','errors,buttons','')}" status="{!If(cards=='Visa','loading','')}"/>
<apex:actionFunction name="disable" action="{!runUpdate}" reRender="errors,buttons" status="loading"/>
<apex:actionFunction name="redirectPre" action="{!redirectPreURL}"/>
<apex:actionFunction name="enable" action="{!enableExport}" reRender="buttons" status="loading"/>
<apex:actionStatus id="loading" onstart="loading(true)" onstop="loading(false)" />
<apex:pageblockSection id="theSection" title="Filtros de búsqueda">
<apex:pageBlockSectionItem id="theSectionItemMedio" rendered="{!showFinancia}">
<apex:outputLabel value="Medio de Pago" for="medioCard" />
<apex:inputField value="{!Donation.Medio_de_Pago__c}" id="medioCard" onchange="showbn(this.value);"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemTipo" rendered="{!showFinancia}">
<apex:outputLabel value="Tipo de Tarjeta" for="typeCard" />
<apex:selectList id="typeCard" multiselect="false" size="1" value="{!card}" disabled="{!!cardt}">
<apex:selectOptions value="{!cards}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemBanco" rendered="{!bank}">
<apex:outputLabel value="Entidad de Cobro" for="entidadCobro" />
<apex:selectList id="cobrador" multiselect="false" size="1" value="{!cobra}" onchange="showpn(this.value);">
<apex:selectOptions value="{!cobradores}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemBlank" rendered="{!bank}">
<apex:outputLabel value="Pre Notificación" for="preNotificacion" rendered="{!preNotificacion}"/>
<apex:inputField value="{!Donation.Pre_Notificado__c}" id="preNotificado" rendered="{!preNotificacion}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemDesde">
<apex:outputLabel value="Fecha Desde" for="fromDate" />
<apex:inputField value="{!Donation.npe03__Date_Established__c}" id="fromDate" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemHasta">
<apex:outputLabel value="Fecha Hasta" for="toDate" />
<apex:inputField value="{!DonationHasta.npe03__Date_Established__c}" id="toDate" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemSemana">
<apex:outputLabel value="Semana de Cobro" for="weekPay" />
<apex:selectList id="weekPay" multiselect="true" size="5" value="{!semana}" style="width:50px;">
<apex:selectOptions value="{!semanas}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemEstado">
<apex:outputLabel value="Estado" for="status" />
<!-- <apex:inputField value="{!npe03__Recurring_Donation__c.npe03__Open_Ended_Status__c}" id="status"/> -->
<apex:selectList id="status" multiselect="true" size="3" value="{!estado}">
<apex:selectOptions value="{!estados}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<!-- <apex:pageBlockSectionItem id="theSectionItemInStop" >
<apex:outputLabel value="En pausa" for="inStop"/>
<apex:inputField value="{!npe03__Recurring_Donation__c.En_Pausa__c}" id="inStop"/>
</apex:pageBlockSectionItem> -->
</apex:pageblockSection>
<div id="contentLoaded">
<apex:pageblockSection id="buttons">
<apex:pageBlockSectionItem >
<apex:commandButton value="Buscar" action="{!runSearch}" reRender="grilla,debug,errors,buttons" status="loading"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton value="Pre Visualizar" onclick="redirectPre();" oncomplete="enable();" disabled="{!!exportedPre}" />
<apex:commandButton value="Exportar" onclick="generate();" oncomplete="disable();" disabled="{!!exported}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</div>
<div id="contentLoading" style="display: none;">
<div style="text-align: center;">
<img src="/img/loading.gif" alt="Procesando..." />
</div>
</div>
<br/>
<apex:pageblockSection id="grilla" columns="1">
<apex:pageBlockTable value="{!resultado}" var="c">
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Id Donación" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Id" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Id}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="PSN" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="PSN__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.PSN__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Nombre Cuenta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="AccountId" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Nombre_Cuenta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Nombre" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Nombre__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Nombre__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Apellido" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Apellidos__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Apellidos__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="DNI" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="N_mero_de_Documento__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.N_mero_de_Documento__c}" rendered="{!c.N_mero_de_Documento__c!=null}"/>
<apex:outputField value="{!c.Account.N_Fiscal__c}" rendered="{!c.N_mero_de_Documento__c==null}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Monto" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Amount" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Amount}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Tipo Tarjeta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Tipo_de_Tarjeta__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Tipo_de_Tarjeta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Número Tarjeta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Numero_de_Tarjeta__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Numero_de_Tarjeta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Fecha Vencimiento" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Fecha_de_Vencimiento__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Fecha_de_Vencimiento__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Número Cuenta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Numero_de_Tarjeta__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Numero_de_Cuenta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Frecuencia" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Frecuencia__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Frecuencia__c}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageblockSection>
<apex:pageMessages />
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:page standardController="npe03__Recurring_Donation__c" extensions="ReporteCompromisosExportacionController" tabStyle="Reporte_Compromisos__tab">
<script type="text/javascript">
function loading(val) {
//document.getElementById('{!$Component.theForm1.theBlock.theSection.theSectionItemTipo.typeCard}').value;
if (val) {
document.getElementById('contentLoading').style.display = 'block';
document.getElementById('contentLoaded').style.display = 'none';
} else {
document.getElementById('contentLoading').style.display = 'none';
document.getElementById('contentLoaded').style.display = 'block';
}
}
</script>
<apex:form id="theForm1">
<apex:pageBlock title="Reporte Donaciones Recurrentes" id="theBlock">
<apex:pageMessages id="errors" />
<apex:actionFunction name="showbn" action="{!chooseCardType}" reRender="theSection,theSectionItemBanco,theSectionItemBlank" status="loading">
<apex:param name="mediodePago" value="" />
</apex:actionFunction>
<apex:actionFunction name="showpn" action="{!showPreNotificacion}" reRender="theSection,theSectionItemBlank" status="loading">
<apex:param name="nombreBanco" value="" />
</apex:actionFunction>
<apex:actionFunction name="generate" action="{!generateURL}" reRender="{!If(cards=='Visa','errors,buttons','')}" status="{!If(cards=='Visa','loading','')}"/>
<apex:actionFunction name="disable" action="{!runUpdate}" reRender="errors,buttons" status="loading"/>
<apex:actionFunction name="redirectPre" action="{!redirectPreURL}"/>
<apex:actionFunction name="enable" action="{!enableExport}" reRender="buttons" status="loading"/>
<apex:actionStatus id="loading" onstart="loading(true)" onstop="loading(false)" />
<apex:pageblockSection id="theSection" title="Filtros de búsqueda">
<apex:pageBlockSectionItem id="theSectionItemMedio" rendered="{!showFinancia}">
<apex:outputLabel value="Medio de Pago" for="medioCard" />
<apex:inputField value="{!Donation.Medio_de_Pago__c}" id="medioCard" onchange="showbn(this.value);"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemTipo" rendered="{!showFinancia}">
<apex:outputLabel value="Tipo de Tarjeta" for="typeCard" />
<apex:selectList id="typeCard" multiselect="false" size="1" value="{!card}" disabled="{!!cardt}">
<apex:selectOptions value="{!cards}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemBanco" rendered="{!bank}">
<apex:outputLabel value="Entidad de Cobro" for="entidadCobro" />
<apex:selectList id="cobrador" multiselect="false" size="1" value="{!cobra}" onchange="showpn(this.value);">
<apex:selectOptions value="{!cobradores}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemBlank" rendered="{!bank}">
<apex:outputLabel value="Pre Notificación" for="preNotificacion" rendered="{!preNotificacion}"/>
<apex:inputField value="{!Donation.Pre_Notificado__c}" id="preNotificado" rendered="{!preNotificacion}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemDesde">
<apex:outputLabel value="Fecha Desde" for="fromDate" />
<apex:inputField value="{!Donation.npe03__Date_Established__c}" id="fromDate" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemHasta">
<apex:outputLabel value="Fecha Hasta" for="toDate" />
<apex:inputField value="{!DonationHasta.npe03__Date_Established__c}" id="toDate" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemSemana">
<apex:outputLabel value="Semana de Cobro" for="weekPay" />
<apex:selectList id="weekPay" multiselect="true" size="5" value="{!semana}" style="width:50px;">
<apex:selectOptions value="{!semanas}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="theSectionItemEstado">
<apex:outputLabel value="Estado" for="status" />
<!-- <apex:inputField value="{!npe03__Recurring_Donation__c.npe03__Open_Ended_Status__c}" id="status"/> -->
<apex:selectList id="status" multiselect="true" size="3" value="{!estado}">
<apex:selectOptions value="{!estados}" />
</apex:selectList>
</apex:pageBlockSectionItem>
<!-- <apex:pageBlockSectionItem id="theSectionItemInStop" >
<apex:outputLabel value="En pausa" for="inStop"/>
<apex:inputField value="{!npe03__Recurring_Donation__c.En_Pausa__c}" id="inStop"/>
</apex:pageBlockSectionItem> -->
</apex:pageblockSection>
<div id="contentLoaded">
<apex:pageblockSection id="buttons">
<apex:pageBlockSectionItem >
<apex:commandButton value="Buscar" action="{!runSearch}" reRender="grilla,debug,errors,buttons" status="loading"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton value="Pre Visualizar" onclick="redirectPre();" oncomplete="enable();" disabled="{!!exportedPre}" />
<apex:commandButton value="Exportar" onclick="generate();" oncomplete="disable();" disabled="{!!exported}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</div>
<div id="contentLoading" style="display: none;">
<div style="text-align: center;">
<img src="/img/loading.gif" alt="Procesando..." />
</div>
</div>
<br/>
<apex:pageblockSection id="grilla" columns="1">
<apex:pageBlockTable value="{!resultado}" var="c">
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Id Donación" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Id" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Id}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="PSN" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="PSN__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.PSN__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Nombre Cuenta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="AccountId" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Nombre_Cuenta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Nombre" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Nombre__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Nombre__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Apellido" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Apellidos__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Apellidos__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="DNI" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="N_mero_de_Documento__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.N_mero_de_Documento__c}" rendered="{!c.N_mero_de_Documento__c!=null}"/>
<apex:outputField value="{!c.Account.N_Fiscal__c}" rendered="{!c.N_mero_de_Documento__c==null}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Monto" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Amount" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Amount}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Tipo Tarjeta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Tipo_de_Tarjeta__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Tipo_de_Tarjeta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Número Tarjeta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Numero_de_Tarjeta__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Numero_de_Tarjeta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Fecha Vencimiento" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Fecha_de_Vencimiento__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Fecha_de_Vencimiento__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Número Cuenta" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Numero_de_Tarjeta__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Numero_de_Cuenta__c}" />
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Frecuencia" action="{!toggleSort}" rerender="grilla,debug">
<apex:param name="sortField" value="Frecuencia__c" assignTo="{!sortField}" />
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!c.Frecuencia__c}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageblockSection>
<apex:pageMessages />
</apex:pageBlock>
</apex:form>
</apex:page>
- Angello Camacho Drago
- January 19, 2017
- Like
- 0
- Continue reading or reply
batch class doesn't execute all the batches
I want to send salesforce data to another system, but when I send the data through a batch class when I call the web service in the execute method doesn't execute all the batches, but if in the execute method don't make the callout all the batches execute, I put two counters in the execute method and I am showing in the finish method one for the number of records in the list and the other for the times the execute method is running, and when I execute the batch without make the callouts run all the batches but when execute the batch calling the web service in the execute method don't run all the batches, this is my code:
global class SendFirstDonorData implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful{
public Integer i = 0;
public Integer j = 0;
public Integer action;
global SendFirstDonorData(Integer act){
action = act;
}
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator('Select npsp__is_Address_Override__c, npsp__Soft_Credit_Last_N_Days__c, npsp__Primary_Contact__c, npsp__Primary_Affiliation__c, npsp__Number_of_Soft_Credits__c, npsp__Number_of_Soft_Credits_Two_Years_Ago__c, npsp__Number_of_Soft_Credits_This_Year__c, npsp__Number_of_Soft_Credits_Last_Year__c, npsp__Number_of_Soft_Credits_Last_N_Days__c, npsp__Last_Soft_Credit_Date__c, npsp__Last_Soft_Credit_Amount__c, npsp__Largest_Soft_Credit_Date__c, npsp__Largest_Soft_Credit_Amount__c, npsp__HHId__c, npsp__First_Soft_Credit_Date__c, npsp__First_Soft_Credit_Amount__c, npsp__Exclude_from_Household_Name__c, npsp__Exclude_from_Household_Informal_Greeting__c, npsp__Exclude_from_Household_Formal_Greeting__c, npsp__Do_Not_Contact__c, npsp__Deceased__c, npsp__Current_Address__c, npsp__Batch__c, npsp__Address_Verification_Status__c,'+
'npo02__Total_Household_Gifts__c, npo02__TotalOppAmount__c, npo02__TotalMembershipOppAmount__c, npo02__SystemHouseholdProcessor__c, npo02__Soft_Credit_Two_Years_Ago__c, npo02__Soft_Credit_Total__c, npo02__Soft_Credit_This_Year__c, npo02__Soft_Credit_Last_Year__c, npo02__SmallestAmount__c, npo02__OppsClosedThisYear__c, npo02__OppsClosedLastYear__c, npo02__OppsClosedLastNDays__c, npo02__OppsClosed2YearsAgo__c, npo02__OppAmountThisYear__c, npo02__OppAmountThisYearHH__c, npo02__OppAmountLastYear__c, npo02__OppAmountLastYearHH__c, npo02__OppAmountLastNDays__c, npo02__OppAmount2YearsAgo__c, npo02__NumberOfMembershipOpps__c, npo02__NumberOfClosedOpps__c, npo02__Naming_Exclusions__c, npo02__MembershipJoinDate__c, npo02__MembershipEndDate__c, npo02__LastOppAmount__c, npo02__LastMembershipOrigin__c, npo02__LastMembershipLevel__c, '+
'npo02__LastMembershipDate__c, npo02__LastMembershipAmount__c, npo02__LastCloseDate__c, npo02__LastCloseDateHH__c, npo02__LargestAmount__c, npo02__Household__c, npo02__Household_Naming_Order__c, npo02__Formula_HouseholdPhone__c, npo02__Formula_HouseholdMailingAddress__c, npo02__FirstCloseDate__c, npo02__Best_Gift_Year__c, npo02__Best_Gift_Year_Total__c, npo02__AverageAmount__c, npe01__Work_Address__c, npe01__WorkPhone__c, npe01__WorkEmail__c, npe01__Type_of_Account__c, npe01__SystemAccountProcessor__c, npe01__Secondary_Address_Type__c, npe01__Private__c, npe01__Primary_Address_Type__c, npe01__Preferred_Email__c, npe01__PreferredPhone__c, npe01__Other_Address__c, npe01__Organization_Type__c, npe01__Home_Address__c, npe01__HomeEmail__c, '+
'npe01__AlternateEmail__c, Total_Donado_Hist_rico__c, Total_Donado_2014__c, Total_Donado_2013__c, Total_Donado_2012__c, Total_Donado_2011__c, Total_Donado_2010__c, Total_Donado_2009__c, Total_Donado_2008__c, Total_Donado_2007__c, Total_Donado_2006__c, Total_Donado_2005__c, Total_Donado_2004__c, Total_Donado_2003__c, Total_Donado_2002__c, Total_Donado_2001__c, Title, Tipo_de_registro_CANDIDATO__c, Tiene_nietos__c, Tiene_hijos__c, SystemModstamp, Salutation, ReportsToId, Referente__c, RecordTypeId, PhotoUrl, Phone, Pa_s_Aldeas__c, PSN__c, PSN_Historico__c, PSN_Buscar_Contacto__c, OwnerId, OtherStreet, OtherStateCode, OtherState, OtherPostalCode, OtherPhone, OtherLongitude, OtherLatitude, OtherCountryCode, OtherCountry, OtherCity, OtherAddress, Ocupaci_n__c, No_Recibir_Correo_F_sico__c, Ni_Apadrinado__c, Name, N_mero_de_Documento__c,'+
'MobilePhone, Media_2014__c, Media_2013__c, Media_2012__c, Media_2011__c, Media_2010__c, Media_2009__c, Media_2008__c, Media_2007__c, Media_2006__c, Media_2005__c, Media_2004__c, Media_2003__c, Media_2002__c, Media_2001__c, MasterRecordId, MailingStreet, MailingStateCode, MailingState, MailingPostalCode, MailingLongitude, MailingLatitude, MailingCountryCode, MailingCountry, MailingCity, MailingAddress, M_xima_2014__c, M_xima_2013__c, M_xima_2012__c, M_xima_2011__c, M_xima_2010__c, M_xima_2009__c, M_xima_2008__c, M_xima_2007__c, M_xima_2006__c, M_xima_2005__c, M_xima_2004__c, M_xima_2003__c, M_xima_2002__c, M_xima_2001__c, LeadSource, LastViewedDate, LastReferencedDate, LastName, LastModifiedDate, LastModifiedById, LastCUUpdateDate, LastCURequestDate, LastActivityDate, JigsawContactId, Jigsaw, IsEmailBounced, IsDeleted, Id, '+
'ID_Externo_Hist_rico__c, HomePhone, Hobbie__c, HasOptedOutOfFax, HasOptedOutOfEmail, Gender__c, FirstName, Fecha_nacimiento_CANDIDATO__c, Fecha_de_ltima_donaci_n_hist_rica__c, Fecha_de_Pr_ximo_Cumplea_os__c, Fecha_de_Captaci_n__c, Fecha_de_Captaci_n_Migraci_n__c, Fecha_de_Activaci_n_Unificada__c, Fecha_de_Activaci_n_Hist_rica__c, Fax, Estado_Civil__c, EmailBouncedReason, EmailBouncedDate, Email, Edad__c, Duplicado__c, DoNotCall, Destino_de_la_Donaci_n__c, Description, Department, Cuotas_pagadas_2009__c, Cuotas_Pagadas_2014__c, Cuotas_Pagadas_2013__c, Cuotas_Pagadas_2012__c, Cuotas_Pagadas_2011__c, Cuotas_Pagadas_2010__c, Cuotas_Pagadas_2008__c, Cuotas_Pagadas_2007__c, Cuotas_Pagadas_2006__c, Cuotas_Pagadas_2005__c, Cuotas_Pagadas_2004__c, Cuotas_Pagadas_2003__c, Cuotas_Pagadas_2002__c, Cuotas_Pagadas_2001__c, Cuotas_No_Pagadas_2014__c,'+
'Cuotas_No_Pagadas_2013__c, Cuotas_No_Pagadas_2012__c, Cuotas_No_Pagadas_2011__c, Cuotas_No_Pagadas_2010__c, Cuotas_No_Pagadas_2009__c, Cuotas_No_Pagadas_2008__c, Cuotas_No_Pagadas_2007__c, Cuotas_No_Pagadas_2006__c, Cuotas_No_Pagadas_2005__c, Cuotas_No_Pagadas_2004__c, Cuotas_No_Pagadas_2003__c, Cuotas_No_Pagadas_2002__c, Cuotas_No_Pagadas_2001__c, CreatedDate, CreatedById, Cantidad_de_donaciones_No_Pagadas__c, Cantidad_de_Hijos__c, Cantidad_cuotas_No_Pagadas_Hist_ricas__c, Cantidad_Cuotas_Pagadas_Hist_ricas__c, CallCenter_en_Contacto__c, CallCenter_Usuario_Contacto__c, CallCenter_Date_Contacto__c, Birthdate, AssistantPhone, AssistantName, AccountId FROM Contact');
}
global void execute(Database.BatchableContext BC, List<Contact> scope){
i += scope.size();
j ++;
system.debug('#### ' + j);
system.debug('#### ' + scope.size());
Map<Id,User> userMap = new Map<Id,User>((List<User>)[SELECT Id, Name FROM User WHERE IsActive = true]);
Map<Id,RecordType> rtMap = new Map<Id,RecordType>((List<RecordType>)[SELECT Id, Name FROM RecordType WHERE SobjectType = 'Contact']);
JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartArray();
for(Contact c : scope){
gen.writeStartObject();
gen.writeStringField('Id', c.Id);
if(action==2){
if(c.AccountId!=null){
gen.writeStringField('Account', c.AccountId);
}
}
if(c.AssistantName!=null && c.AssistantName!=''){
gen.writeStringField('AssistantName', c.AssistantName);
}
if(c.AssistantPhone!=null && c.AssistantPhone!=''){
gen.writeStringField('AssistantPhone', c.AssistantPhone);
}
if(c.Birthdate!=null){
gen.writeDateField('Birthdate', c.Birthdate);
}
if(c.OwnerId!=null){
gen.writeStringField('Owner', userMap.get(c.OwnerId).Name);
}
if(c.RecordTypeId!=null){
gen.writeStringField('RecordType', rtMap.get(c.RecordTypeId).Name);
}
if(c.Jigsaw!=null && c.Jigsaw!=''){
gen.writeStringField('Jigsaw', c.Jigsaw);
}
if(c.Department!=null && c.Department!=''){
gen.writeStringField('Department', c.Department);
}
if(c.Description!=null && c.Description!=''){
gen.writeStringField('Description', c.Description);
}
if(c.DoNotCall!=null){
gen.writeStringField('DoNotCall', String.valueOf(c.DoNotCall));
}
if(c.Email!=null && c.Email!=''){
gen.writeStringField('Email', c.Email);
}
if(c.HasOptedOutOfEmail!=null){
gen.writeStringField('HasOptedOutOfEmail', String.valueOf(c.HasOptedOutOfEmail));
}
if(c.Fax!=null && c.Fax!=''){
gen.writeStringField('Fax', c.Fax);
}
if(c.HasOptedOutOfFax!=null){
gen.writeStringField('HasOptedOutOfFax', String.valueOf(c.HasOptedOutOfFax));
}
if(c.HomePhone!=null && c.HomePhone!=''){
gen.writeStringField('HomePhone', c.HomePhone);
}
if(c.LastCURequestDate!=null){
gen.writeDateTimeField('LastCURequestDate', c.LastCURequestDate);
}
if(c.LastCUUpdateDate!=null){
gen.writeDateTimeField('LastCUUpdateDate', c.LastCUUpdateDate);
}
if(c.LeadSource!=null && c.LeadSource!=''){
gen.writeStringField('LeadSource', c.LeadSource);
}
if(c.MailingStreet!=null && c.MailingStreet!=''){
gen.writeStringField('MailingStreet', c.MailingStreet);
}
if(c.MailingCity!=null && c.MailingCity!=''){
gen.writeStringField('MailingCity', c.MailingCity);
}
if(c.MailingState!=null && c.MailingState!=''){
gen.writeStringField('MailingState', c.MailingState);
}
if(c.MailingPostalCode!=null && c.MailingPostalCode!=''){
gen.writeStringField('MailingPostalCode', c.MailingPostalCode);
}
if(c.MailingCountry!=null && c.MailingCountry!=''){
gen.writeStringField('MailingCountry', c.MailingCountry);
}
if(c.MobilePhone!=null && c.MobilePhone!=''){
gen.writeStringField('MobilePhone', c.MobilePhone);
}
if(c.Salutation!=null && c.Salutation!=''){
gen.writeStringField('Salutation', c.Salutation);
}
if(c.FirstName!=null && c.FirstName!=''){
gen.writeStringField('FirstName', c.FirstName);
}
if(c.LastName!=null && c.LastName!=''){
gen.writeStringField('LastName', c.LastName);
}
if(c.OtherStreet!=null && c.OtherStreet!=''){
gen.writeStringField('OtherStreet', c.OtherStreet);
}
if(c.OtherCity!=null && c.OtherCity!=''){
gen.writeStringField('OtherCity', c.OtherCity);
}
if(c.OtherState!=null && c.OtherState!=''){
gen.writeStringField('OtherState', c.OtherState);
}
if(c.OtherPostalCode!=null && c.OtherPostalCode!=''){
gen.writeStringField('OtherPostalCode', c.OtherPostalCode);
}
if(c.OtherCountry!=null && c.OtherCountry!=''){
gen.writeStringField('OtherCountry', c.OtherCountry);
}
if(c.OtherPhone!=null && c.OtherPhone!=''){
gen.writeStringField('OtherPhone', c.OtherPhone);
}
if(c.Phone!=null && c.Phone!=''){
gen.writeStringField('Phone', c.Phone);
}
if(c.Title!=null && c.Title!=''){
gen.writeStringField('Title', c.Title);
}
if(c.npe01__AlternateEmail__c!=null && c.npe01__AlternateEmail__c!=''){
gen.writeStringField('AlternateEmail', c.npe01__AlternateEmail__c);
}
if(c.CallCenter_Date_Contacto__c!=null){
gen.writeDateTimeField('CallCenterDateContacto', c.CallCenter_Date_Contacto__c);
}
if(c.CallCenter_en_Contacto__c!=null){
gen.writeStringField('CallCenterenContacto', String.valueOf(c.CallCenter_en_Contacto__c));
}
if(c.CallCenter_Usuario_Contacto__c!=null){
gen.writeStringField('CallCenterUsuarioContacto', userMap.get(c.CallCenter_Usuario_Contacto__c).Name);
}
if(c.Fecha_nacimiento_CANDIDATO__c!=null){
gen.writeDateField('FechaNacimiento', c.Fecha_nacimiento_CANDIDATO__c);
}
if(c.Cantidad_Cuotas_No_Pagadas_Hist_ricas__c!=null){
gen.writeNumberField('CantidadCuotasNoPagadasHistoricas', c.Cantidad_Cuotas_No_Pagadas_Hist_ricas__c);
}
if(c.Cantidad_Cuotas_Pagadas_Hist_ricas__c!=null){
gen.writeNumberField('CantidadCuotasPagadasHistoricas', c.Cantidad_Cuotas_Pagadas_Hist_ricas__c);
}
if(c.Cantidad_de_donaciones_No_Pagadas__c!=null){
gen.writeNumberField('CantidadDonacionesNoPagadas', c.Cantidad_de_donaciones_No_Pagadas__c);
}
if(c.Cantidad_de_Hijos__c!=null && c.Cantidad_de_Hijos__c!=''){
gen.writeStringField('CantidadHijos', c.Cantidad_de_Hijos__c);
}
if(c.Destino_de_la_Donaci_n__c!=null && c.Destino_de_la_Donaci_n__c!=''){
gen.writeStringField('DestinoDonacion', c.Destino_de_la_Donaci_n__c);
}
if(c.npsp__Do_Not_Contact__c!=null){
gen.writeStringField('DoNotContact', String.valueOf(c.npsp__Do_Not_Contact__c));
}
if(c.Duplicado__c!=null){
gen.writeStringField('Duplicado', String.valueOf(c.Duplicado__c));
}
if(c.Edad__c!=null){
gen.writeNumberField('Edad', c.Edad__c);
}
if(c.Estado_Civil__c!=null && c.Estado_Civil__c!=''){
gen.writeStringField('EstadoCivil', c.Estado_Civil__c);
}
if(c.Fecha_de_Activaci_n_Hist_rica__c!=null){
gen.writeDateField('FechaActivacionHistorica', c.Fecha_de_Activaci_n_Hist_rica__c);
}
if(c.Fecha_de_Activaci_n_Unificada__c!=null){
gen.writeDateField('FechaActivacionUnificada', c.Fecha_de_Activaci_n_Unificada__c);
}
if(c.Fecha_de_Captaci_n__c!=null){
gen.writeDateField('FechaCaptacion', c.Fecha_de_Captaci_n__c);
}
if(c.Fecha_de_Pr_ximo_Cumplea_os__c!=null){
gen.writeDateField('FechaProximoCumpleaños', c.Fecha_de_Pr_ximo_Cumplea_os__c);
}
if(c.Fecha_de_ltima_donaci_n_hist_rica__c!=null){
gen.writeDateField('FechaUltimaDonacionHistorica', c.Fecha_de_ltima_donaci_n_hist_rica__c);
}
if(c.Fecha_de_Captaci_n_Migraci_n__c!=null){
gen.writeDateField('FechaMigracion', c.Fecha_de_Captaci_n_Migraci_n__c);
}
if(c.Gender__c!=null && c.Gender__c!=''){
gen.writeStringField('Gender', c.Gender__c);
}
if(c.Hobbie__c!=null && c.Hobbie__c!=''){
gen.writeStringField('Hobbie', c.Hobbie__c);
}
if(c.ID_Externo_Hist_rico__c!=null && c.ID_Externo_Hist_rico__c!=''){
gen.writeStringField('IdExternoHistorico', c.ID_Externo_Hist_rico__c);
}
gen.writeEndObject();
}
gen.writeEndArray();
String method = 'POST';
if(action==2){
//action = '?Id=' + c.Id;
method = 'PUT';
}
final PageReference theUrl = new PageReference('http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
HttpRequest request = new HttpRequest();
request.setEndpoint(theUrl.getUrl());
request.setHeader('Content-Type', 'application/json');
request.setMethod(method);
request.setTimeout(120000);
request.setBody(gen.getAsString());
HttpResponse response = (new Http()).send(request);
system.debug('#### getBody' + response.getBody());
}
global void finish(Database.BatchableContext BC) {
system.debug('#### list size: ' + i);
system.debug('#### number of executions: ' + j);
}
}
global class SendFirstDonorData implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful{
public Integer i = 0;
public Integer j = 0;
public Integer action;
global SendFirstDonorData(Integer act){
action = act;
}
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator('Select npsp__is_Address_Override__c, npsp__Soft_Credit_Last_N_Days__c, npsp__Primary_Contact__c, npsp__Primary_Affiliation__c, npsp__Number_of_Soft_Credits__c, npsp__Number_of_Soft_Credits_Two_Years_Ago__c, npsp__Number_of_Soft_Credits_This_Year__c, npsp__Number_of_Soft_Credits_Last_Year__c, npsp__Number_of_Soft_Credits_Last_N_Days__c, npsp__Last_Soft_Credit_Date__c, npsp__Last_Soft_Credit_Amount__c, npsp__Largest_Soft_Credit_Date__c, npsp__Largest_Soft_Credit_Amount__c, npsp__HHId__c, npsp__First_Soft_Credit_Date__c, npsp__First_Soft_Credit_Amount__c, npsp__Exclude_from_Household_Name__c, npsp__Exclude_from_Household_Informal_Greeting__c, npsp__Exclude_from_Household_Formal_Greeting__c, npsp__Do_Not_Contact__c, npsp__Deceased__c, npsp__Current_Address__c, npsp__Batch__c, npsp__Address_Verification_Status__c,'+
'npo02__Total_Household_Gifts__c, npo02__TotalOppAmount__c, npo02__TotalMembershipOppAmount__c, npo02__SystemHouseholdProcessor__c, npo02__Soft_Credit_Two_Years_Ago__c, npo02__Soft_Credit_Total__c, npo02__Soft_Credit_This_Year__c, npo02__Soft_Credit_Last_Year__c, npo02__SmallestAmount__c, npo02__OppsClosedThisYear__c, npo02__OppsClosedLastYear__c, npo02__OppsClosedLastNDays__c, npo02__OppsClosed2YearsAgo__c, npo02__OppAmountThisYear__c, npo02__OppAmountThisYearHH__c, npo02__OppAmountLastYear__c, npo02__OppAmountLastYearHH__c, npo02__OppAmountLastNDays__c, npo02__OppAmount2YearsAgo__c, npo02__NumberOfMembershipOpps__c, npo02__NumberOfClosedOpps__c, npo02__Naming_Exclusions__c, npo02__MembershipJoinDate__c, npo02__MembershipEndDate__c, npo02__LastOppAmount__c, npo02__LastMembershipOrigin__c, npo02__LastMembershipLevel__c, '+
'npo02__LastMembershipDate__c, npo02__LastMembershipAmount__c, npo02__LastCloseDate__c, npo02__LastCloseDateHH__c, npo02__LargestAmount__c, npo02__Household__c, npo02__Household_Naming_Order__c, npo02__Formula_HouseholdPhone__c, npo02__Formula_HouseholdMailingAddress__c, npo02__FirstCloseDate__c, npo02__Best_Gift_Year__c, npo02__Best_Gift_Year_Total__c, npo02__AverageAmount__c, npe01__Work_Address__c, npe01__WorkPhone__c, npe01__WorkEmail__c, npe01__Type_of_Account__c, npe01__SystemAccountProcessor__c, npe01__Secondary_Address_Type__c, npe01__Private__c, npe01__Primary_Address_Type__c, npe01__Preferred_Email__c, npe01__PreferredPhone__c, npe01__Other_Address__c, npe01__Organization_Type__c, npe01__Home_Address__c, npe01__HomeEmail__c, '+
'npe01__AlternateEmail__c, Total_Donado_Hist_rico__c, Total_Donado_2014__c, Total_Donado_2013__c, Total_Donado_2012__c, Total_Donado_2011__c, Total_Donado_2010__c, Total_Donado_2009__c, Total_Donado_2008__c, Total_Donado_2007__c, Total_Donado_2006__c, Total_Donado_2005__c, Total_Donado_2004__c, Total_Donado_2003__c, Total_Donado_2002__c, Total_Donado_2001__c, Title, Tipo_de_registro_CANDIDATO__c, Tiene_nietos__c, Tiene_hijos__c, SystemModstamp, Salutation, ReportsToId, Referente__c, RecordTypeId, PhotoUrl, Phone, Pa_s_Aldeas__c, PSN__c, PSN_Historico__c, PSN_Buscar_Contacto__c, OwnerId, OtherStreet, OtherStateCode, OtherState, OtherPostalCode, OtherPhone, OtherLongitude, OtherLatitude, OtherCountryCode, OtherCountry, OtherCity, OtherAddress, Ocupaci_n__c, No_Recibir_Correo_F_sico__c, Ni_Apadrinado__c, Name, N_mero_de_Documento__c,'+
'MobilePhone, Media_2014__c, Media_2013__c, Media_2012__c, Media_2011__c, Media_2010__c, Media_2009__c, Media_2008__c, Media_2007__c, Media_2006__c, Media_2005__c, Media_2004__c, Media_2003__c, Media_2002__c, Media_2001__c, MasterRecordId, MailingStreet, MailingStateCode, MailingState, MailingPostalCode, MailingLongitude, MailingLatitude, MailingCountryCode, MailingCountry, MailingCity, MailingAddress, M_xima_2014__c, M_xima_2013__c, M_xima_2012__c, M_xima_2011__c, M_xima_2010__c, M_xima_2009__c, M_xima_2008__c, M_xima_2007__c, M_xima_2006__c, M_xima_2005__c, M_xima_2004__c, M_xima_2003__c, M_xima_2002__c, M_xima_2001__c, LeadSource, LastViewedDate, LastReferencedDate, LastName, LastModifiedDate, LastModifiedById, LastCUUpdateDate, LastCURequestDate, LastActivityDate, JigsawContactId, Jigsaw, IsEmailBounced, IsDeleted, Id, '+
'ID_Externo_Hist_rico__c, HomePhone, Hobbie__c, HasOptedOutOfFax, HasOptedOutOfEmail, Gender__c, FirstName, Fecha_nacimiento_CANDIDATO__c, Fecha_de_ltima_donaci_n_hist_rica__c, Fecha_de_Pr_ximo_Cumplea_os__c, Fecha_de_Captaci_n__c, Fecha_de_Captaci_n_Migraci_n__c, Fecha_de_Activaci_n_Unificada__c, Fecha_de_Activaci_n_Hist_rica__c, Fax, Estado_Civil__c, EmailBouncedReason, EmailBouncedDate, Email, Edad__c, Duplicado__c, DoNotCall, Destino_de_la_Donaci_n__c, Description, Department, Cuotas_pagadas_2009__c, Cuotas_Pagadas_2014__c, Cuotas_Pagadas_2013__c, Cuotas_Pagadas_2012__c, Cuotas_Pagadas_2011__c, Cuotas_Pagadas_2010__c, Cuotas_Pagadas_2008__c, Cuotas_Pagadas_2007__c, Cuotas_Pagadas_2006__c, Cuotas_Pagadas_2005__c, Cuotas_Pagadas_2004__c, Cuotas_Pagadas_2003__c, Cuotas_Pagadas_2002__c, Cuotas_Pagadas_2001__c, Cuotas_No_Pagadas_2014__c,'+
'Cuotas_No_Pagadas_2013__c, Cuotas_No_Pagadas_2012__c, Cuotas_No_Pagadas_2011__c, Cuotas_No_Pagadas_2010__c, Cuotas_No_Pagadas_2009__c, Cuotas_No_Pagadas_2008__c, Cuotas_No_Pagadas_2007__c, Cuotas_No_Pagadas_2006__c, Cuotas_No_Pagadas_2005__c, Cuotas_No_Pagadas_2004__c, Cuotas_No_Pagadas_2003__c, Cuotas_No_Pagadas_2002__c, Cuotas_No_Pagadas_2001__c, CreatedDate, CreatedById, Cantidad_de_donaciones_No_Pagadas__c, Cantidad_de_Hijos__c, Cantidad_cuotas_No_Pagadas_Hist_ricas__c, Cantidad_Cuotas_Pagadas_Hist_ricas__c, CallCenter_en_Contacto__c, CallCenter_Usuario_Contacto__c, CallCenter_Date_Contacto__c, Birthdate, AssistantPhone, AssistantName, AccountId FROM Contact');
}
global void execute(Database.BatchableContext BC, List<Contact> scope){
i += scope.size();
j ++;
system.debug('#### ' + j);
system.debug('#### ' + scope.size());
Map<Id,User> userMap = new Map<Id,User>((List<User>)[SELECT Id, Name FROM User WHERE IsActive = true]);
Map<Id,RecordType> rtMap = new Map<Id,RecordType>((List<RecordType>)[SELECT Id, Name FROM RecordType WHERE SobjectType = 'Contact']);
JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartArray();
for(Contact c : scope){
gen.writeStartObject();
gen.writeStringField('Id', c.Id);
if(action==2){
if(c.AccountId!=null){
gen.writeStringField('Account', c.AccountId);
}
}
if(c.AssistantName!=null && c.AssistantName!=''){
gen.writeStringField('AssistantName', c.AssistantName);
}
if(c.AssistantPhone!=null && c.AssistantPhone!=''){
gen.writeStringField('AssistantPhone', c.AssistantPhone);
}
if(c.Birthdate!=null){
gen.writeDateField('Birthdate', c.Birthdate);
}
if(c.OwnerId!=null){
gen.writeStringField('Owner', userMap.get(c.OwnerId).Name);
}
if(c.RecordTypeId!=null){
gen.writeStringField('RecordType', rtMap.get(c.RecordTypeId).Name);
}
if(c.Jigsaw!=null && c.Jigsaw!=''){
gen.writeStringField('Jigsaw', c.Jigsaw);
}
if(c.Department!=null && c.Department!=''){
gen.writeStringField('Department', c.Department);
}
if(c.Description!=null && c.Description!=''){
gen.writeStringField('Description', c.Description);
}
if(c.DoNotCall!=null){
gen.writeStringField('DoNotCall', String.valueOf(c.DoNotCall));
}
if(c.Email!=null && c.Email!=''){
gen.writeStringField('Email', c.Email);
}
if(c.HasOptedOutOfEmail!=null){
gen.writeStringField('HasOptedOutOfEmail', String.valueOf(c.HasOptedOutOfEmail));
}
if(c.Fax!=null && c.Fax!=''){
gen.writeStringField('Fax', c.Fax);
}
if(c.HasOptedOutOfFax!=null){
gen.writeStringField('HasOptedOutOfFax', String.valueOf(c.HasOptedOutOfFax));
}
if(c.HomePhone!=null && c.HomePhone!=''){
gen.writeStringField('HomePhone', c.HomePhone);
}
if(c.LastCURequestDate!=null){
gen.writeDateTimeField('LastCURequestDate', c.LastCURequestDate);
}
if(c.LastCUUpdateDate!=null){
gen.writeDateTimeField('LastCUUpdateDate', c.LastCUUpdateDate);
}
if(c.LeadSource!=null && c.LeadSource!=''){
gen.writeStringField('LeadSource', c.LeadSource);
}
if(c.MailingStreet!=null && c.MailingStreet!=''){
gen.writeStringField('MailingStreet', c.MailingStreet);
}
if(c.MailingCity!=null && c.MailingCity!=''){
gen.writeStringField('MailingCity', c.MailingCity);
}
if(c.MailingState!=null && c.MailingState!=''){
gen.writeStringField('MailingState', c.MailingState);
}
if(c.MailingPostalCode!=null && c.MailingPostalCode!=''){
gen.writeStringField('MailingPostalCode', c.MailingPostalCode);
}
if(c.MailingCountry!=null && c.MailingCountry!=''){
gen.writeStringField('MailingCountry', c.MailingCountry);
}
if(c.MobilePhone!=null && c.MobilePhone!=''){
gen.writeStringField('MobilePhone', c.MobilePhone);
}
if(c.Salutation!=null && c.Salutation!=''){
gen.writeStringField('Salutation', c.Salutation);
}
if(c.FirstName!=null && c.FirstName!=''){
gen.writeStringField('FirstName', c.FirstName);
}
if(c.LastName!=null && c.LastName!=''){
gen.writeStringField('LastName', c.LastName);
}
if(c.OtherStreet!=null && c.OtherStreet!=''){
gen.writeStringField('OtherStreet', c.OtherStreet);
}
if(c.OtherCity!=null && c.OtherCity!=''){
gen.writeStringField('OtherCity', c.OtherCity);
}
if(c.OtherState!=null && c.OtherState!=''){
gen.writeStringField('OtherState', c.OtherState);
}
if(c.OtherPostalCode!=null && c.OtherPostalCode!=''){
gen.writeStringField('OtherPostalCode', c.OtherPostalCode);
}
if(c.OtherCountry!=null && c.OtherCountry!=''){
gen.writeStringField('OtherCountry', c.OtherCountry);
}
if(c.OtherPhone!=null && c.OtherPhone!=''){
gen.writeStringField('OtherPhone', c.OtherPhone);
}
if(c.Phone!=null && c.Phone!=''){
gen.writeStringField('Phone', c.Phone);
}
if(c.Title!=null && c.Title!=''){
gen.writeStringField('Title', c.Title);
}
if(c.npe01__AlternateEmail__c!=null && c.npe01__AlternateEmail__c!=''){
gen.writeStringField('AlternateEmail', c.npe01__AlternateEmail__c);
}
if(c.CallCenter_Date_Contacto__c!=null){
gen.writeDateTimeField('CallCenterDateContacto', c.CallCenter_Date_Contacto__c);
}
if(c.CallCenter_en_Contacto__c!=null){
gen.writeStringField('CallCenterenContacto', String.valueOf(c.CallCenter_en_Contacto__c));
}
if(c.CallCenter_Usuario_Contacto__c!=null){
gen.writeStringField('CallCenterUsuarioContacto', userMap.get(c.CallCenter_Usuario_Contacto__c).Name);
}
if(c.Fecha_nacimiento_CANDIDATO__c!=null){
gen.writeDateField('FechaNacimiento', c.Fecha_nacimiento_CANDIDATO__c);
}
if(c.Cantidad_Cuotas_No_Pagadas_Hist_ricas__c!=null){
gen.writeNumberField('CantidadCuotasNoPagadasHistoricas', c.Cantidad_Cuotas_No_Pagadas_Hist_ricas__c);
}
if(c.Cantidad_Cuotas_Pagadas_Hist_ricas__c!=null){
gen.writeNumberField('CantidadCuotasPagadasHistoricas', c.Cantidad_Cuotas_Pagadas_Hist_ricas__c);
}
if(c.Cantidad_de_donaciones_No_Pagadas__c!=null){
gen.writeNumberField('CantidadDonacionesNoPagadas', c.Cantidad_de_donaciones_No_Pagadas__c);
}
if(c.Cantidad_de_Hijos__c!=null && c.Cantidad_de_Hijos__c!=''){
gen.writeStringField('CantidadHijos', c.Cantidad_de_Hijos__c);
}
if(c.Destino_de_la_Donaci_n__c!=null && c.Destino_de_la_Donaci_n__c!=''){
gen.writeStringField('DestinoDonacion', c.Destino_de_la_Donaci_n__c);
}
if(c.npsp__Do_Not_Contact__c!=null){
gen.writeStringField('DoNotContact', String.valueOf(c.npsp__Do_Not_Contact__c));
}
if(c.Duplicado__c!=null){
gen.writeStringField('Duplicado', String.valueOf(c.Duplicado__c));
}
if(c.Edad__c!=null){
gen.writeNumberField('Edad', c.Edad__c);
}
if(c.Estado_Civil__c!=null && c.Estado_Civil__c!=''){
gen.writeStringField('EstadoCivil', c.Estado_Civil__c);
}
if(c.Fecha_de_Activaci_n_Hist_rica__c!=null){
gen.writeDateField('FechaActivacionHistorica', c.Fecha_de_Activaci_n_Hist_rica__c);
}
if(c.Fecha_de_Activaci_n_Unificada__c!=null){
gen.writeDateField('FechaActivacionUnificada', c.Fecha_de_Activaci_n_Unificada__c);
}
if(c.Fecha_de_Captaci_n__c!=null){
gen.writeDateField('FechaCaptacion', c.Fecha_de_Captaci_n__c);
}
if(c.Fecha_de_Pr_ximo_Cumplea_os__c!=null){
gen.writeDateField('FechaProximoCumpleaños', c.Fecha_de_Pr_ximo_Cumplea_os__c);
}
if(c.Fecha_de_ltima_donaci_n_hist_rica__c!=null){
gen.writeDateField('FechaUltimaDonacionHistorica', c.Fecha_de_ltima_donaci_n_hist_rica__c);
}
if(c.Fecha_de_Captaci_n_Migraci_n__c!=null){
gen.writeDateField('FechaMigracion', c.Fecha_de_Captaci_n_Migraci_n__c);
}
if(c.Gender__c!=null && c.Gender__c!=''){
gen.writeStringField('Gender', c.Gender__c);
}
if(c.Hobbie__c!=null && c.Hobbie__c!=''){
gen.writeStringField('Hobbie', c.Hobbie__c);
}
if(c.ID_Externo_Hist_rico__c!=null && c.ID_Externo_Hist_rico__c!=''){
gen.writeStringField('IdExternoHistorico', c.ID_Externo_Hist_rico__c);
}
gen.writeEndObject();
}
gen.writeEndArray();
String method = 'POST';
if(action==2){
//action = '?Id=' + c.Id;
method = 'PUT';
}
final PageReference theUrl = new PageReference('http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
HttpRequest request = new HttpRequest();
request.setEndpoint(theUrl.getUrl());
request.setHeader('Content-Type', 'application/json');
request.setMethod(method);
request.setTimeout(120000);
request.setBody(gen.getAsString());
HttpResponse response = (new Http()).send(request);
system.debug('#### getBody' + response.getBody());
}
global void finish(Database.BatchableContext BC) {
system.debug('#### list size: ' + i);
system.debug('#### number of executions: ' + j);
}
}
- Angello Camacho Drago
- January 17, 2017
- Like
- 0
- Continue reading or reply
Delete document after download through visualforce page
I created a visualforce page with a button to download a document, this work fine, but after download the document I want to delete the file without to click in another button, this is the code I am using:
<apex:page standardController="npe03__Recurring_Donation__c" extensions="ReporteCompromisosExportacionController" action="{!getFile}" tabStyle="Reporte_Compromisos__tab">
<apex:form >
<apex:actionFunction name="download" action="{!downloadFile}"/>
<apex:actionFunction name="deletef" action="{!deleteFile}" rerender="name"/>
<apex:pageBlock id="page">
<apex:pageBlockSection columns="1" title="Descargar Archivo de Cobranza" collapsible="false">
<apex:pageBlockSectionItem >
<apex:image url="{!$Resource.excelIcon}" width="30" height="30"/>
<apex:outputText id="name" value="Archivo {!fileName}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:CommandButton value="Descargar Archivo" action="{!downloadFile}" oncomplete="deletef();" rerender="name"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
The oncomple method doesn't work, can some one help me please?
Thanks.
<apex:page standardController="npe03__Recurring_Donation__c" extensions="ReporteCompromisosExportacionController" action="{!getFile}" tabStyle="Reporte_Compromisos__tab">
<apex:form >
<apex:actionFunction name="download" action="{!downloadFile}"/>
<apex:actionFunction name="deletef" action="{!deleteFile}" rerender="name"/>
<apex:pageBlock id="page">
<apex:pageBlockSection columns="1" title="Descargar Archivo de Cobranza" collapsible="false">
<apex:pageBlockSectionItem >
<apex:image url="{!$Resource.excelIcon}" width="30" height="30"/>
<apex:outputText id="name" value="Archivo {!fileName}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:CommandButton value="Descargar Archivo" action="{!downloadFile}" oncomplete="deletef();" rerender="name"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
The oncomple method doesn't work, can some one help me please?
Thanks.
- Angello Camacho Drago
- January 10, 2017
- Like
- 0
- Continue reading or reply
Batch class does not execute all the batches it should when calling web services in the execute method
I want to send salesforce data to another system, but when I send the data through a batch class when I call the web service in the execute method doesn't execute all the batches, but if in the execute method don't make the callout all the batches execute, I put two counters in the execute method and I am showing in the finish method one for the number of records in the list and the other for the times the execute method is running, and when I execute the batch without make the callouts run all the batches but when execute the batch calling the web service in the execute method don't run all the batches.
- Angello Camacho Drago
- January 10, 2017
- Like
- 0
- Continue reading or reply
Visualforce page Error Response size exceeded 15MB organization limit
I am exporting opportunity data to an excel file xls, but when the query has many data I get this error "Response size exceeded 15MB organization limit", I only use a HTML table, an apex:ouputtext to change the date format and two apex:repeat for the rows, I want to show more than 30,000 records, can some one help me?.
Thanks.
Thanks.
- Angello Camacho Drago
- January 05, 2017
- Like
- 0
- Continue reading or reply
Response size exceeded 15MB organization limit
I am exporting opportunity data to an excel file xls, but when the query has many data I get this error "Response size exceeded 15MB organization limit", can some one help me?
Thanks.
Thanks.
- Angello Camacho Drago
- January 04, 2017
- Like
- 0
- Continue reading or reply
jQuery Control doesn't work in visualforce page
I have an issue, I tried to use a [jQuery Time Range Slider][1] inside a visualforce page but doesn't work, I tried different jquery versions, can any one help me?
this is my code:
this is my code:
<apex:page controller="SeekerController" sidebar="false" title="Posiciones Fuerza de Ventas" docType="html-5.0"> <script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyAtxPCGB4rExpez5r0kzHibcs94FsPpj9U"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script> <style type="text/css" media="print"> #time-range p { font-family:"Arial", sans-serif; font-size:14px; color:#333; } .ui-slider-horizontal { height: 8px; background: #D7D7D7; border: 1px solid #BABABA; box-shadow: 0 1px 0 #FFF, 0 1px 0 #CFCFCF inset; clear: both; margin: 8px 0; -webkit-border-radius: 6px; -moz-border-radius: 6px; -ms-border-radius: 6px; -o-border-radius: 6px; border-radius: 6px; } .ui-slider { position: relative; text-align: left; } .ui-slider-horizontal .ui-slider-range { top: -1px; height: 100%; } .ui-slider .ui-slider-range { position: absolute; z-index: 1; height: 8px; font-size: .7em; display: block; border: 1px solid #5BA8E1; box-shadow: 0 1px 0 #AAD6F6 inset; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px; background: #81B8F3; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(0%, #A0D4F5), color-stop(100%, #81B8F3)); background-image: -webkit-linear-gradient(top, #A0D4F5, #81B8F3); background-image: -moz-linear-gradient(top, #A0D4F5, #81B8F3); background-image: -o-linear-gradient(top, #A0D4F5, #81B8F3); background-image: linear-gradient(top, #A0D4F5, #81B8F3); } .ui-slider .ui-slider-handle { border-radius: 50%; background: #F9FBFA; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(0%, #C7CED6), color-stop(100%, #F9FBFA)); background-image: -webkit-linear-gradient(top, #C7CED6, #F9FBFA); background-image: -moz-linear-gradient(top, #C7CED6, #F9FBFA); background-image: -o-linear-gradient(top, #C7CED6, #F9FBFA); background-image: linear-gradient(top, #C7CED6, #F9FBFA); width: 22px; height: 22px; -webkit-box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset; -moz-box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset; box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset; -webkit-transition: box-shadow .3s; -moz-transition: box-shadow .3s; -o-transition: box-shadow .3s; transition: box-shadow .3s; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 22px; height: 22px; cursor: default; border: none; cursor: pointer; } .ui-slider .ui-slider-handle:after { content:""; position: absolute; width: 8px; height: 8px; border-radius: 50%; top: 50%; margin-top: -4px; left: 50%; margin-left: -4px; background: #30A2D2; -webkit-box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 #FFF; -moz-box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 white; box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 #FFF; } .ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.6em; } .ui-slider a:focus { outline:none; } #slider-range { width: 90%; margin: 0 auto; } #time-range { width: 400px; } </style> <script> $j = jQuery.noConflict(); //this function will be called as soon as page load is complete $j("#slider-range").slider({ range: true, min: 0, max: 1440, step: 15, values: [540, 1020], slide: function (e, ui) { var hours1 = Math.floor(ui.values[0] / 60); var minutes1 = ui.values[0] - (hours1 * 60); if (hours1.length == 1) hours1 = '0' + hours1; if (minutes1.length == 1) minutes1 = '0' + minutes1; if (minutes1 == 0) minutes1 = '00'; if (hours1 >= 12) { if (hours1 == 12) { hours1 = hours1; minutes1 = minutes1 + " PM"; } else { hours1 = hours1 - 12; minutes1 = minutes1 + " PM"; } } else { hours1 = hours1; minutes1 = minutes1 + " AM"; } if (hours1 == 0) { hours1 = 12; minutes1 = minutes1; } $j('.slider-time').html(hours1 + ':' + minutes1); var hours2 = Math.floor(ui.values[1] / 60); var minutes2 = ui.values[1] - (hours2 * 60); if (hours2.length == 1) hours2 = '0' + hours2; if (minutes2.length == 1) minutes2 = '0' + minutes2; if (minutes2 == 0) minutes2 = '00'; if (hours2 >= 12) { if (hours2 == 12) { hours2 = hours2; minutes2 = minutes2 + " PM"; } else if (hours2 == 24) { hours2 = 11; minutes2 = "59 PM"; } else { hours2 = hours2 - 12; minutes2 = minutes2 + " PM"; } } else { hours2 = hours2; minutes2 = minutes2 + " AM"; } $j('.slider-time2').html(hours2 + ':' + minutes2); } }); </script> <div id="time-range"> <p>Time Range: <span class="slider-time">9:00 AM</span> - <span class="slider-time2">5:00 PM</span> </p> <div class="sliders_step1"> <div id="slider-range"></div> </div> </div> </apex:page>
- Angello Camacho Drago
- March 11, 2018
- Like
- 0
- Continue reading or reply
Map get blank value when I call get method
Hi every one, I have a trigger that when I insert data into a custom object create a map with the id of a contact as a key and a list of the custom object as the value, when I check if the key is contained in the map I get true, but when I try to get the value I get (), but when I filled the map I check if the list has items with an if list.size()>0, this is my code:
Map<Id, List<npe03__Recurring_Donation__c>> rdsMap = new Map<Id, List<npe03__Recurring_Donation__c>>(); for(Id id : Ids){ List<npe03__Recurring_Donation__c> rdOld = new List<npe03__Recurring_Donation__c>(); for(npe03__Recurring_Donation__c rd : rds){ if(rd.npe03__Organization__c != null){ if(id == rd.npe03__Organization__c){ rdOld.add(rd); } } else if(rd.npe03__Contact__c != null){ if(id == rd.npe03__Contact__c){ rdOld.add(rd); } } } if(rdOld.size()>0){ rdsMap.put(id, rdOld); } } for(npe03__Recurring_Donation__c rdNew : trigger.new){ else if(rdNew.npe03__Contact__c != null){ if(rdsMap.containsKey(rdNew.npe03__Contact__c)){ List<npe03__Recurring_Donation__c> rdsSort = new List<npe03__Recurring_Donation__c>(); List<npe03__Recurring_Donation__c> rdsOld = rdsMap.get(rdNew.npe03__Contact__c);//here I get an empty list integer targetsize = rdsOld.size(); while(rdsSort.size() != targetsize){ datetime dt = Datetime.newInstance(1900, 1, 1, 00, 00, 00); integer i = 0; integer mini = 0; for(i = 0; i != rdsOld.size(); i ++){ if(rdsOld[i].CreatedDate > dt){ dt = rdsOld[i].CreatedDate; mini = i; } } rdsSort.add(rdsOld[mini]); rdsOld.remove(mini); } if(rdsSort[0].npe03__Amount__c < rdNew.npe03__Amount__c){ } else{ rdNew.addError('No puede crear un Compromiso de Donación con el Tipo de Compormiso "Nuevo por Aumento", porque el monto ingresado es menor o igual que el monto del Compromiso de Donación Anterior'); } } } } }
- Angello Camacho Drago
- September 01, 2017
- Like
- 0
- Continue reading or reply
Comparing values from list using value from another list in apex
Hi,
I'm trying to return values from a list in an apex class using the value from another list.
So I have list1 = [Select Contact__r.ContactEmail from Registrations__c Id in : lstRegistrations]
and what I want to do is check all the records from another object using the value of ContactEmail from above list.
So something like this:
list2=[Select Email from Site__c where Email contains (list1.Contact__r.ContactEmail)]
Can this be done?
Any help is much appreciated.
Thanks
- RadDude89
- January 19, 2017
- Like
- 0
- Continue reading or reply
UserInfo.getUserId()) retunr null ?!
We have a milestone that execute a field update, this field update trigger the Case Ater update trigger.
The trigger after update on case use the following function : THA_Utils.getProfileIdByName(UserInfo.getUserId());
[...]
public static string getProfileIdByName(Id isUser) {
List<Profile> listProfile = [Select Name From Profile Where Id in (SELECT ProfileId
FROM User
WHERE id =:idUser)];
return listProfile[0].Name;
}
We are getting error on the : return listProfile[0].Name; / caused by: System.ListException: List index out of bounds: 0: Class.THA_Utils.getProfileNameByIdUser: line 65, column 1".
Does anyone know why we have this bug ?
the Default Workflow User is already set up as active admin... I don't udenrstand why we get this error.
The trigger after update on case use the following function : THA_Utils.getProfileIdByName(UserInfo.getUserId());
[...]
public static string getProfileIdByName(Id isUser) {
List<Profile> listProfile = [Select Name From Profile Where Id in (SELECT ProfileId
FROM User
WHERE id =:idUser)];
return listProfile[0].Name;
}
We are getting error on the : return listProfile[0].Name; / caused by: System.ListException: List index out of bounds: 0: Class.THA_Utils.getProfileNameByIdUser: line 65, column 1".
Does anyone know why we have this bug ?
the Default Workflow User is already set up as active admin... I don't udenrstand why we get this error.
- Anass Haial 9
- January 10, 2017
- Like
- 0
- Continue reading or reply
Batch class does not execute all the batches it should when calling web services in the execute method
I want to send salesforce data to another system, but when I send the data through a batch class when I call the web service in the execute method doesn't execute all the batches, but if in the execute method don't make the callout all the batches execute, I put two counters in the execute method and I am showing in the finish method one for the number of records in the list and the other for the times the execute method is running, and when I execute the batch without make the callouts run all the batches but when execute the batch calling the web service in the execute method don't run all the batches.
- Angello Camacho Drago
- January 10, 2017
- Like
- 0
- Continue reading or reply
APEX BATCH JOB - Abruptly ending without errors but showing ALL Batches completed.
I have strange behavior with a APEX Batch job
I run this job with batch size of 1 and it puts a job of 1000 Batches to process. However after it run for some time I have seen following behavior
1. I see the batches are processing fine say like it has processed 300. All of a sudden I see all jobs completed and it says it processed 800 batches (not sure where the other 200 batches go). Looking at the data looks like it did not process everything that should have been processed.
2. Some times I see it is processing fine say at 400th batch and all of a sudden it would say completed with all 1000 batch completed. Looking at the data looks like it did not process everything that should have been processed.
Any ideas why this could happen ?
The batch class internally call another class method in the execute method. This method has some what more logic in it. However this method when run individually does not have any issues (No Heap size issue or other performance issues). Not sure because of the call method the complete Batch job is abruptly aborted. (with specifying any error)
I have opened a case with Salesforce but want to see if any one else have seen this issue.
I run this job with batch size of 1 and it puts a job of 1000 Batches to process. However after it run for some time I have seen following behavior
1. I see the batches are processing fine say like it has processed 300. All of a sudden I see all jobs completed and it says it processed 800 batches (not sure where the other 200 batches go). Looking at the data looks like it did not process everything that should have been processed.
2. Some times I see it is processing fine say at 400th batch and all of a sudden it would say completed with all 1000 batch completed. Looking at the data looks like it did not process everything that should have been processed.
Any ideas why this could happen ?
The batch class internally call another class method in the execute method. This method has some what more logic in it. However this method when run individually does not have any issues (No Heap size issue or other performance issues). Not sure because of the call method the complete Batch job is abruptly aborted. (with specifying any error)
I have opened a case with Salesforce but want to see if any one else have seen this issue.
- Nitin Parande
- January 08, 2017
- Like
- 1
- Continue reading or reply
Visualforce page Error Response size exceeded 15MB organization limit
I am exporting opportunity data to an excel file xls, but when the query has many data I get this error "Response size exceeded 15MB organization limit", I only use a HTML table, an apex:ouputtext to change the date format and two apex:repeat for the rows, I want to show more than 30,000 records, can some one help me?.
Thanks.
Thanks.
- Angello Camacho Drago
- January 05, 2017
- Like
- 0
- Continue reading or reply
Response size exceeded 15MB organization limit
I am exporting opportunity data to an excel file xls, but when the query has many data I get this error "Response size exceeded 15MB organization limit", can some one help me?
Thanks.
Thanks.
- Angello Camacho Drago
- January 04, 2017
- Like
- 0
- Continue reading or reply