• Admin Factor
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 4
    Replies
Since last Thursday when we changed the Salesforce domain to our-company-name, users are experimenting an untraceable error in Salesforce:
Task:
User-added image
Opportunity:
User-added image
Throughout the day, they are getting a message like “The page you sent was not valid for your session. Update your page and try again.” (I am attaching two pictures in Spanish). They have to cancel the edition, update the page and try again, and then it works.

We have never seen it before; there is no information in our Developer Console log. Can anybody help us?

Thank you!
Hey everyone,

Today, I tried to use an old web service that was working for a long time. The last time I checked was 3 weeks ago and now it seems that is not working now. I do not know if the problem is data:application/pdf;base64 or it is a firewall problem. The Visualforce Page is trying to go to the PageReference all the time and it does not stop loading (with the gif symbol non-stop).

This is my code:
ApexClass "ShowFacturas":
global class ShowFacturas {
   
   // Other functions

    public static PageReference verFactura() {
        String web = 'data:application/pdf;base64,' + getFactura(ApexPages.currentPage().getParameters().get('codigoFactura'));
        PageReference pg = new PageReference(web);
        pg.setRedirect(true); 
        return pg;
    }
    
    webservice static String getFactura(String codigoDeFactura) {
        String theResult; 
        try { 
          infoFactura.customWSResponse customResponse = new infoFactura.customWSResponse(); 
          infoFactura.InfoFacturaPort infoFacturaPort = new infoFactura.InfoFacturaPort(); 
          infoFactura.getFactura factura = new InfoFactura.getFactura(); 
          customResponse = infoFacturaPort.getFactura(codigoDeFactura); 
          theResult = String.valueOf(customResponse.result); 
        } catch (System.Exception ex) { 
          ApexPages.addMessages(ex); return null; 
        } 
      return theResult;
    }
}
Visualforce Page "FacturasVP":
<apex:page controller="ShowFacturas" sidebar="false" showHeader="false">
    <head>
    	<style> 
            html, body, p { font-family: sans-serif; }
    	</style>
    </head>
    <body>
        <center>
            <h1>Listado de Facturas</h1>
            <apex:form >
            	<apex:pageBlock >
                	<apex:pageBlockTable value="{!FacturasMethod}" var="i">
                        <apex:column headerValue="Link" style="{!IF(i.saldovivo > 0, 'background-color:#E77878;', '')}">
                            <apex:commandlink action="{!verFactura}" target="_blank" id="link" value="Ver" style="text-decoration:none;" styleClass="btn">                         
                        		<apex:param name="codigoFactura" value="{!i.codigofactura}"/>  
							</apex:commandlink>
                    	</apex:column>
                	</apex:pageBlockTable>
            	</apex:pageBlock>
            </apex:form>
        </center>
    </body>
</apex:page>
Does anyone know what is going on or where is the problem?

Thank you very much.
 
Hey everyone,

I was trying to insert a file to Salesforce (SObject: ContentVersion) in the simplest way possible:

User-added image
filetest.pdf is a 378 KB PDF archive, I can open it, etc.

1. CSV file input, data:
Title, Description, PathOnClient, VersionData
filetest, trial, c:\files\filetest.pdf, c:\files\filetest.pdf

2. Salesforce Upsert
Title => Title
Description => Description
PathOnClient => PathOnClient
VersionData => VersionData
It inserts a file with the same name, but it does not has the same content as 'filetest.pdf'. Its size is almost 0 KB and I cannot open it. 

The "funny" thing is I can do the same with Data Loader (Salesforce App) and it does work. I cannot find the difference between them, but Pentaho is not working though.

Do I have to escape the path c:\files\filetest.pdf path? Does anyone know the trick?

Thank you very much.
Hey everyone,

I have searched how to edit content of a Visualforce Email Template and then send it with the changes, but there is not a good answer nor I have found it yet.

I have some Visualforce Email Templates with:
contenteditable="true"
And I thought that it worked until I tried today. I made changes to the template but anything shows in the received email.

Does anyone know how to do it? I really appreciate it.

Thanks. 
Hey there,

