• JEndo
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 13
    Replies

Having some problems with sending an attachment via email from a VF page-  I'm instantiating a second page (Page B) from within a first (Page A), and setting the email body to PageB.getContent().  However, it seems the getContent() function is returning the Page A, and not Page B. 

 

I also have a link to Page B from Page A, and this renders/outputs properly.

 

Anyone have any ideas?

 

 

... PageReference excelPage = Page.PAGE B; excelPage.getParameters().put('year', selectedYear); excelPage.setRedirect(true); String fileName = 'foo.xls'; //Prepare attachment to quote Messaging.EmailFileAttachment emailAttachment = new Messaging.EmailFileAttachment(); emailAttachment.setFileName(fileName); emailAttachment.setBody(excelPage.getContent()); emailMsg.setFileAttachments(new List<Messaging.EmailFileAttachment>{emailAttachment}); Messaging.SendEmailResult[] sers = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {emailMsg}); ...

 

 

 

  • February 10, 2010
  • Like
  • 0
When I attempt to save a VF page from the Force.com IDE, I get the above message... Any ideas?

I can't seem to find it in any documentation on this, either for VisualForce or the Force.com IDE. It only seems to happen for certain pages, and I can't figure out what may be causing it.

Thanks-

-Jesse
  • December 01, 2008
  • Like
  • 0
I'm noticing some very odd behaviour with the QueryResultIterator in the Flex toolkit-  It seems to, every so often, think there's an extra record in the query result, and so calls the forEach function one extra time with a null record, resulting in a null object reference.  I can't seem to find a consistent way to replicate this behaviour, but here's an overview of what I'm seeing:

The query I most often see this happen on returns a single result- it's actually querying the Attachments, and looks something like this:

SELECT Id, Body FROM ATTACHMENT WHERE Name='<someName>' AND ParentId='<someId>'

Now, this query should only return a single result.  The Java toolkit returns a single record, the DataLoader returns a single record, and looking manually at the attachments in this org, it should only return a single result.  However, when debugging, the call to lastSObject() returns false after processing the first record.  Further debugging shows this is because the QueryResult for the Iterator actually thinks there are 2 records, with the second element in the records collection being a null object.

Debugging the QueryResult class itself always returns a correct QueryResult, so I'm not really sure where this could be coming from.  Has anyone else noticed anything of this sort?

On a side note, I made a small change to the code in the DescribeSObjectResult class that might be helpful to others-  because of the way we were adding fields/child relationships/record types to their respective Arrays, the .length attribute was always 0.  I found it necessary in one spot to know the number of fields returned on a describe, so I added an explicit increment to the array.length each time I processed a field.  It's a little bit of a hack, but it works.  Code follows:

Code:
public function DescribeSObjectResult(obj:ObjectProxy) {
for (var key:String in obj) {
var val:Object = obj[key];
if (val is ArrayCollection || val is ObjectProxy) {
if (key == "fields") {
var fieldArray:Array = new Array();
for (var i:int = 0;i<(val as ArrayCollection).length;i++) {
var field:Field = new Field((val as ArrayCollection)[i]);
fieldArray[field.name] = field;
fieldArray.length++;
}
this[key] = fieldArray;
} else if (key == "childRelationships") {
var crArray:Array = new Array();
var cr:ChildRelationship;

if ( val is ObjectProxy ) {
cr = new ChildRelationship(val as ObjectProxy);
crArray[cr.relationshipName] = cr;
crArray.length++;
} else {
for (var i2:int = 0;i2<(val as ArrayCollection).length;i2++) {
cr = new ChildRelationship((val as ArrayCollection)[i2]);
crArray[cr.relationshipName] = cr;
crArray.length++;
}
}
this[key] = crArray;
} else if (key == "recordTypeInfos") {
var rtArray:Array = new Array();
var rt:RecordTypeInfo;

if ( val is ObjectProxy ) {
rt = new RecordTypeInfo(val as ObjectProxy);
rtArray[rt.name] = rt;
rtArray.length++;
} else {
for (var i3:int=0;i3<(val as ArrayCollection).length;i3++) {
rt = new RecordTypeInfo((val as ArrayCollection)[i3]);
rtArray[rt.name] = rt;
rtArray.length++;
}
}
this[key] = rtArray;
}
} else {
this[key] = obj[key]
}
}
}

 



  • February 04, 2008
  • Like
  • 0
