• David Ovella
  • NEWBIE
  • 285 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 49
    Questions
  • 44
    Replies
Hello,

I created visualforce that converts the page to PDF..

I have 2 pages, both are using the Same controller (where my image URL is located) and both have the same code except the second 1 is rendered as PDF. The 1st page serves as a Preview before converting it to PDF format.


The PDF format image shows like this one below.

User-added image

Below is how I call the URL from the Controller (which the same way I call it from the preview and it's working)

I have this one from the Controller : imageURL = '/servlet/servlet.ImageServer?id=01555000000fdlO&oid=00D5500000066Iu&lastMod=1445545410000';

Then I call it from the PDF Rendered VF like this.
 
<table style="border: 1px solid white;" width="100%">
                     <tr>
                        <td style="border-color:white" width="80px" >
                            <apex:image url="{!imageURL}" />
                        </td>
                        <td style="border-color:white; text-align:left;" width="70%">
                            <font face="calibri" color="black" size="10"><h2>Traffic Control Form</h2></font>
                        </td>
                    </tr>
                </table>

Not sure where else to look so I decided to ask.

Thank you!

-Zach

 
hello,
my visualforce
<apex:page controller="ContadorAnteriorRapidoController"  tabStyle="Contador_Anterior__c">
    <script>
    function confirmCancel() {
        var isCancel = confirm("Estas seguro que desea cancelar la creación de los Contadores?");
        if (isCancel) return true;
        return false;
    }  
    </script>

    <apex:sectionHeader title="Creación de" subtitle="Contadores"/>
    <apex:form >   	
        <div style="font-size: 12px; color:#FF0000; ">                                                                                              
            <apex:pageMessages id="errMessages" escape="false" />                                                                  
        </div> 
        <apex:pageBlock mode="edit" >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Guardar"/>
                <apex:commandButton action="{!cancelar}" value="Cancelar" onclick="return confirmCancel()" immediate="true"/>
            </apex:pageBlockButtons>  

            <apex:pageBlockSection title="Maquina" columns="1">
                <apex:inputField value="{!Contador.Fecha__c}"/>
                <apex:inputField value="{!contador.Sucursal__c}"/>
                <apex:inputField value="{!contador.Maquina__c}"/>
                <apex:inputField value="{!contador.Tipo_de_Contador__c}"/><br/>
                <apex:inputField value="{!Contador.Contador_Anterior_m__c}"/>
            </apex:pageBlockSection>   

        </apex:pageBlock>      
    </apex:form>
</apex:page>


my apex
public class ContadorAnteriorRapidoController {
    
    public Contador_Anterior__c contador;

    
    public Contador_Anterior__c getContador(){
        if(contador==null)contador=new Contador_Anterior__c();
        //VM
        if(contador.Sucursal__c=='Maker Villa Morra'){
            contador.Maquina__c='Xerox700 (s979)';
            contador.Tipo_de_Contador__c='BnC';
        }
        return  contador;
    }

    
    //Boton Cancelar ContadorRapido
    public PageReference cancelar(){
        PageReference pr=new PageReference('');
        pr.setRedirect(true);
        return pr;    
    }

    //Boton Guardar ContadorRapido
    public PageReference save(){
        try{
            If(contador.Sucursal__c!='Maker Villa Morra' && contador!=null){
                insert contador;
            }
        }          
        catch(exception ex) {  
            ApexPages.addMessages(ex);
            return null;
        }
        
        PageReference ContadorAnteriorRapido = new ApexPages.StandardController(contador).view();
        ContadorAnteriorRapido.setRedirect(true);
        return ContadorAnteriorRapido;
    } 
}


I go to the custome object --> Buttons, Links, and Actions --> edit NEW -->Override With: (but doesn't show my visual)
Visualforce Page --None--
it should be  Visualforce Page --ContadorAnteriorRapido--

I know is because of the controller, but if I put the standardController="Contador_Anterior__c" I can't work with my apex.
and I try   standardController="Contador_Anterior" extension="ContadorAnteriorRapidoController" but I get an error of "Unknown constructor 'ContadorAnteriorRapidoController.ContadorAnteriorRapidoController(ApexPages.StandardController controller)"

can someone help please,
thanks
 
Hi all,
I am trying to know how to convert text to number but from the 5th value.
I know that "value(Text__c)" converts it to number
example:
Text__c: 00101100
If a use the formula "value(Text__c)" this will deploy 101.100
but I would like to deploy 100

how can I do that? any example would be realy nice

thanks
Hi everyone,
I want to know if it's possible to save a number field like 001?
cause when I enter 001 it appears to me like just 1


and don't want to this field be text
Hi everyone,
I want to know if it is possible that an object can only have a record created by day depending on some criteria

Example:
Object: "OD__c"            Custome Field: Date__c, Suc__c.

this Object has already a record created today called
Name: OD-001     02/Feb/2016         Suc: Central

so if I try to create another one with the same values I would like to get an error
Name: OD-002   02/Feb/2016          Suc: Central

can this object be validated if it meet the criteria 
If (Date__c==Today() && Suc__c == "Central")







 
Hello,
I want to know if it's possible to create a trigger that let a number field goes only in a consecutive order,
this custome field must not be Auto-Number field because it has to be entered

Example:
the user entered a value in the number field PRE_IMPRESO__c between 001 to 100

PreImpreso: 001
PreImpreso: 002
If I try to enter 004 and 003 was not entered yet, I get the error "Pre-Impreso isn't going in consecutive order"


I would really appreciate any kind of example
thanks
Hello, I want to know if it's possible to create a trigger to let a number field be created only in a consecutive order
Example: (001 to 100)
PreImpreso 001
PreImpreso 002
If I try to enter 004 and 003 was not entered yet, I get the error "number isn't going in consecutive order"
Hello, I want to know if it's possible to create a validation rule to let a number field be created only in a consecutive order
Example: (001 to 100)
PreImpreso 001
PreImpreso 002
If I try to enter 004 and 003 it was not entered yet, I get the error "number isn't going in consecutive order"
 
Hello, I have a problem with my email template.
Sometimes I don't know why, or how but the e-template send to the client an error message, that looks like this:

(I should be like: "Total: G187.500.- IVA incl.")
Does anyone know why is this happening?

Item 1
150 Tarjetas, impresión digital color a una cara, papel ilustración mate 250 grs. tamaño 12 x 12,5 cm.
Total: if(!window.sfdcPage) { window.sfdcPage = new ApexDetailPage(); }UserContext.initialize({"ampm":["AM","PM"],"isAccessibleMode":false,"uiSkin":"Theme3","salesforceURL":"https://na18.salesforce.com","dateFormat":"d/MM/yyyy","isS1Desktop":false,"language":"es","locale":"es","userName":"villamorra@maker.com.py","userId":"005A0000003Y2vi","isCurrentlySysAdminSU":false,"renderMode":"RETRO","startOfWeek":"2","dateTimeFormat":"d/MM/yyyy H:mm","orgPreferences":[{"index":257,"name":"TabOrganizer","value":true},{"index":113,"name":"GroupTasks","value":true}],"siteUrlPrefix":"","isDefaultNetwork":true,"labelLastModified":"1449795206000","today":"17/12/2015 10:40","timeFormat":"H:mm","userPreferences":[{"index":112,"name":"HideInlineEditSplash","value":false},{"index":114,"name":"OverrideTaskSendNotification","value":false},{"index":115,"name":"DefaultTaskSendNotification","value":false},{"index":119,"name":"HideUserLayoutStdFieldInfo","value":false},{"index":116,"name":"HideRPPWarning","value":false},{"index":87,"name":"HideInlineSchedulingSplash","value":false},{"index":88,"name":"HideCRUCNotification","value":false},{"index":89,"name":"HideNewPLESplash","value":false},{"index":90,"name":"HideNewPLEWarnIE6","value":false},{"index":122,"name":"HideOverrideSharingMessage","value":false},{"index":91,"name":"HideProfileILEWarn","value":false},{"index":93,"name":"HideProfileElvVideo","value":false},{"index":97,"name":"ShowPicklistEditSplash","value":false},{"index":92,"name":"HideDataCategorySplash","value":false},{"index":128,"name":"ShowDealView","value":false},{"index":129,"name":"HideDealViewGuidedTour","value":false},{"index":132,"name":"HideKnowledgeFirstTimeSetupMsg","value":false},{"index":104,"name":"DefaultOffEntityPermsMsg","value":false},{"index":135,"name":"HideNewCsnSplash","value":false},{"index":101,"name":"HideBrowserWarning","value":false},{"index":139,"name":"HideDashboardBuilderGuidedTour","value":false},{"index":140,"name":"HideSchedulingGuidedTour","value":false},{"index":180,"name":"HideReportBuilderGuidedTour","value":true},{"index":183,"name":"HideAssociationQueueCallout","value":false},{"index":194,"name":"HideQTEBanner","value":false},{"index":193,"name":"HideChatterOnboardingSplash","value":false},{"index":195,"name":"HideSecondChatterOnboardingSplash","value":false},{"index":270,"name":"HideIDEGuidedTour","value":false},{"index":282,"name":"HideQueryToolGuidedTour","value":false},{"index":196,"name":"HideCSIGuidedTour","value":false},{"index":271,"name":"HideFewmetGuidedTour","value":false},{"index":272,"name":"HideEditorGuidedTour","value":false},{"index":205,"name":"HideApexTestGuidedTour","value":false},{"index":206,"name":"HideSetupProfileHeaderTour","value":false},{"index":207,"name":"HideSetupProfileObjectsAndTabsTour","value":false},{"index":213,"name":"DefaultOffArticleTypeEntityPermMsg","value":false},{"index":214,"name":"HideSelfInfluenceGetStarted","value":false},{"index":215,"name":"HideOtherInfluenceGetStarted","value":false},{"index":216,"name":"HideFeedToggleGuidedTour","value":false},{"index":268,"name":"ShowChatterTab178GuidedTour","value":false},{"index":275,"name":"HidePeopleTabDeprecationMsg","value":false},{"index":276,"name":"HideGroupTabDeprecationMsg","value":false},{"index":224,"name":"HideUnifiedSearchGuidedTour","value":false},{"index":226,"name":"ShowDevContextMenu","value":true},{"index":227,"name":"HideWhatRecommenderForActivityQueues","value":false},{"index":228,"name":"HideLiveAgentFirstTimeSetupMsg","value":false},{"index":232,"name":"HideGroupAllowsGuestsMsgOnMemberWidget","value":false},{"index":233,"name":"HideGroupAllowsGuestsMsg","value":false},{"index":234,"name":"HideWhatAreGuestsMsg","value":false},{"index":235,"name":"HideNowAllowGuestsMsg","value":false},{"index":236,"name":"HideSocialAccountsAndContactsGuidedTour","value":false},{"index":237,"name":"HideAnalyticsHomeGuidedTour","value":true},{"index":238,"name":"ShowQuickCreateGuidedTour","value":false},{"index":245,"name":"HideFilePageGuidedTour","value":false},{"index":250,"name":"HideForecastingGuidedTour","value":false},{"index":251,"name":"HideBucketFieldGuide","value":false},{"index":263,"name":"HideSmartSearchCallOut","value":false},{"index":265,"name":"HideSocialProfilesKloutSplashScreen","value":false},{"index":273,"name":"ShowForecastingQuotaAttainment","value":false},{"index":280,"name":"HideForecastingQuotaColumn","value":false},{"index":301,"name":"HideManyWhoGuidedTour","value":false},{"index":284,"name":"HideExternalSharingModelGuidedTour","value":false},{"index":298,"name":"HideFileSyncBannerMsg","value":false},{"index":299,"name":"HideTestConsoleGuidedTour","value":false},{"index":302,"name":"HideManyWhoInlineEditTip","value":false},{"index":303,"name":"HideSetupV2WelcomeMessage","value":false},{"index":312,"name":"ForecastingShowQuantity","value":false},{"index":313,"name":"HideDataImporterIntroMsg","value":false},{"index":314,"name":"HideEnvironmentHubLightbox","value":false},{"index":316,"name":"HideSetupV2GuidedTour","value":false},{"index":317,"name":"HideFileSyncMobileDownloadDialog","value":false},{"index":322,"name":"HideEnhancedProfileHelpBubble","value":false},{"index":328,"name":"ForecastingHideZeroRows","value":false},{"index":330,"name":"HideEmbeddedComponentsFeatureCallout","value":false},{"index":341,"name":"HideDedupeMatchResultCallout","value":false},{"index":340,"name":"HideS1BrowserUI","value":true},{"index":346,"name":"HideS1Banner","value":true},{"index":358,"name":"HideEmailVerificationAlert","value":false},{"index":354,"name":"HideLearningPathModal","value":false},{"index":359,"name":"HideAtMentionsHelpBubble","value":false},{"index":368,"name":"LightningExperiencePreferred","value":false}],"networkId":""}); G187.500.- IVA incl.

Delivery (Asunción) Opcional Gs.: 7.000 IVA incl. (Confirmar Servicio)
Se aceptan pagos con Tarjetas de Crédito, Débito y Tigo Money (0985-619077)

Favor confirmar si están correctos los siguientes datos de facturación:
Nombre o Razón Social: SIEMI S.R.L.
This is a "trigger" that doesn't allow duplicate values of the field Pre_Impreso 003_001 _c
trigger MensajeValorDuplicado on Factura__c (before insert, before update) {
    
    Map<Decimal, Factura__c> facMap = new Map<Decimal, Factura__c>();

    For (Factura__c facturarecoleta : System.Trigger.new) {     
        If ((facturarecoleta.Pre_impreso_003_001__c != null) && (System.Trigger.isInsert)){            
            facMap.put(facturarecoleta.Pre_impreso_003_001__c, facturarecoleta);                
        }                  
    }
  
    For (Factura__c facturarecoleta : [SELECT Id, Name, Sucursal__c, Pre_impreso_003_001__c FROM Factura__c WHERE Pre_impreso_003_001__c IN :facMap.KeySet()]){
        If (facturarecoleta.Sucursal__c=='Maker Recoleta'){
            Factura__c newFactura = facMap.get(facturarecoleta.Pre_impreso_003_001__c);
            newFactura.addError('El #Pre-Impreso(003-001) ingresado ya fue utilizado en la Factura', false);
        }
    } 
}

I tried to test this trigger but isn't allowing me to save because of the @isTest 
error: unexpected token: @
Also I changed the version of the trigger but still doesn't work

my trigger test (I don't know why isn't recognizing the @isTest)
@isTest
private class MensajeValorDuplicadoTest {
    static testMethod void TestMensajeValorDuplicado() {
   
       Test.startTest();
      
       Map<Decimal, Factura__c> facMap = new Map<Decimal, Factura__c>();
       Factura__c facturas = new Factura__c();
       //insert factura;

       For (Factura__c factura: [Select ID, Name, Pre_Impreso_003_001__c, Sucursal__c, Caja__c From Factura__c WHERE Pre_impreso_003_001__c IN :facMap.KeySet()]){
           System.debug('factura name' + factura.Name);
           System.assertEquals('factura name',factura.name);
           System.debug(555555 + factura.Pre_Impreso_003_001__c);
           System.assertEquals(55555,factura.Pre_Impreso_003_001__c);    
           System.debug('Caja 1' + factura.Caja__c);
           System.assertEquals('Caja 1',factura.Caja__c);   
           System.debug('Maker Centro' + factura.Sucursal__c);
           System.assertEquals('Maker Centro',factura.Sucursal__c);            
      }
    
       Test.stopTest();
    }
}

 
I am working with a trigger, apex and a visualforce page,
trying to display in my vfpage the error of duplicate values, and it works kind of.
The error message appears in my visual, but it is giving me all the records created in my Factura__c
and not the one of duplicate value. I think is because my trigger it not working well
Example:

In the top of my visual is showing me 3 errors and that is because there 3 records created in my Factura__c
and the only one that it should be displaying it is in the red box.

My object is Factura__c and the custom field that it should not have duplicate values is called Pre_impreso_001_001__c

User-added image


my trigger
trigger MensajeValorDuplicadoCentro on Factura__c (before insert, before update) {

    Map<Decimal, Factura__c> facMap = new Map<Decimal, Factura__c>();

    For (Factura__c factura : System.Trigger.new) {     
        If ((factura.Pre_impreso_001_001__c != null) && (System.Trigger.isInsert ||
        (factura.Pre_impreso_001_001__c != System.Trigger.oldMap.get(factura.Id).Pre_impreso_001_001__c))){            
            facMap.put(factura.Pre_impreso_001_001__c, factura);                
        }                  
    }
  

    For (Factura__c factura : [SELECT Id, Name, Sucursal__c FROM Factura__c]) {  		
        If (factura.Sucursal__c=='Maker Centro'){      	
            For (Factura__c facturace : [SELECT Pre_impreso_001_001__c FROM Factura__c WHERE Pre_impreso_001_001__c IN :facMap.KeySet()]) {                                                                
                Factura__c newFactura = facMap.get(facturace.Pre_impreso_001_001__c);                  
                newFactura.addError('El #Pre-Impreso(001-001) ingresado ya fue utilizado en la Factura:<a href=\'https://cs21.salesforce.com/'+factura.Id+'\'>'+factura.Name+'</a>', false);           
            }       	
        } 
    } 

}


my visual
<apex:page controller="FacturaRapidaController" tabStyle="Factura__c">  
    <script>     
    function confirmarCancelar() {           
        var isCancel = confirm("Estas seguro que desea cancelar la creación de Factura?");        
        if (isCancel)return true;    
        return false;
    } 
    </script>     
    <apex:sectionHeader title="Creación de" subtitle="FACTURA"/>                  
    <apex:form >      
        <apex:pageBlock mode="edit" title="Crear Factura Contado">                
                         
          	<div style="font-size: 12px; color:#FF0000;">                                                                                              
        		<apex:pageMessages id="errMessages" escape="false"/>                                                                  
    		</div>    
            <apex:pageBlockButtons >                          
                <apex:commandButton action="{!guardarFactura}" value="Guardar"/>                                
                <apex:commandButton action="{!cancelarFactura}" value="Cancelar" onclick="return confirmarCancelar()" immediate="true"/>                      
            </apex:pageBlockButtons> 
            
            <apex:pageBlockSection title="Información Básica de la Factura" columns="1">                                     
                <apex:inputField value="{!factura.Pre_Factura__c}"/>                 
                <apex:inputField value="{!factura.Sucursal__c}" required="true"/>                
                <apex:inputField value="{!factura.Caja__c}" required="true"/>                        
                <apex:inputField value="{!factura.Serie__c}" required="true"/>                
            </apex:pageBlockSection>   
                                 
            <apex:pageBlockSection title="Confirmar Factura" columns="1">            
                <apex:inputField value="{!factura.Pre_impreso_001_001__c}"/>                                                                                                                  
            </apex:pageBlockSection>                                      
        </apex:pageBlock>       
    </apex:form>
</apex:page>



my apex
public PageReference guardarFactura(){                  
        try{ 
            insert factura; 
        }
        catch(exception ex) {  
            ApexPages.addMessages(ex);
            return null;
        }

        PageReference FacturaRapidaPage = new ApexPages.StandardController(factura).view();
        FacturaRapidaPage.setRedirect(true);
        return FacturaRapidaPage;
    }




 
Hello experts

this is my standard page, and the button that I want to appear/disappear is "Crear Factura" depending of
the value of the field "Sucursal__c" which is a picklist
User-added image

If(Sucursal__c=="Maker Centro",true,false)
How can I do this in the standard page?
​any code would be really helpful
 
in my standar page my error is showing
User-added image


but in my visualforce page when I try to save it is not showing
User-added image



my apex
public class FacturaRapidaController {
    
    public Factura__c factura;
    public Cobro__c cobro;
 
    public Factura__c getFactura(){
        if(factura==null)factura=new Factura__c();
        factura.Esta_seguro__c='Si';
        return factura;
    }

    
    Public PageReference cancelarFactura(){  

    }
    
    public PageReference guardarFactura(){               	
        try{ 
        	insert factura; 
        }
        catch(exception ex) {       
            return null; 
        }

        PageReference FacturaRapidaPage = new ApexPages.StandardController(factura).view();
        FacturaRapidaPage.setRedirect(true);
        return FacturaRapidaPage;
    }     
}
my visualforce face
<apex:page controller="FacturaRapidaController" tabStyle="Factura__c">  
    <script>     
    function confirmarCancelar() {           
        var isCancel = confirm("Estas seguro que desea cancelar la creación de Factura?");        
        if (isCancel)return true;    
        return false;
    }
  </script>    
    <apex:sectionHeader title="Creación de" subtitle="FACTURA"/>
    <apex:form >                     
            <apex:pageBlock mode="edit" title="Crear Factura Contado"> 
                <apex:pageBlockButtons >               
                    <apex:commandButton action="{!guardarFactura}" value="Guardar"/>                
                    <apex:commandButton action="{!cancelarFactura}" value="Cancelar" onclick="return confirmarCancelar()" immediate="true"/>       
                </apex:pageBlockButtons>     
                <apex:pageBlockSection title="Información Básica de la Factura" columns="1">                         
                    <apex:inputField value="{!factura.Pre_Factura__c}"/>  
                    <apex:inputField value="{!factura.Sucursal__c}" required="true"/>
                    <apex:inputField value="{!factura.Caja__c}" required="true"/>        
                    <apex:inputField value="{!factura.Serie__c}" required="true"/> 
                </apex:pageBlockSection>   
         <apex:messages >
                <apex:pageBlockSection title="Confirmar Factura" columns="1">
                    <apex:inputField value="{!factura.Pre_impreso_001_001__c}"/>                                               
                    <apex:inputField value="{!factura.Pre_impreso_002_001__c}"/>                           
                    <apex:inputField value="{!factura.Pre_impreso_002_002__c}"/>  
                    <apex:inputField value="{!factura.Pre_impreso_003_001__c}"/>                      
                    <apex:inputField value="{!factura.Esta_seguro__c}" required="true"/>
                </apex:pageBlockSection>           
         </apex:messages>         
            </apex:pageBlock>
        
    </apex:form>
</apex:page>





 
Hello, I want to know how to Test this class? because I'm getting the error of coverage code
 
public class OTPresupuestoControllers {
   
    public List<cOT> cOTList{get;set;} 
    public List<cLdd> cLddList {get; set;}
    public List<cFac> cFacList {get; set;}
    public String otId;
    public String prefacturaId {get; set;}
    
    
    public OTPresupuestoControllers() {    
 
    }

    public String getPreFacturaId(){ 
        return prefacturaId;
    }
    
    public void setPreFacturaId(string PreFacturaId) {    
        prefacturaId = PreFacturaId;  
    }    

    
    public String getOtId(){ 
        return otId;
    }
    
    public void setOtId(string OTId) {    
        otId = OTId;  
        this.cOTList = new List<cOT>();
        for(OT__c o : [SELECT Id, Name, Total_1__c,Total_2__c,Total_3__c,Total_4__c,Total_5__c,
                       Nombre_del_Cliente_ppto__c, Total_a_Pagar__c, Archivo__c, 
                       Forma_de_Pago__c, Requiere_Sena__c,Nombre_de_la_cuenta__c,
                       Pre_Factura__r.Cuenta__r.Ex_Fiscal__c,Cant_1__c,Cant_2__c,Cant_3__c,
                       Cant_4__c,Cant_5__c,Texto_1_fact__c,Texto_2_fact__c,Texto_3_fact__c, 
                       Texto_4_fact__c,Texto_5_fact__c,Texto_largo_1_presup__c,
                       RUC__c,Pre_Factura__r.Tarjeteria__c,Sucursal__c,Firma__c
                       OT__c.Saldo_a_Pagar__c
                       From OT__c Where Id=:otId Limit 1])	
        			   {cOTList.add(new cOT(o));}  
        
        
        this.cLddList = new List<cLdd>();
        for(Linea_de_detalle__c x: [Select Id, Name, Codigo__c, Descripcion_del_Producto__c, Q__c,
                                    P_Unit_Linea__c, Total_Linea__c, Grupo_DP__c, createddate
                                    From Linea_de_detalle__c Where OT__c=:otId ORDER BY createddate])
        							{cLddList.add(new cLdd(x));} 
        
                
        
        this.cFacList = new List<cFac>();
        for(Factura__c z: [Select Id, Name, Saldo_Final__c      
                           From Factura__c Where Pre_Factura__c =:prefacturaId Limit 1])
        				   {cFacList.add(new cFac(z));} 
    }

  
    public class cOT{
        public OT__c OT{get; set;}
        public String totalapagar{get;set;}

        public cOT(OT__c o){
            this.OT = o;
            this.totalapagar= NumberToSpanishWords.convertToGs(o.Total_a_Pagar__c);
            }      
    }
          
    public class cLdd{           
        public Linea_de_detalle__c LDD {get; set;}           
        public string P_Unit_Linea {get; set;}
        public string Total_Linea {get; set;}          
        public string Q {get; set;}
                            
        public cLdd(Linea_de_detalle__c x){                
            this.LDD =  x;                
            this.P_Unit_Linea=NumberToSpanishWords.convertToGs(x.P_Unit_Linea__c);                
            this.Total_Linea=NumberToSpanishWords.convertToGs(x.Total_Linea__c);               
            this.Q=NumberToSpanishWords.convertToEU(x.Q__c);                 
        }
    }
    
  
    public class cFac{           
        public Factura__c FAC {get; set;}           
        public string saldofinal {get; set;}
                            
        public cFac(Factura__c z){                
            this.FAC =  z;                
            this.saldofinal=NumberToSpanishWords.convertToGs(z.Saldo_Final__c);                             
        }
    }     
}



 
Hello, I'm trying to send emails with information from a custom object called OT__c, but when I receive the email has fields in blank and I think is because I'm not connecting correctly the Id of OT__c in apex to the component to the email template.

my email template
<messaging:emailTemplate subject="RE: {!relatedTo.Asunto_email__c}" recipientType="User" relatedToType="OT__c">
<messaging:htmlEmailBody >
        <br/>
        <b><u>MAKER S.A</u></b><br/>
        <b>Nuestra Ref.:</b> &nbsp; <apex:outputText value="{!relatedTo.Name}"/><br/>
        <br/>
        <c:Envio_Email_Componente opptyId="{!relatedTo.Id}"/>
            
</messaging:htmlEmailBody>
</messaging:emailTemplate>



my component
<apex:component controller="OTPresupuestoControllers" access="global" rendered="true">
    <apex:attribute name="opptyId" assignTo="{!otId}" type="String" description="Id OT__c"/>    
     
    <!--just to see if the variable is working-->
     {!otId} {!opptyId}
    
   
    <apex:repeat var="ot" value="{!cOTList}">      
        <div style="font-size:18px;">                    
            <b>Item 1</b>   
        </div>   
        <div style="font-size: 14px;">               	
            <b>Nombre:</b> <apex:outputText value=" {!ot.OT.Nombre_de_la_Cuenta__c}" />     
        </div>
        <div style="font-size: 14px;">               	
            <u>Total Gs.:</u> <apex:outputText value=" {!ot.total1} IVA incl."/>     
        </div>   
        <div style="font-size: 14px;">               		
            <b><apex:outputText value="Total a Pagar Gs.: {!ot.totalapagar} IVA incl."/></b>               
        </div>
        <br/>
        <div style="font-size: 14px;">               	
            <b>Archivo:</b> <apex:outputText value=" {!ot.OT.Archivo__c}"/>    
        </div>          
        <div style="font-size: 14px;">               	
            <b>Plazo de Entrega:</b> <apex:outputText value=" {!ot.OT.Plazo_de_Entrega__c}hs"/>     
        </div>            
        <div style="font-size: 14px;">               	
            <b>Forma de Pago:</b> <apex:outputText value=" {!ot.OT.Forma_de_Pago__c}"/>     
        </div>       
        <div style="font-size: 14px;">               	
            <b>Requiere Seña:</b> <apex:outputText value=" {!ot.OT.Requiere_Sena__c}" />    
        </div>          
    </apex:repeat>   
</apex:component>


my apex
public class OTPresupuestoControllers {
  
    public List<cOT> cOTList{get;set;}
    public String otId {get;set;} //Don't know if this is the correct code

    public OTPresupuestoControllers() {    
        
        //OT List
        this.cOTList = new List<cOT>();
        for(OT__c o : [SELECT Id, Total_1__c, Total_a_Pagar__c, Archivo__c, Plazo_de_Entrega__c,
                       Forma_de_Pago__c, Requiere_Sena__c, Nombre_de_la_cuenta__c
                       From OT__c Limit 1]) //it's not working
        {
            cOTList.add(new cOT(o));
        }                 
        
    }
      
    
    public class cOT{
        public OT__c OT{get; set;}
        public String total1{get;set;}
        public String totalapagar{get;set;}

        public cOT(OT__c o){
            this.OT = o;
            this.total1= NumberToSpanishWords.convertToGs(o.Total_1__c);
            this.totalapagar= NumberToSpanishWords.convertToGs(o.Total_a_Pagar__c);
            } 
        }
}



 
if you see in the image below, the field Nro__c has two squares where I can give them values, I would like to know if there's a way to make this happen in visualforce page?

the Idea is: depending of the picklist Identificador__c , my field Nro__c has to change its look.
is it possible?
User-added image
I have a field text called "Nro_Ruc__c", and I want to save it in different ways depending of the values of a picklist called Identificador__c
Example:
If Identificador__c == RUC
    the Nro_Id__c will be saved like: "12345678-9"
If Identificador__c == CI
    the Nro_Id__c will be saved like: "123.456.789"
If Identificador__c == TEDF
    the Nro_Id__c will be saved like: "12-34-56-78-99"

User-added image
I want to know if there's a way to pass the values that are in that list Linea_de_detalle to a custom field  Texto_Largo__c
My custom object is called OT__c and has a "Master RelationShip" with Linea_de_detalle__c
And I need some of the values of that list pass to a field called Texto Largo _c​

User-added image
I want to know if there's a way to pass the values that are in that list Linea_de_detalle to a custom field  Texto_Largo__c
My custom object is called OT__c and has a "Master RelationShip" with Linea_de_detalle__c
And I need some of the values of that list pass to a field called Texto Largo _c​

User-added image
Hello, I want to know if it is posible to create an autonumber field the looks like this

A-01 to A-99
and then changes the letter B-01 to B-99, C-01


I'm new in this, if there's links with examples where I could see how to do it i'll really appreciate it
thanks, 
David
 
I created a visual email template that works with:
--a custom object called OT__c,
--a visualforce component called OTComponente, and
--an apex class called OTPresupuesto.

My problem is when I receive the email, it has some fields in blank, I think it has to do with the id of the custom object.
Specifically this part:
From OT__c Where Id=:System.currentPagereference().getParameters().get('Id')
when I put in my apex class just the "From OT__c" without specifying my Id, the email I recieve looks like this:
 
Nuestra Ref.:
Sucursal:
Fecha:24/08/2015

Total a Pagar:0,00
Saldo a Pagar:0,00 
Sub Total:0,00
Nombre:
RUC:
Name:

Gracias por elegir Maker!
Saludos Cordiales,
El equipo de Makerxmail


and when I put the "From OT__c Where Id=:System.currentPagereference().getParameters().get('Id')" the email looks like this (​the component doesn't even appear):
Nuestra Ref.:
Sucursal:
Fecha:24/08/2015 


Gracias por elegir Maker!
Saludos Cordiales,
El equipo de Makerxmail






this is my apex class OTPresupuesto
public with sharing class OTPresupuesto {

    public List<fact> factList{get;set;}
      
    //Constructor  
    public OTPresupuesto() {
        this.factList = new List<fact>();
        for(OT__c ot2 :[Select Name, Nombre_de_la_Cuenta__c, Sub_Total__c, RUC__c,
                        Total_a_Pagar__c,Saldo_a_Pagar__c
                        From OT__c Where Id=:System.currentPagereference().getParameters().get('Id')  LIMIT 1])
        {
            factList.add(new fact(ot2));
        }
        
    }       
    
    public class fact{                   
        public OT__c OT{get; set;}                  
        public string saldoPagar {get; set;}
        public string subTotal {get; set;}
        public string totalPagar {get; set;}
                   
        public fact(OT__c ot2){                           
            this.OT = ot2;                           
            this.saldoPagar= NumberToSpanishWords.convertToEU(ot2.Saldo_a_Pagar__c);  
            this.subTotal= NumberToSpanishWords.convertToEU(ot2.Sub_Total__c);
            this.totalPagar= NumberToSpanishWords.convertToEU(ot2.Total_a_Pagar__c);
        }   
    }     
}



and my visual component OTComponente
<apex:component controller="OTPresupuesto" access="global">
        
        <apex:repeat var="as" value="{!factList}">               
                Total a Pagar: <apex:outputText value="{!as.totalPagar}"/><br/>
                Saldo a Pagar: <apex:outputText value="{!as.saldoPagar}"/> <br/> 
                Sub Total: <apex:outputText value="{!as.subTotal}"/><br/> 
                Nombre: <apex:outputText value="{!as.OT.Nombre_de_la_Cuenta__c}"/><br/>
                RUC: <apex:outputText value="{!as.OT.RUC__c}"/>  <br/>
                Name: <apex:outputText value="{!as.OT.Name}"/>   <br/>   
        </apex:repeat>    
</apex:component>


this is my visual email template called EnvioPresupTemaplate
<messaging:emailTemplate subject="RE: {!relatedTo.Asunto_email__c}" recipientType="User" relatedToType="OT__c">
<messaging:htmlEmailBody >       
    <br/>
    <b>Nuestra Ref.:</b><apex:outputText value="{!relatedTo.Name}"/><br/>
    
    Sucursal:<apex:outputField value="{!relatedTo.Sucursal__c}"/><br/> 
    Fecha:<apex:outputField value="{!relatedTo.Fecha__c}"/><br/>
    
    <br/><c:OTComponente />
    <br/>
    <br/>
    Gracias por elegir Maker!<br/>
    Saludos Cordiales,<br/>
    El equipo de Makerxmail
</messaging:htmlEmailBody>
</messaging:emailTemplate>





 
Hi all,
I am trying to know how to convert text to number but from the 5th value.
I know that "value(Text__c)" converts it to number
example:
Text__c: 00101100
If a use the formula "value(Text__c)" this will deploy 101.100
but I would like to deploy 100

how can I do that? any example would be realy nice

thanks
Hi,


I want that output label - "How many sub-projects" and input field be visible only when radio button "yes" is checked, otherwise invisible. How can I do it in VF


Thanks.

Please refer to code
<apex:pageBlockSection title="Project Details">
    
       <apex:panelGrid columns="2">
        <apex:outputLabel value="Project Name" for="gprojectName"/>
        <apex:inputField id="gprojectName" value="{!gproject.name}"/>
       </apex:panelGrid>
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Decision">
       <apex:panelGrid columns="2">
          <apex:outputLabel value="Does it have sub-project(s)?" 
                           for="radiobtn"/>
          <apex:selectRadio id="radiobtn">
          <apex:selectOption id="radiobtn1" itemLabel="No" itemValue="1"></apex:selectOption>
          <apex:selectOption id="radiobtn2" itemLabel="Yes" itemValue="2"></apex:selectOption>
          </apex:selectRadio>
              
              <apex:outputLabel id="labid" value="How many sub-projects" for="gsubproject"/>
              <apex:inputField id="gsubproject" value="{!gproject.sub}"/>
                       
       </apex:panelGrid>
      </apex:pageBlockSection>

 
Hello there,

I am having trouble using a controller extension, I don't seem to be able to get the record Id from the visualforce page.

I keep getting the error:
The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores.

What I don't understand is that my VF Page is one word and does not have underscores or spaces.

Here is the VF Page:

<apex:page standardController="Account" recordSetVar="accounts" extensions="AccountActionCodes">
    {!$CurrentPage.parameters.Id}
     <apex:pageBlock title="Viewing Accounts">
        <apex:form id="theForm">
            <apex:pageBlockSection >
                <apex:dataList value="{!AccountActionCodes}" var="acct" type="1">
                    {!acct.name}
                </apex:dataList>
            </apex:pageBlockSection>
            <apex:panelGrid columns="2">
                <apex:commandLink action="{!previous}">Previous</apex:commandlink>
                <apex:commandLink action="{!next}">Next</apex:commandlink>
            </apex:panelGrid>
        </apex:form>
    </apex:pageBlock>
</apex:page>

And here is the controller extension:

public with sharing class AccountActionCodes {
    private final Account acct;  
    //create a private local handle for the standard controller
    private ApexPages.StandardSetController ctrl;


    // The constructor passes in the standard controller defined
    // in the markup below
    public AccountActionCodes(ApexPages.StandardSetController ctrlParam) {
        //assign from the passed in controller
        ctrl = ctrlParam;
    }    
    
    public List<Account> getAccountActionCodes() {
        Account theAccount = (Account)ctrl.getRecord();
        Id accountId = ApexPages.CurrentPage().getparameters().get('id');
        System.debug('Account id = ' + accountId);
    
        List<Account> accList = [SELECT Name FROM Account WHERE Id = :accountId]; 
         
        return accList;
    }
      
}

If I hardcode an Account Id in the SELECT query it works fine, but when it needs to get the Account Id from the VF Page it always sends the error message.

Any help appreciated...

 
Hello,
I want to know if it's possible to create a trigger that let a number field goes only in a consecutive order,
this custome field must not be Auto-Number field because it has to be entered

Example:
the user entered a value in the number field PRE_IMPRESO__c between 001 to 100

PreImpreso: 001
PreImpreso: 002
If I try to enter 004 and 003 was not entered yet, I get the error "Pre-Impreso isn't going in consecutive order"


I would really appreciate any kind of example
thanks
Hello,

I created visualforce that converts the page to PDF..

I have 2 pages, both are using the Same controller (where my image URL is located) and both have the same code except the second 1 is rendered as PDF. The 1st page serves as a Preview before converting it to PDF format.


The PDF format image shows like this one below.

User-added image

Below is how I call the URL from the Controller (which the same way I call it from the preview and it's working)

I have this one from the Controller : imageURL = '/servlet/servlet.ImageServer?id=01555000000fdlO&oid=00D5500000066Iu&lastMod=1445545410000';

Then I call it from the PDF Rendered VF like this.
 
<table style="border: 1px solid white;" width="100%">
                     <tr>
                        <td style="border-color:white" width="80px" >
                            <apex:image url="{!imageURL}" />
                        </td>
                        <td style="border-color:white; text-align:left;" width="70%">
                            <font face="calibri" color="black" size="10"><h2>Traffic Control Form</h2></font>
                        </td>
                    </tr>
                </table>

Not sure where else to look so I decided to ask.

Thank you!

-Zach

 
Hi Everyone, 

I have written many VS email template that include Opportunities and Opportunity Line Items. However, I am struggling when it comes to writing a VS email template that includes Opportunity, Opportunity Line Items, and Contact Role. 

Does anyone have a sample VS email and Apex Controller Component that would accomplish something similar? All I have been able to find online is example where they are querying the entire system in the controller (i.e. All acounts that have the word "Smith"). That is not what i am looking for- I am looking to query based on a records related to a SPECIFIC Opportunity. 

Any help would be greatly appreciated. 
Hello, I want to know if it's possible to create a validation rule to let a number field be created only in a consecutive order
Example: (001 to 100)
PreImpreso 001
PreImpreso 002
If I try to enter 004 and 003 it was not entered yet, I get the error "number isn't going in consecutive order"
 
I am new at developing VF pages and something that seems pretty basic, I can't find documentation on how to do it.  

I would like to place a custom button on the detail page of an custom object record.  The button would call a VF page that I create to display and edit some fields in that record.  The documentation indicates that I need to append the query parameter to the page url that specifies the ID of the record.  

If I define the button as a link to this url, it will always refer to the same record.  I want the button to refer to the record of the detial page I am currently viewing. This implies that there must be a way to pass the record ID to the VP but I can't seem to find out how.  Very frustrating.

Can anyone help?  Thanks  

 

pagereference parentpage=new pagereference('/'+id);
i tried like above and below
 
return new ApexPages.StandardController(oldtisdetails).view();

both are not working please help me..
This is a "trigger" that doesn't allow duplicate values of the field Pre_Impreso 003_001 _c
trigger MensajeValorDuplicado on Factura__c (before insert, before update) {
    
    Map<Decimal, Factura__c> facMap = new Map<Decimal, Factura__c>();

    For (Factura__c facturarecoleta : System.Trigger.new) {     
        If ((facturarecoleta.Pre_impreso_003_001__c != null) && (System.Trigger.isInsert)){            
            facMap.put(facturarecoleta.Pre_impreso_003_001__c, facturarecoleta);                
        }                  
    }
  
    For (Factura__c facturarecoleta : [SELECT Id, Name, Sucursal__c, Pre_impreso_003_001__c FROM Factura__c WHERE Pre_impreso_003_001__c IN :facMap.KeySet()]){
        If (facturarecoleta.Sucursal__c=='Maker Recoleta'){
            Factura__c newFactura = facMap.get(facturarecoleta.Pre_impreso_003_001__c);
            newFactura.addError('El #Pre-Impreso(003-001) ingresado ya fue utilizado en la Factura', false);
        }
    } 
}

I tried to test this trigger but isn't allowing me to save because of the @isTest 
error: unexpected token: @
Also I changed the version of the trigger but still doesn't work

my trigger test (I don't know why isn't recognizing the @isTest)
@isTest
private class MensajeValorDuplicadoTest {
    static testMethod void TestMensajeValorDuplicado() {
   
       Test.startTest();
      
       Map<Decimal, Factura__c> facMap = new Map<Decimal, Factura__c>();
       Factura__c facturas = new Factura__c();
       //insert factura;

       For (Factura__c factura: [Select ID, Name, Pre_Impreso_003_001__c, Sucursal__c, Caja__c From Factura__c WHERE Pre_impreso_003_001__c IN :facMap.KeySet()]){
           System.debug('factura name' + factura.Name);
           System.assertEquals('factura name',factura.name);
           System.debug(555555 + factura.Pre_Impreso_003_001__c);
           System.assertEquals(55555,factura.Pre_Impreso_003_001__c);    
           System.debug('Caja 1' + factura.Caja__c);
           System.assertEquals('Caja 1',factura.Caja__c);   
           System.debug('Maker Centro' + factura.Sucursal__c);
           System.assertEquals('Maker Centro',factura.Sucursal__c);            
      }
    
       Test.stopTest();
    }
}

 
Hi
The Save button n my VF Form is not returning to the VIew Page so it is not obviouse that the record has saved. This is the controller code
    public PageReference save(){
        try{            
            
            upsert editItem;
                        
            system.debug(BusUnits.keyset());
                        
            for(String key:BusUnits.keyset()){
                if(BusUnits.get(key) == true){
                    tempMarketItem = MarketItems.get(key);
                    system.debug(tempMarketItem);
                    if(tempMarketItem.Items__c == null){
                        tempMarketItem.Items__c = editItem.id;
                    }
                    tempMarketItem.Business_Unit__c = key;
                    system.debug(tempMarketItem);                    
                    MarketItems.put(key, tempMarketItem);
                    upsert MarketItems.get(key);
                    for(integer i : numberOfDates.get(key)){
                        if((i < numberOfDates.get(key).size()) && (effectiveDates.get(key).get(i).Effective_Date__c != null)){
                            
                            tempED = new Effective_Date__c();
                            tempED = effectiveDates.get(key).get(i);
                            if(tempED.Market_Item__c == null){
                              tempED.Market_Item__c = MarketItems.get(key).Id;  
                            } 
                            effectiveDates.get(key).put(i, tempED);
                            upsert effectiveDates.get(key).get(i);
                        }
                        
                    }
                }    
                system.debug('BusUnitsOld' +BusUnitsOld);
                system.debug('BusUnits' +BusUnits);                
                if((MarketItems.get(key).Business_Unit__c == key) && (BusUnits.get(key) == false)){
                    delete MarketItems.get(key);
                }       
            }
                        
            PageReference home = new PageReference('/'+editItem.id);
            
            home.setRedirect(true);
            return home;
            
        }
        catch (Exception ex){
            ApexPages.addMessages(ex);
            system.debug(ex);
            return null;
        }
    }


And teh Form code
<apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="Save" id="theButton"/>        
        </apex:pageBlockButtons>
I am working with a trigger, apex and a visualforce page,
trying to display in my vfpage the error of duplicate values, and it works kind of.
The error message appears in my visual, but it is giving me all the records created in my Factura__c
and not the one of duplicate value. I think is because my trigger it not working well
Example:

In the top of my visual is showing me 3 errors and that is because there 3 records created in my Factura__c
and the only one that it should be displaying it is in the red box.

My object is Factura__c and the custom field that it should not have duplicate values is called Pre_impreso_001_001__c

User-added image


my trigger
trigger MensajeValorDuplicadoCentro on Factura__c (before insert, before update) {

    Map<Decimal, Factura__c> facMap = new Map<Decimal, Factura__c>();

    For (Factura__c factura : System.Trigger.new) {     
        If ((factura.Pre_impreso_001_001__c != null) && (System.Trigger.isInsert ||
        (factura.Pre_impreso_001_001__c != System.Trigger.oldMap.get(factura.Id).Pre_impreso_001_001__c))){            
            facMap.put(factura.Pre_impreso_001_001__c, factura);                
        }                  
    }
  

    For (Factura__c factura : [SELECT Id, Name, Sucursal__c FROM Factura__c]) {  		
        If (factura.Sucursal__c=='Maker Centro'){      	
            For (Factura__c facturace : [SELECT Pre_impreso_001_001__c FROM Factura__c WHERE Pre_impreso_001_001__c IN :facMap.KeySet()]) {                                                                
                Factura__c newFactura = facMap.get(facturace.Pre_impreso_001_001__c);                  
                newFactura.addError('El #Pre-Impreso(001-001) ingresado ya fue utilizado en la Factura:<a href=\'https://cs21.salesforce.com/'+factura.Id+'\'>'+factura.Name+'</a>', false);           
            }       	
        } 
    } 

}


my visual
<apex:page controller="FacturaRapidaController" tabStyle="Factura__c">  
    <script>     
    function confirmarCancelar() {           
        var isCancel = confirm("Estas seguro que desea cancelar la creación de Factura?");        
        if (isCancel)return true;    
        return false;
    } 
    </script>     
    <apex:sectionHeader title="Creación de" subtitle="FACTURA"/>                  
    <apex:form >      
        <apex:pageBlock mode="edit" title="Crear Factura Contado">                
                         
          	<div style="font-size: 12px; color:#FF0000;">                                                                                              
        		<apex:pageMessages id="errMessages" escape="false"/>                                                                  
    		</div>    
            <apex:pageBlockButtons >                          
                <apex:commandButton action="{!guardarFactura}" value="Guardar"/>                                
                <apex:commandButton action="{!cancelarFactura}" value="Cancelar" onclick="return confirmarCancelar()" immediate="true"/>                      
            </apex:pageBlockButtons> 
            
            <apex:pageBlockSection title="Información Básica de la Factura" columns="1">                                     
                <apex:inputField value="{!factura.Pre_Factura__c}"/>                 
                <apex:inputField value="{!factura.Sucursal__c}" required="true"/>                
                <apex:inputField value="{!factura.Caja__c}" required="true"/>                        
                <apex:inputField value="{!factura.Serie__c}" required="true"/>                
            </apex:pageBlockSection>   
                                 
            <apex:pageBlockSection title="Confirmar Factura" columns="1">            
                <apex:inputField value="{!factura.Pre_impreso_001_001__c}"/>                                                                                                                  
            </apex:pageBlockSection>                                      
        </apex:pageBlock>       
    </apex:form>
</apex:page>



my apex
public PageReference guardarFactura(){                  
        try{ 
            insert factura; 
        }
        catch(exception ex) {  
            ApexPages.addMessages(ex);
            return null;
        }

        PageReference FacturaRapidaPage = new ApexPages.StandardController(factura).view();
        FacturaRapidaPage.setRedirect(true);
        return FacturaRapidaPage;
    }




 
Hello, I want to know how to Test this class? because I'm getting the error of coverage code
 
public class OTPresupuestoControllers {
   
    public List<cOT> cOTList{get;set;} 
    public List<cLdd> cLddList {get; set;}
    public List<cFac> cFacList {get; set;}
    public String otId;
    public String prefacturaId {get; set;}
    
    
    public OTPresupuestoControllers() {    
 
    }

    public String getPreFacturaId(){ 
        return prefacturaId;
    }
    
    public void setPreFacturaId(string PreFacturaId) {    
        prefacturaId = PreFacturaId;  
    }    

    
    public String getOtId(){ 
        return otId;
    }
    
    public void setOtId(string OTId) {    
        otId = OTId;  
        this.cOTList = new List<cOT>();
        for(OT__c o : [SELECT Id, Name, Total_1__c,Total_2__c,Total_3__c,Total_4__c,Total_5__c,
                       Nombre_del_Cliente_ppto__c, Total_a_Pagar__c, Archivo__c, 
                       Forma_de_Pago__c, Requiere_Sena__c,Nombre_de_la_cuenta__c,
                       Pre_Factura__r.Cuenta__r.Ex_Fiscal__c,Cant_1__c,Cant_2__c,Cant_3__c,
                       Cant_4__c,Cant_5__c,Texto_1_fact__c,Texto_2_fact__c,Texto_3_fact__c, 
                       Texto_4_fact__c,Texto_5_fact__c,Texto_largo_1_presup__c,
                       RUC__c,Pre_Factura__r.Tarjeteria__c,Sucursal__c,Firma__c
                       OT__c.Saldo_a_Pagar__c
                       From OT__c Where Id=:otId Limit 1])	
        			   {cOTList.add(new cOT(o));}  
        
        
        this.cLddList = new List<cLdd>();
        for(Linea_de_detalle__c x: [Select Id, Name, Codigo__c, Descripcion_del_Producto__c, Q__c,
                                    P_Unit_Linea__c, Total_Linea__c, Grupo_DP__c, createddate
                                    From Linea_de_detalle__c Where OT__c=:otId ORDER BY createddate])
        							{cLddList.add(new cLdd(x));} 
        
                
        
        this.cFacList = new List<cFac>();
        for(Factura__c z: [Select Id, Name, Saldo_Final__c      
                           From Factura__c Where Pre_Factura__c =:prefacturaId Limit 1])
        				   {cFacList.add(new cFac(z));} 
    }

  
    public class cOT{
        public OT__c OT{get; set;}
        public String totalapagar{get;set;}

        public cOT(OT__c o){
            this.OT = o;
            this.totalapagar= NumberToSpanishWords.convertToGs(o.Total_a_Pagar__c);
            }      
    }
          
    public class cLdd{           
        public Linea_de_detalle__c LDD {get; set;}           
        public string P_Unit_Linea {get; set;}
        public string Total_Linea {get; set;}          
        public string Q {get; set;}
                            
        public cLdd(Linea_de_detalle__c x){                
            this.LDD =  x;                
            this.P_Unit_Linea=NumberToSpanishWords.convertToGs(x.P_Unit_Linea__c);                
            this.Total_Linea=NumberToSpanishWords.convertToGs(x.Total_Linea__c);               
            this.Q=NumberToSpanishWords.convertToEU(x.Q__c);                 
        }
    }
    
  
    public class cFac{           
        public Factura__c FAC {get; set;}           
        public string saldofinal {get; set;}
                            
        public cFac(Factura__c z){                
            this.FAC =  z;                
            this.saldofinal=NumberToSpanishWords.convertToGs(z.Saldo_Final__c);                             
        }
    }     
}



 
Hello, I'm trying to send emails with information from a custom object called OT__c, but when I receive the email has fields in blank and I think is because I'm not connecting correctly the Id of OT__c in apex to the component to the email template.

my email template
<messaging:emailTemplate subject="RE: {!relatedTo.Asunto_email__c}" recipientType="User" relatedToType="OT__c">
<messaging:htmlEmailBody >
        <br/>
        <b><u>MAKER S.A</u></b><br/>
        <b>Nuestra Ref.:</b> &nbsp; <apex:outputText value="{!relatedTo.Name}"/><br/>
        <br/>
        <c:Envio_Email_Componente opptyId="{!relatedTo.Id}"/>
            
</messaging:htmlEmailBody>
</messaging:emailTemplate>



my component
<apex:component controller="OTPresupuestoControllers" access="global" rendered="true">
    <apex:attribute name="opptyId" assignTo="{!otId}" type="String" description="Id OT__c"/>    
     
    <!--just to see if the variable is working-->
     {!otId} {!opptyId}
    
   
    <apex:repeat var="ot" value="{!cOTList}">      
        <div style="font-size:18px;">                    
            <b>Item 1</b>   
        </div>   
        <div style="font-size: 14px;">               	
            <b>Nombre:</b> <apex:outputText value=" {!ot.OT.Nombre_de_la_Cuenta__c}" />     
        </div>
        <div style="font-size: 14px;">               	
            <u>Total Gs.:</u> <apex:outputText value=" {!ot.total1} IVA incl."/>     
        </div>   
        <div style="font-size: 14px;">               		
            <b><apex:outputText value="Total a Pagar Gs.: {!ot.totalapagar} IVA incl."/></b>               
        </div>
        <br/>
        <div style="font-size: 14px;">               	
            <b>Archivo:</b> <apex:outputText value=" {!ot.OT.Archivo__c}"/>    
        </div>          
        <div style="font-size: 14px;">               	
            <b>Plazo de Entrega:</b> <apex:outputText value=" {!ot.OT.Plazo_de_Entrega__c}hs"/>     
        </div>            
        <div style="font-size: 14px;">               	
            <b>Forma de Pago:</b> <apex:outputText value=" {!ot.OT.Forma_de_Pago__c}"/>     
        </div>       
        <div style="font-size: 14px;">               	
            <b>Requiere Seña:</b> <apex:outputText value=" {!ot.OT.Requiere_Sena__c}" />    
        </div>          
    </apex:repeat>   
</apex:component>


my apex
public class OTPresupuestoControllers {
  
    public List<cOT> cOTList{get;set;}
    public String otId {get;set;} //Don't know if this is the correct code

    public OTPresupuestoControllers() {    
        
        //OT List
        this.cOTList = new List<cOT>();
        for(OT__c o : [SELECT Id, Total_1__c, Total_a_Pagar__c, Archivo__c, Plazo_de_Entrega__c,
                       Forma_de_Pago__c, Requiere_Sena__c, Nombre_de_la_cuenta__c
                       From OT__c Limit 1]) //it's not working
        {
            cOTList.add(new cOT(o));
        }                 
        
    }
      
    
    public class cOT{
        public OT__c OT{get; set;}
        public String total1{get;set;}
        public String totalapagar{get;set;}

        public cOT(OT__c o){
            this.OT = o;
            this.total1= NumberToSpanishWords.convertToGs(o.Total_1__c);
            this.totalapagar= NumberToSpanishWords.convertToGs(o.Total_a_Pagar__c);
            } 
        }
}



 
I have a field text called "Nro_Ruc__c", and I want to save it in different ways depending of the values of a picklist called Identificador__c
Example:
If Identificador__c == RUC
    the Nro_Id__c will be saved like: "12345678-9"
If Identificador__c == CI
    the Nro_Id__c will be saved like: "123.456.789"
If Identificador__c == TEDF
    the Nro_Id__c will be saved like: "12-34-56-78-99"

User-added image
Hello, I want to know if it is posible to create an autonumber field the looks like this

A-01 to A-99
and then changes the letter B-01 to B-99, C-01


I'm new in this, if there's links with examples where I could see how to do it i'll really appreciate it
thanks, 
David
 
Hello there, I'm trying to use an approval process to send emails to my customers.
But the email that I received has fields values as blank, does someone know why?

my approval process has an "email alert" and that email alert has a visualforce email template.
my vf email template
<messaging:emailTemplate subject="{!relatedTo.Asunto_email__c}" recipientType="User" relatedToType="OT__c">
    <messaging:htmlEmailBody >
        Buenos Días<br/><br/>
        
        
        Le envío el presupuesto solicitado:<br/><br/>  
        <c:Envio_Email_Componente />
   </messaging:htmlEmailBody>
</messaging:emailTemplate>
And I receive the email like this:
Buenos Días

Le envío el presupuesto solicitado:

Item 1

Total Gs.: IVA incl.
Total a Pagar Gs.: IVA incl.
Opcional costo de Delivey (Asunción) Gs.: 7.000 IVA incl. (Confirmar Servicio)
Archivo: 
Plazo de Entrega:  hs después de la confirmación
Forma de Pago: 
Requiere Seña: 


And It supposed to look like this:
Buenos Días

Le envío el presupuesto solicitado:

Item 1
tarjetas personales, 9x5cm, impresion digital color, una sola cara, papel ilustracion mate 300g.
Total Gs.: 312.000 IVA incl.
Total a Pagar Gs.: 312.000 IVA incl.
Opcional costo de Delivey (Asunción) Gs.: 7.000 IVA incl. (Confirmar Servicio)
Archivo: Ok
Plazo de Entrega: 24hs después de la confirmación
Forma de Pago: Contado
Requiere Seña: No (100% contra entrega)





my visualforce email template:
 
<apex:component controller="OTPresupuestoControllers" access="global">
    
<apex:repeat var="ot" value="{!cOTList}">
    <table>
        <tr>
            <td><b>Item 1</b></td>
        </tr>
        <tr>
            <td><apex:outputText value="{!ot.OT.Texto_1_fact__c}"/></td>
        </tr>
         <tr>
           <td><apex:outputText value="{!ot.OT.Texto_largo_1_presup__c}"/></td> 
        </tr>
        <tr>
            <td><u>Total Gs.:</u>
                <apex:outputText value=" {!ot.total1} IVA incl."/>
            </td>     
        </tr>

        <tr>
            <td><b><apex:outputText value="Item 2"/></b></td>
        </tr>
        <tr>
            <td><apex:outputText value="{!ot.OT.Texto_2_fact__c}"/></td>
        </tr>
        <tr>
            <td><apex:outputText value="{!ot.OT.Texto_largo_2_presup__c}"/></td>
        </tr>
        <tr>
            <td><u><apex:outputText value="Total Gs.:"/></u>
                <apex:outputText value=" {!ot.total2} IVA incl.""/>
            </td>     
        </tr>

  
        <tr>
            <td><b>
                <apex:outputText value="Total a Pagar Gs.: {!ot.totalapagar} IVA incl.""/>
                </b>
            </td> 
        </tr>  



        <tr>
             <td><b>Archivo: </b> <apex:outputText value=" {!ot.OT.Archivo__c}" /></td>     
        </tr>
        <tr>
             <td><b>Plazo de Entrega: </b> <apex:outputText value=" {!ot.OT.Plazo_de_Entrega__c}hs después de la confirmación" /></td> 
        </tr>
        <tr>
             <td><b>Forma de Pago: </b> <apex:outputText value=" {!ot.OT.Forma_de_Pago__c}" /></td> 
        </tr>
        <tr>
             <td><b>Requiere Seña: </b> <apex:outputText value=" {!ot.OT.Requiere_Sena__c}" /></td> 
        </tr>


</table>
</apex:repeat>
            
</apex:component>