I am trying to render a PDF in a Visualforce page and I tried every possibility I found. This is my webservice (from the controller ShowInfoFactura) which gives a SOAP envelope response after calling it:
webservice static Blob getPDFMethod() {
        String theResult, theFinalResult;
        Blob blobby;
        try {
            // Web Service Calls
            // (...)
            wsResponse = wsPort.getWSResponse(ApexPages.currentPage().getParameters().get('id')); // SOAP envelope
            theResult = String.valueOf(wsResponse); // String
	        List <String> splitTheResult = new List<String>(theResult.split('result'));
            String theResultString = splitTheResult.get(2);
            String theResultStringRight = theResultString.right(theResultString.length() - 1);
            theFinalResult = theResultStringRight.left(theResultStringRight.length() - 3);
            blobby = EncodingUtil.base64Decode(theFinalResult);
        }
        catch (System.Exception ex) {
            ApexPages.addMessages(ex);
  			return null;
        }
        return blobby;
    }
These are the results (USER_DEBUG):
  • theResult (SOAP envelope): 17:00:00:517 USER_DEBUG [5]|DEBUG|The custom response is: wsResponse:[apex_schema_type_info=(http://jws.client.factory/, false, false), field_order_type_info=(message, result, status), message=null, message_type_info=(message, http://jws.client.factory/, null, 0, 1, false), result=JVBERi0xLjQKJeLjz9MKNSAwIG9iago8AxDL2rgKdlVtWsyxMqy3f1atrQvgtneJKOADeQU/Ds5njLlfLohtg3ee73unERvYmoKMTkgMCBvYmoKPDwvY2EgMT4+Pi9QYWdlcyAxNSAwIFI+XS9JbmZvIDM4IDAgUi9TaXplIDM5Pj4Kc3RhcnR4cmVmCjIzNjI5OAolJUVPRgo=, result_type_info=(result, http://jws.client.factory/, null, 0, 1, false), status=1, status_type_info=(status, http://jws.client.factory/, null, 1, 1, false)]
  • theFinalResult (Encoded PDF String): JVBERi0xLjQKJeLjz9MKNSAwIG9iago8AxDL2rgKdlVtWsyxMqy3f1atrQvgtneJKOADeQU/Ds5njLlfLohtg3ee73unERvYmoKMTkgMCBvYmoKPDwvY2EgMT4+Pi9QYWdlcyAxNSAwIFI+XS9JbmZvIDM4IDAgUi9TaXplIDM5Pj4Kc3RhcnR4cmVmCjIzNjI5OAolJUVPRgo
My visualforce page:
<apex:page controller="ShowInfoFacturas" renderAs="pdf" applyBodyTag="false">
    <head>
        <style> 
            html, body, p { font-family: 'Arial Unicode MS'; }
        </style>
    </head>
    <body>
        <center>
        <h1>Factura</h1>
        <apex:panelGrid columns="1" width="100%">
            <apex:outputText value="{!PDFMethod}" escape="false"/>
            <apex:outputText value="{!NOW()}"></apex:outputText>
        </apex:panelGrid>
        </center>
    </body>
</apex:page>

It does not show me the PDF, does anybody know how to do it properly? 

Thank you.
Hey! I searched like a lot and I tried everything. My situation is this one:

I have a first screen named "Pantalla" which decides between 2 different screens, using a Dropdown List named "Reclamaciones" (choices: "Atención pantalla" and "Facturación pantalla"). If you try how the Flow works it is always like this:
"Pantalla" you choose "Atención pantalla" it goes to Atención pantalla.
"Pantalla" you choose "Facturación pantalla" it goes to Atención pantalla.

Flow (Flow Designer)

What did I try before posting this?
1) In the Decision element I put "Atención pantalla" was selected {!$GlobalConstant.True} in one editable outcome and "Facutración pantalla" was selected {!$GlobalConstant.True} in another editable outcome. (Resource / Operator / Value)
2) In the Decision element I put "Reclamaciones" equals "Atención pantalla" in one editable outcome and "Reclamaciones" equals "Facturación pantalla" in another editable outcome.
3) In the "Pantalla" I put Stored Values in the two choices "Atención pantalla" (Stored value: AP) and "Facturación pantalla" (Stored value: FP). And then on the Decision element I put two different editable outcomes "Atención pantalla" equals AP, "Facturación pantalla" equals FP.