I've run up against some interesting behavior that I'm hoping someone will be able to help me out with-  While running a describe call on objects using the Flex toolkit, it appears I'm missing a large amount of data from the childRelationships field.

When executing the describeSObjects call on the User entity from the Java toolkit, I get back an array of something like 285+ childRelationships. 
When executing the same call with the Flex toolkit, I get back 4...  one of which is labelled 'undefined'.

I'm using the Flex Toolkit Release 3.11 and the 11.0 API.  Has anyone encountered similar issues?

Thanks-

-Jesse
  • November 29, 2007
  • Like
  • 0

hey guys, i get this error all of the sudden.

"System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException:

Class.GenerateAttachEmailCertificate_WS.GenerateAttachEmailCertificate: line 10, column 18
Class.GenerateAttachEmailCertificate_WS.testingEmail: line 93, column 14
External entry point".

 

line 9 and 10:

 

PageReference pdf = new PageReference('/apex/CertificatePrintToPdf?id=' + id); Blob pdfBody = pdf.getContent();

 

and line 93 is inside my test method:

 

testSend = GenerateAttachEmailCertificate_WS.GenerateAttachEmailCertificate(testId, testVer, testLoc);

 

im pretty sure it was 100% coverage, but now im in the middle of deploying a new class into production, and i got that error.

 

can anyone help me please?

thanks in advance.

 

 

 

 

 

Hi,

 

When does formula evaluation happens ?

 

Can I assume that formula fields are already evaluated if I want to use their content in triggers ?

 

Where can I find documentation about this ?

 

Thanks !

 

Michel

Hey Guys,

 

This one has just popped up on a clients org when running test classes, im frantically searching through the config to make sure no one has change something to unique but i havent found anything yet, any ideas?

 

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>

When I attempt to save a VF page from the Force.com IDE, I get the above message... Any ideas?

I can't seem to find it in any documentation on this, either for VisualForce or the Force.com IDE. It only seems to happen for certain pages, and I can't figure out what may be causing it.

Thanks-

-Jesse
  • December 01, 2008
  • Like
  • 0
Our external Flex application has been in production for a number of months and according to our log files suddenly stopped working sometime between 8:10pm EST and 9:57pm EST last night.

I get the same error connecting to Production and our Sandbox. The error is:

Error: Ignoring policy file at http://cs1-api.salesforce.com/crossdomain.xml due to meta-policy 'by-content-type'.
Error: Ignoring policy file at http://cs1-api.salesforce.com/services/Soap/cross-domain.xml due to meta-policy 'by-content-type'.

*** Security Sandbox Violation ***
Connection to http://cs1-api.salesforce.com/services/Soap/u/13.0/4b3300DS0000000DC9o halted - not permitted from http://localhost:8500/site/swf/Profiel.swf

Flash Player 9,0,124
Flex 3.0.1

Thank you
I'm noticing some very odd behaviour with the QueryResultIterator in the Flex toolkit-  It seems to, every so often, think there's an extra record in the query result, and so calls the forEach function one extra time with a null record, resulting in a null object reference.  I can't seem to find a consistent way to replicate this behaviour, but here's an overview of what I'm seeing:

The query I most often see this happen on returns a single result- it's actually querying the Attachments, and looks something like this:

SELECT Id, Body FROM ATTACHMENT WHERE Name='<someName>' AND ParentId='<someId>'

