• jobo
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Edit: probably this request does not make sense as more than 1000 items shouldn't be displayed on on page - instead i should use query more and display a "next 1000 items" link on the page

 

hi guys, i need a hint for displaying the results of a query with more than 1000 items. i browse them by doing a for loop but haven't found any example to bind them to a vf-page so far. i wonder if it actually can be done by PageReference Method (as i did with lists returned by queries with less results).

 

any example for such vfpage / class i missed?

 

 

 

 

 

 

Message Edited by jobo on 03-11-2009 06:39 AM
  • March 11, 2009
  • Like
  • 0


Update:
I tried a bit an made the method with queries alle case-emails returning the value itself:

 public List<EmailMessage> ViewData(string incId) {

 
  String query = 'Select ToAddress, TextBody, SystemModstamp, Subject, Status, ParentId, '
  + 'MessageDate, LastModifiedDate, LastModifiedById, IsDeleted, Incoming, '
  + 'Id, HtmlBody, Headers, HasAttachment, FromName, FromAddress, CreatedDate, '
  + 'CreatedById, CcAddress, BccAddress, ActivityId '
  + 'From EmailMessage WHERE '
  + 'ParentId = \''+ incId + '\'';
  //+ 'ParentId = \''+ incident.Id + '\''; 
 
 myquery = query;
 myEmail = Database.query(query);
 return myEmail;
 }
 
 
but now my apex page can't access the controller extension:

<apex: page standardController="Case" extensions="mySendMail" action="{!ViewData}" id="mySendMail_PageLoad">
results in >>> Unknown method 'CaseStandardController.ViewData() <<<<

why is that? i did this because i wanted to access the method from my testclass with a case id 
and compare the anticipated results.

please note that incident and case are the for the same thing

__________________________________________________________________________________________

Hi there, i'm a bloody beginner in apex and i don't know how to write a simple test-class 
for the following controller extension of the case controller : 

it was written to avoid an "email to:" field from beeing filled with the
standard contact for the account associated with the case when replying to a mail
in the case. it is called in a special section within the case-vf page. all emails
for this case are displayed an can be replyed by link. it works perfectly but must be
tested as you know. 


public class mySendMail {
 
  private List<EmailMessage> myEmail;
  public List<EmailMessage> getmyEmail() {return myEmail;}
  public string myquery {get;set;} // testqueryoutput in page
  public string caseId {get;set;} // caseId-exchange
 
 
 //standardcontrollerfunctionality
  Case incident;
  ApexPages.StandardController controller;
  public mySendMail(ApexPages.StandardController controller) {
  this.controller = controller;
  this.incident = (Case)controller.getRecord();
  } 
 
 public PageReference ViewData() {
 
  String query = 'Select ToAddress, TextBody, SystemModstamp, Subject, Status, ParentId, '
  + 'MessageDate, LastModifiedDate, LastModifiedById, IsDeleted, Incoming, '
  + 'Id, HtmlBody, Headers, HasAttachment, FromName, FromAddress, CreatedDate, '
  + 'CreatedById, CcAddress, BccAddress, ActivityId '
  + 'From EmailMessage WHERE '
  + 'ParentId = \''+ incident.Id + '\''; 
 
 myquery = query;
 myEmail = Database.query(query);
 return null;
  
  
 }

}


the code below is my testclass attempt so far. i have no idea how to call
a testcase of mine from which i know what emails and their subjects are.
i simply wanna compare the amount of emails or some or one subject.  


@IsTest private class mySendMailTest {
 
   
  //initializing the standard case controller  
  ApexPages.StandardController con = new ApexPages.StandardController(new Case());
   
  //initializing the controllerextension
  mySendMail ext = new mySendMail(con);

  public static testmethod void basicTest() {

   
   
   
  }



}

 

 

 

 

 

Message Edited by jobo on 02-26-2009 09:21 AM
  • February 26, 2009
  • Like
  • 0

- A SalesForce Account has a Lookup field.

 

- I am trying to retrieve its value with an SQL statement in VBA Excel.

 

- An error message appears, saying the field does not exist, even if it does.

 

- The SQL statement is formed correctly and I use the correct field name with the __c .

 

- All other SalesForce fields of that same account can be accessed by the SQL statement just fine.

 

- Is there a special way to access a SalesForce Lookup field with SQL in VBA Excel?

 

Thanks.

 

pic

Message Edited by metal_aug on 03-03-2009 07:10 AM
Message Edited by metal_aug on 03-03-2009 07:12 AM


Update:
I tried a bit an made the method with queries alle case-emails returning the value itself:

 public List<EmailMessage> ViewData(string incId) {

 
  String query = 'Select ToAddress, TextBody, SystemModstamp, Subject, Status, ParentId, '
  + 'MessageDate, LastModifiedDate, LastModifiedById, IsDeleted, Incoming, '
  + 'Id, HtmlBody, Headers, HasAttachment, FromName, FromAddress, CreatedDate, '
  + 'CreatedById, CcAddress, BccAddress, ActivityId '
  + 'From EmailMessage WHERE '
  + 'ParentId = \''+ incId + '\'';
  //+ 'ParentId = \''+ incident.Id + '\''; 
 
 myquery = query;
 myEmail = Database.query(query);
 return myEmail;
 }
 
 