Any of the 3 options works and this is what I read on the net. Can anyone help me please? It has to be a solution, but I don't know what else to try.
I am writing a validation code that checks if the module and division of the module of another meet some criteria:
Long decVal = Long.ValueOf(tmp);
Integer reminder = Modulo529(decVal);
Integer cociente = reminder/23;
Integer residuo = math.mod(reminder,23);

public Integer Modulo529(Long x){
        Long result;
        Long div = 529;
        result = (x/div);
        result = x - (529 * result);
        return Integer.valueOf(result);
}
My problem is that given some number (0987543210987654) the result of the module is wrong, the simple division of that number should be 1866811362925, instead it is 186681136292, it loses the last digit (5), it should be inside the range of 2^63 - 1.
Could you help me?
Thank you very much.
I have created a Flow named Prueba_Casos which has different screens (including Previous, Next and Finish buttons) and I use it to create a new register Case.

Also, I developed a controller Class named CaseFlowController.apxc and a Visualforce Page (VFP) named FlowPage.vfp I used it to declare a finishlocation at the VFP which is receiving the PageReference from the function getOID of the class with {!OID}. Also the flow interview="{!myflow}" at the VFP which receives the ID (getmyID) of the new Case from the class.

The variable var_case_id does exist and it is Text Data Type and is also Input and Output (Flow Designer variable definition). When I create the new register Case at the Flow Designer I assign the the record ID to the variable to reference it on my flow too. The code seems right because there are no errors and everything has its logic:

FlowPage.vfp
<apex:page Controller="CaseFlowController" TabStyle="Case">
    <flow:interview name="Prueba_Casos" interview="{!myflow}" finishlocation="{!OID}" />
</apex:page>
CaseFlowController.apxc
public class CaseFlowController {
    public Flow.Interview.Prueba_Casos myFlow { get; set; }
    
    public String getmyID() {
    	if (myFlow==null) return '';
    	else return myFlow.var_case_id;
    }
    
    public PageReference getOID(){
    	PageReference p = new PageReference('https://cs63.salesforce.com/500/o');
        p.setRedirect(false);
    	return p;
    }
}
The problem is the two different behaviours:
1) The incorrect one: I created a custom button at the Case layout called "Reclamaciones":
/flow/Prueba_Casos?CaseID={!Case.Id}&retURL=/{!Case.Id}
On click you start the flow, but at the end it doesn't redirect you to the finishlocation specified (https://cs63.salesforce.com/500/o).