Now, this query should only return a single result.  The Java toolkit returns a single record, the DataLoader returns a single record, and looking manually at the attachments in this org, it should only return a single result.  However, when debugging, the call to lastSObject() returns false after processing the first record.  Further debugging shows this is because the QueryResult for the Iterator actually thinks there are 2 records, with the second element in the records collection being a null object.

Debugging the QueryResult class itself always returns a correct QueryResult, so I'm not really sure where this could be coming from.  Has anyone else noticed anything of this sort?

On a side note, I made a small change to the code in the DescribeSObjectResult class that might be helpful to others-  because of the way we were adding fields/child relationships/record types to their respective Arrays, the .length attribute was always 0.  I found it necessary in one spot to know the number of fields returned on a describe, so I added an explicit increment to the array.length each time I processed a field.  It's a little bit of a hack, but it works.  Code follows:

Code:
public function DescribeSObjectResult(obj:ObjectProxy) {
for (var key:String in obj) {
var val:Object = obj[key];
if (val is ArrayCollection || val is ObjectProxy) {
if (key == "fields") {
var fieldArray:Array = new Array();
for (var i:int = 0;i<(val as ArrayCollection).length;i++) {
var field:Field = new Field((val as ArrayCollection)[i]);
fieldArray[field.name] = field;
fieldArray.length++;
}
this[key] = fieldArray;
} else if (key == "childRelationships") {
var crArray:Array = new Array();
var cr:ChildRelationship;

if ( val is ObjectProxy ) {
cr = new ChildRelationship(val as ObjectProxy);
crArray[cr.relationshipName] = cr;
crArray.length++;
} else {
for (var i2:int = 0;i2<(val as ArrayCollection).length;i2++) {
cr = new ChildRelationship((val as ArrayCollection)[i2]);
crArray[cr.relationshipName] = cr;
crArray.length++;
}
}
this[key] = crArray;
} else if (key == "recordTypeInfos") {
var rtArray:Array = new Array();
var rt:RecordTypeInfo;

if ( val is ObjectProxy ) {
rt = new RecordTypeInfo(val as ObjectProxy);
rtArray[rt.name] = rt;
rtArray.length++;
} else {
for (var i3:int=0;i3<(val as ArrayCollection).length;i3++) {
rt = new RecordTypeInfo((val as ArrayCollection)[i3]);
rtArray[rt.name] = rt;
rtArray.length++;
}
}
this[key] = rtArray;
}
} else {
this[key] = obj[key]
}
}
}

 



  • February 04, 2008
  • Like
  • 0
I've run up against some interesting behavior that I'm hoping someone will be able to help me out with-  While running a describe call on objects using the Flex toolkit, it appears I'm missing a large amount of data from the childRelationships field.

When executing the describeSObjects call on the User entity from the Java toolkit, I get back an array of something like 285+ childRelationships. 
When executing the same call with the Flex toolkit, I get back 4...  one of which is labelled 'undefined'.

I'm using the Flex Toolkit Release 3.11 and the 11.0 API.  Has anyone encountered similar issues?

Thanks-

-Jesse
  • November 29, 2007
  • Like
  • 0
I'm trying to get a simple HelloWorld application working on my local machine using the FlexBuilder v3 Beta and the most recent SFC Flex Toolkit. I've followed the code exactly as documented in the samples found online,  various screencasts, and even in downloaded the samples. Now matter what I do, I get the following error in the login step:

[FaultEvent fault=[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTP"] messageId="274B3986-6992-1A79-1276-D7DF53D645C3" type="fault" bubbles=false cancelable=true eventPhase=2]

The login function I'm using is below:
    private function doLogin():void
    {
     var lr:LoginRequest = new LoginRequest();
     lr.username = "devlogin@blablabla.com";
     lr.password = "devloginpassword";
     lr.server_url = "http://www.salesforce.com/services/Soap/u/9.0";
     lr.callback = new AsyncResponder(loginResult, loginFault);
     conn.login(lr);
    }
What am I doing wrong?

Thanks for any help,

Mike