• Agustín Medina
  • NEWBIE
  • 0 Points
  • Member since 2016
  • Software developer.

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
I'm trying to use CPQ objects calling to Template Content in order to render it in a custom PDF but when I'm trying to display the SBQQ__RawMarkup__c field, the variables of quote record are displayed as plain text ( {!object.field} ), not the value of the record.

How can I reuse the CPQ template content?
Is it possible to escape the field except the apex variables in the visualforce {!variable}?

Heres my code and some pics.

Visualforce
<apex:page controller="PDFTestCtrl" showHeader="false" sidebar="false" standardStylesheets="false" renderAs="PDF" >
    {!quote.Name}
    <br/>
    {!templateSections.SBQQ__Content__r.Name} 
    <br/>
    <apex:outputtext value="{!templateSections.SBQQ__Content__r.SBQQ__RawMarkup__c}" escape="false"/>
</apex:page>

Controller
public class PDFTestCtrl {

    public SBQQ__Quote__c quote {get; set;}
    public SBQQ__TemplateSection__c templateSections {get; set;}
    
    Id quoteId;

    public PDFTestCtrl () {
        //'qid' is sent by CPQ Quote Template
        quoteId = (Id) ApexPages.currentPage().getParameters().get('id');
        
        // Quote
        quote = [SELECT Id, Name,  SBQQ__QuoteTemplateId__c FROM SBQQ__Quote__c WHERE id =: quoteId];

        templateSections = [SELECT Id, Name, SBQQ__Content__c, SBQQ__Content__r.Name, SBQQ__Content__r.SBQQ__RawMarkup__c FROM SBQQ__TemplateSection__c WHERE SBQQ__Template__c =: quote.SBQQ__QuoteTemplateId__c AND Name = 'Heading'];
        
    }

}
Template record
Template object with apex references
PDF
PDF with the plain text variables
Greetings!
Hello,

I made a site where a non salesforce user can enter and change the status of a case but the problem is when the visior try to enter, appears the 'authorization required' error.
How can I fix it?
Hello, 

When I opened an Account, next the Name field was an option, 'Hierachy', if I click, it redirected me to a page where I was able to change the hierarchy but some day the option to change it disappeared, how can I make it appear again?
User-added imageUser-added image
Hello all there
I want to send an email to the case contact but the contact is not a salesforce user.
The email must have two buttons, Accept and Decline, and depending on which button they click, update the object.
It's like the survey function.
 
I'm developing a visualforce which after query an opportunity displays a modal and the modal has a button to close itself but I want to close it automatically, does anyone knows how to do it?

My apex code is 
public without sharing class RegistroCitas {
	
    Public String correo{get; set;}
    Public List<Account> cuenta = new List<Account>();
    Public List<Oportunidad_Univer__c> oportunidad = new List<Oportunidad_Univer__c>();
	Public PageReference pageRef = ApexPages.currentPage();
    public boolean displaySuccesPopup {get; set;}
    public boolean displayFailedPopup {get; set;}
    public boolean boleano {get; set;}
    
    public RegistroCitas(){
        displaySuccesPopup = false;
        displayFailedPopup = false;
    }
    
    public PageReference registrarCita(){
        cuenta = [SELECT Acc_Asistio__c FROM Account WHERE PersonEmail =: correo];
        if(cuenta.isEmpty()){
            displayFailedPopup = true;
            correo = '';
            return null;
        }else{
            //Si hay cuenta
            oportunidad = [SELECT Id, Name, Opp_Atendio_cita__c ,CreatedDate FROM Oportunidad_Univer__c WHERE Opp_Cuenta__c =: cuenta[0].Id ORDER BY CreatedDate DESC LIMIT 1];
            if(oportunidad.size() < 1){
                displayFailedPopup = true;
                correo = '';
                return null;
            }else{
             	oportunidad[0].Opp_Atendio_cita__c = True;
            	cuenta[0].Acc_Asistio__c = True;
            	update oportunidad;
            	update cuenta;	
                displaySuccesPopup = true;
                correo = '';
            	return pageRef; 
            }
        }
    }
    
    public void closePopup(){
        displaySuccesPopup = false;
        displayFailedPopup = false;
    }
}