2) The correct one: If you go to Setup > Visualforce Pages and then click on the icon next to the FlowPage you start the flow and in the end it does redirect you to the finishlocation specificied (https://cs63.salesforce.com/500/o).

The behaviour of the button is the one that I need to work. Do you know what is happening?
Hey there,

I am trying to render a PDF in a Visualforce page and I tried every possibility I found. This is my webservice (from the controller ShowInfoFactura) which gives a SOAP envelope response after calling it:
webservice static Blob getPDFMethod() {
        String theResult, theFinalResult;
        Blob blobby;
        try {
            // Web Service Calls
            // (...)
            wsResponse = wsPort.getWSResponse(ApexPages.currentPage().getParameters().get('id')); // SOAP envelope
            theResult = String.valueOf(wsResponse); // String
	        List <String> splitTheResult = new List<String>(theResult.split('result'));
            String theResultString = splitTheResult.get(2);
            String theResultStringRight = theResultString.right(theResultString.length() - 1);
            theFinalResult = theResultStringRight.left(theResultStringRight.length() - 3);
            blobby = EncodingUtil.base64Decode(theFinalResult);
        }
        catch (System.Exception ex) {
            ApexPages.addMessages(ex);
  			return null;
        }
        return blobby;
    }
These are the results (USER_DEBUG):
  • theResult (SOAP envelope): 17:00:00:517 USER_DEBUG [5]|DEBUG|The custom response is: wsResponse:[apex_schema_type_info=(http://jws.client.factory/, false, false), field_order_type_info=(message, result, status), message=null, message_type_info=(message, http://jws.client.factory/, null, 0, 1, false), result=JVBERi0xLjQKJeLjz9MKNSAwIG9iago8AxDL2rgKdlVtWsyxMqy3f1atrQvgtneJKOADeQU/Ds5njLlfLohtg3ee73unERvYmoKMTkgMCBvYmoKPDwvY2EgMT4+Pi9QYWdlcyAxNSAwIFI+XS9JbmZvIDM4IDAgUi9TaXplIDM5Pj4Kc3RhcnR4cmVmCjIzNjI5OAolJUVPRgo=, result_type_info=(result, http://jws.client.factory/, null, 0, 1, false), status=1, status_type_info=(status, http://jws.client.factory/, null, 1, 1, false)]
  • theFinalResult (Encoded PDF String): JVBERi0xLjQKJeLjz9MKNSAwIG9iago8AxDL2rgKdlVtWsyxMqy3f1atrQvgtneJKOADeQU/Ds5njLlfLohtg3ee73unERvYmoKMTkgMCBvYmoKPDwvY2EgMT4+Pi9QYWdlcyAxNSAwIFI+XS9JbmZvIDM4IDAgUi9TaXplIDM5Pj4Kc3RhcnR4cmVmCjIzNjI5OAolJUVPRgo
My visualforce page:
<apex:page controller="ShowInfoFacturas" renderAs="pdf" applyBodyTag="false">
    <head>
        <style> 
            html, body, p { font-family: 'Arial Unicode MS'; }
        </style>
    </head>
    <body>
        <center>
        <h1>Factura</h1>
        <apex:panelGrid columns="1" width="100%">
            <apex:outputText value="{!PDFMethod}" escape="false"/>
            <apex:outputText value="{!NOW()}"></apex:outputText>
        </apex:panelGrid>
        </center>
    </body>
</apex:page>

It does not show me the PDF, does anybody know how to do it properly? 

Thank you.
I am writing a validation code that checks if the module and division of the module of another meet some criteria:
Long decVal = Long.ValueOf(tmp);
Integer reminder = Modulo529(decVal);
Integer cociente = reminder/23;
Integer residuo = math.mod(reminder,23);

public Integer Modulo529(Long x){
        Long result;
        Long div = 529;
        result = (x/div);
        result = x - (529 * result);
        return Integer.valueOf(result);
}
My problem is that given some number (0987543210987654) the result of the module is wrong, the simple division of that number should be 1866811362925, instead it is 186681136292, it loses the last digit (5), it should be inside the range of 2^63 - 1.
Could you help me?
Thank you very much.
I have created a Flow named Prueba_Casos which has different screens (including Previous, Next and Finish buttons) and I use it to create a new register Case.

Also, I developed a controller Class named CaseFlowController.apxc and a Visualforce Page (VFP) named FlowPage.vfp I used it to declare a finishlocation at the VFP which is receiving the PageReference from the function getOID of the class with {!OID}. Also the flow interview="{!myflow}" at the VFP which receives the ID (getmyID) of the new Case from the class.

The variable var_case_id does exist and it is Text Data Type and is also Input and Output (Flow Designer variable definition). When I create the new register Case at the Flow Designer I assign the the record ID to the variable to reference it on my flow too. The code seems right because there are no errors and everything has its logic:

FlowPage.vfp
<apex:page Controller="CaseFlowController" TabStyle="Case">
    <flow:interview name="Prueba_Casos" interview="{!myflow}" finishlocation="{!OID}" />
</apex:page>
CaseFlowController.apxc
public class CaseFlowController {
    public Flow.Interview.Prueba_Casos myFlow { get; set; }
    
    public String getmyID() {
    	if (myFlow==null) return '';
    	else return myFlow.var_case_id;
    }
    
    public PageReference getOID(){
    	PageReference p = new PageReference('https://cs63.salesforce.com/500/o');
        p.setRedirect(false);
    	return p;
    }
}
The problem is the two different behaviours:
1) The incorrect one: I created a custom button at the Case layout called "Reclamaciones":
/flow/Prueba_Casos?CaseID={!Case.Id}&retURL=/{!Case.Id}
On click you start the flow, but at the end it doesn't redirect you to the finishlocation specified (https://cs63.salesforce.com/500/o).

2) The correct one: If you go to Setup > Visualforce Pages and then click on the icon next to the FlowPage you start the flow and in the end it does redirect you to the finishlocation specificied (https://cs63.salesforce.com/500/o).

The behaviour of the button is the one that I need to work. Do you know what is happening?