but now my apex page can't access the controller extension:

<apex: page standardController="Case" extensions="mySendMail" action="{!ViewData}" id="mySendMail_PageLoad">
results in >>> Unknown method 'CaseStandardController.ViewData() <<<<

why is that? i did this because i wanted to access the method from my testclass with a case id 
and compare the anticipated results.

please note that incident and case are the for the same thing

__________________________________________________________________________________________

Hi there, i'm a bloody beginner in apex and i don't know how to write a simple test-class 
for the following controller extension of the case controller : 

it was written to avoid an "email to:" field from beeing filled with the
standard contact for the account associated with the case when replying to a mail
in the case. it is called in a special section within the case-vf page. all emails
for this case are displayed an can be replyed by link. it works perfectly but must be
tested as you know. 


public class mySendMail {
 
  private List<EmailMessage> myEmail;
  public List<EmailMessage> getmyEmail() {return myEmail;}
  public string myquery {get;set;} // testqueryoutput in page
  public string caseId {get;set;} // caseId-exchange
 
 
 //standardcontrollerfunctionality
  Case incident;
  ApexPages.StandardController controller;
  public mySendMail(ApexPages.StandardController controller) {
  this.controller = controller;
  this.incident = (Case)controller.getRecord();
  } 
 
 public PageReference ViewData() {
 
  String query = 'Select ToAddress, TextBody, SystemModstamp, Subject, Status, ParentId, '
  + 'MessageDate, LastModifiedDate, LastModifiedById, IsDeleted, Incoming, '
  + 'Id, HtmlBody, Headers, HasAttachment, FromName, FromAddress, CreatedDate, '
  + 'CreatedById, CcAddress, BccAddress, ActivityId '
  + 'From EmailMessage WHERE '
  + 'ParentId = \''+ incident.Id + '\''; 
 
 myquery = query;
 myEmail = Database.query(query);
 return null;
  
  
 }

}


the code below is my testclass attempt so far. i have no idea how to call
a testcase of mine from which i know what emails and their subjects are.
i simply wanna compare the amount of emails or some or one subject.  


@IsTest private class mySendMailTest {
 
   
  //initializing the standard case controller  
  ApexPages.StandardController con = new ApexPages.StandardController(new Case());
   
  //initializing the controllerextension
  mySendMail ext = new mySendMail(con);

  public static testmethod void basicTest() {

   
   
   
  }



}

 

 

 

 

 

Message Edited by jobo on 02-26-2009 09:21 AM
  • February 26, 2009
  • Like
  • 0

I have the following trigger which runs fine in the sandbox. However, when I attempt to deploy into production org, I receive the following message:

 

"DML not allowed on CampaignShare". 

 

It apears that for simne reason deleting CampaignShare records inproduction is not allowe, while is ok in the sandbox.

 

Both orgs are Spring '09 release.

 

Any help appreciated.

 

 

 

 

trigger CM_T20_SoftDeleteCampaign on Campaign (after update) {
deleteCampaignShare(Trigger.new);

private void deleteCampaignShare(Campaign[] campArr) {

Id softDeleteOwnerId = ConfigurationHelper.SOFT_DELETE_OWNER_USER.Id;

Set<ID> setCampaignIds = new Set<ID>();
for(Campaign campObj :campArr){
if(campObj.Soft_Delete_Pending__c == true) {
setCampaignIds.add(campObj.Id);
}
}

// check array size > 0 before calling update / delete
Campaign[] CampaignLst = [select Id, Soft_Deleted__c, Soft_Delete_Pending__c from Campaign where Id in :setCampaignIds];
if(CampaignLst != null && CampaignLst.size() > 0) {
for(Campaign campObj :CampaignLst)
{
campObj.Soft_Deleted__c = true;
campObj.Soft_Delete_Pending__c = false;
campObj.OwnerId = softDeleteOwnerId;
}
update CampaignLst;
}

CampaignShare[] lstCampShare = [select Id From CampaignShare where CampaignId in :setCampaignIds and RowCause = 'Manual'];
if(lstCampShare != null && lstCampShare.size() > 0)
delete lstCampShare;
}

}

 

 

 

Message Edited by AxxxV on 02-16-2009 11:04 PM
  • February 16, 2009
  • Like
  • 0
There are VisualForce pages in our application, whose controllers make web service calls to an external service. This service authenticates the caller by using the standard salesforce.com SSO (Single Sign-on) procedures, namely, the VF controller passes the API URL and the current session ID to the web service as parameters and the web service in turn calls back to the salesforce.com API to validate the session. It gets the API URL from the VF page, and the session Id using UserInfo.getSessionId().
 
This strategy is documented and implemented in sample salesforce.com code and has been working for us for the better part of the year. It continues to work from custom field formulas as well.
 
Along comes Winter '09 and it no longer works in VisualForce. The session ID we pass to the web service is now invalid. The error is: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader. The only clue is that the URL hosting the page has changed (although the API url has not). No code has changed on our side.
 
  • October 14, 2008
  • Like
  • 0