and te visualforce is 
<apex:page>
	<apex:form >
		<div class="container">
            <div class="cabecera centrado">
                <div class="imagen">
                    <apex:image url="{!URLFOR($Resource.images, 'images/logoUniver-Blanco.png')}" width="500" height="100" />
                </div>
            </div>
            <div class="margen centrado">
				<h1 class="grande">Registro para Citas Agendadas</h1>
                <p><u>Favor de ingresar su correo electrónico</u></p>
                <apex:inputText value="{!correo}"/><br/>
                <br/>
            	<apex:commandButton value="Enviar" action="{!registrarCita}"/>
            </div>  
		</div>
	</apex:form>
    
    <apex:form >
        <apex:outputPanel id="tstpopup">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displaySuccesPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displaySuccesPopUp}">
                ¡Tu cita ha quedado registrada! :)<br/><br/><br/>
                <apex:commandButton value="Cerrar" action="{!closePopup}" rerender="tstpopup"/>
            </apex:outputPanel>
            <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayFailedPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayFailedPopUp}">
                No se encontró su cita, favor de buscar asistencia de parte de nuestro equipo en recepción.<br/><br/><br/>
                <apex:commandButton value="Cerrar" action="{!closePopup}" rerender="tstpopup"/>
            </apex:outputPanel>
        </apex:outputPanel>
 
    </apex:form>
</apex:page>

 
Hello, 

When I opened an Account, next the Name field was an option, 'Hierachy', if I click, it redirected me to a page where I was able to change the hierarchy but some day the option to change it disappeared, how can I make it appear again?
User-added imageUser-added image
I'm developing a visualforce which after query an opportunity displays a modal and the modal has a button to close itself but I want to close it automatically, does anyone knows how to do it?

My apex code is 
public without sharing class RegistroCitas {
	
    Public String correo{get; set;}
    Public List<Account> cuenta = new List<Account>();
    Public List<Oportunidad_Univer__c> oportunidad = new List<Oportunidad_Univer__c>();
	Public PageReference pageRef = ApexPages.currentPage();
    public boolean displaySuccesPopup {get; set;}
    public boolean displayFailedPopup {get; set;}
    public boolean boleano {get; set;}
    
    public RegistroCitas(){
        displaySuccesPopup = false;
        displayFailedPopup = false;
    }
    
    public PageReference registrarCita(){
        cuenta = [SELECT Acc_Asistio__c FROM Account WHERE PersonEmail =: correo];
        if(cuenta.isEmpty()){
            displayFailedPopup = true;
            correo = '';
            return null;
        }else{
            //Si hay cuenta
            oportunidad = [SELECT Id, Name, Opp_Atendio_cita__c ,CreatedDate FROM Oportunidad_Univer__c WHERE Opp_Cuenta__c =: cuenta[0].Id ORDER BY CreatedDate DESC LIMIT 1];
            if(oportunidad.size() < 1){
                displayFailedPopup = true;
                correo = '';
                return null;
            }else{
             	oportunidad[0].Opp_Atendio_cita__c = True;
            	cuenta[0].Acc_Asistio__c = True;
            	update oportunidad;
            	update cuenta;	
                displaySuccesPopup = true;
                correo = '';
            	return pageRef; 
            }
        }
    }
    
    public void closePopup(){
        displaySuccesPopup = false;
        displayFailedPopup = false;
    }
}

and te visualforce is 
<apex:page>
	<apex:form >
		<div class="container">
            <div class="cabecera centrado">
                <div class="imagen">
                    <apex:image url="{!URLFOR($Resource.images, 'images/logoUniver-Blanco.png')}" width="500" height="100" />
                </div>
            </div>
            <div class="margen centrado">
				<h1 class="grande">Registro para Citas Agendadas</h1>
                <p><u>Favor de ingresar su correo electrónico</u></p>
                <apex:inputText value="{!correo}"/><br/>
                <br/>
            	<apex:commandButton value="Enviar" action="{!registrarCita}"/>
            </div>  
		</div>
	</apex:form>
    
    <apex:form >
        <apex:outputPanel id="tstpopup">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displaySuccesPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displaySuccesPopUp}">
                ¡Tu cita ha quedado registrada! :)<br/><br/><br/>
                <apex:commandButton value="Cerrar" action="{!closePopup}" rerender="tstpopup"/>
            </apex:outputPanel>
            <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayFailedPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayFailedPopUp}">
                No se encontró su cita, favor de buscar asistencia de parte de nuestro equipo en recepción.<br/><br/><br/>
                <apex:commandButton value="Cerrar" action="{!closePopup}" rerender="tstpopup"/>
            </apex:outputPanel>
        </apex:outputPanel>
 
    </apex:form>
</apex:page>