-
ChatterFeed
-
6Best Answers
-
0Likes Received
-
0Likes Given
-
41Questions
-
41Replies
Sites with Wordpress
Hello everyone!!
My boss asked me if It's possible to install Wordpress (or joomla, drupal...) in Salesforce Sites!!
Is it?
Thanks in advance!!
-
- javierjies
- July 30, 2009
- Like
- 0
- Continue reading or reply
de-duplicating Contacts for Custom Application
Hi I have created a custom application using the object/database scheme shown in the link bellow.
http://www.gliffy.com/publish/1673148/
"Applicants" is the object Contacts
"Organisations" is the object Accounts.
All the other objects/tables are custom salesforce objects.
Including Applications__c in which There can be many applications for a given contact. The application__c object has an ContactID field that maps to the ContactID record on the Contact object.
Is there an application available on appexchange that can easily deal with this scenario and will allow for the automatic deletion of duplicate records in the application__c object/table when contact records are merged together? Or possibly a way in apex of having an automatic cleanup opportation that will clean out orphaned records in this custom table.
Thanks for your help in advance.
-
- angusgrant
- August 19, 2009
- Like
- 0
- Continue reading or reply
Default values not displaying on New Entry
Hi I just re-created a custom object entry edit/new page using vf and for some reason it no longer displays the default values for those fields where I have set a default value.
For example the field SBS_Event__c.venue_postcode__c is a text field and Should have a default value set. Also all the following should have default values and are checkboxes and should default to checked <apex:inputField value="{!SBS_Event__c.Available_Oxford_University__c}" />
<apex:inputField value="{!SBS_Event__c.Available_Business__c}" /> <apex:inputField value="{!SBS_Event__c.Available_Other_Charity__c}" /> <apex:inputField value="{!SBS_Event__c.Available_Other_Charity__c}" /> <apex:inputField value="{!SBS_Event__c.Available_Public_Sector_Applicants__c}" /> <apex:inputField value="{!SBS_Event__c.Other_Induvidual_No_Organisation__c}" />
<apex:page standardController="SBS_Event__c" title="SBS Events Layout Page" showHeader="true" sidebar="true"> <apex:sectionHeader title="{!$ObjectType.SBS_Event__c.label}" subtitle="{!SBS_Event__c.name}"/> <apex:form > <apex:pageBlock title="SBS Event Edit"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Information" columns="1"> <apex:InputField style="width:350px" value="{!SBS_Event__c.Name}" required="true" /> <apex:inputField value="{!SBS_Event__c.Event_Brief_Description__c}" style="width:450px" required="true"/> <apex:pageBlockSectionItem > <apex:outputLabel for="eventdetails">Event Description (for web)</apex:outputLabel> <apex:inputTextarea value="{!SBS_Event__c.Full_Event_Details__c}" id="theTextarea" richText="true" id="eventdetails" required="true" style="border: 3px solid red;" /> </apex:pageBlockSectionItem> <apex:inputField value="{!SBS_Event__c.Event_Start_Date__c}" required="true" /> <apex:inputField value="{!SBS_Event__c.Event_Finish_date__c}" required="true"/> <apex:inputField value="{!SBS_Event__c.Contact_Information__c}" required="true" style="width:350px"/> <apex:inputField value="{!SBS_Event__c.Alternative_Contact_Information__c}" style="width:350px" /> <apex:inputField value="{!SBS_Event__c.Maximum_Capacity__c}"/> <apex:inputField value="{!SBS_Event__c.Display_on_website__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Location" columns="2"> <apex:inputField value="{!SBS_Event__c.Venue__c}" required="true" /> <apex:inputField value="{!SBS_Event__c.venue_postcode__c}" required="true" /> </apex:pageBlockSection> <apex:pageBlockSection title="Applicant type availability to Apply" columns="2"> <apex:inputField value="{!SBS_Event__c.Available_Oxford_University__c}" /> <apex:inputField value="{!SBS_Event__c.Available_Business__c}" /> <apex:inputField value="{!SBS_Event__c.Available_Other_Charity__c}" /> <apex:inputField value="{!SBS_Event__c.Available_Other_Charity__c}" /> <apex:inputField value="{!SBS_Event__c.Available_Public_Sector_Applicants__c}" /> <apex:inputField value="{!SBS_Event__c.Other_Induvidual_No_Organisation__c}" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
-
- angusgrant
- August 19, 2009
- Like
- 0
- Continue reading or reply
writing a test method for a web form vf/apex
Hi I have created a vf web form(s) with a apex contoller extension that containes fairly sophisticated de-duplication logic. I have written test method(s) that cover all the code required too deploy. These test methods however only test the submission of 1 applicant at a time.
I have become increasingly nervous that once there are allot of submissions in the system some of this deduplication logic may cause the web formto fall over. I therefore have tried to rewite my test method inserting a number of contacts in the system. However if i try and add more than 100 contacts I get the following error:
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ContactDuplicateTrigger: execution of BeforeInsert caused by: System.Exception: Too many SOQL queries: 101 Trigger.ContactDuplicateTrigger: line 9, column 26: []
I thought that i had made this trigger bulk safe any help appreciated.
trigger ContactDuplicateTrigger on Contact (before insert) { Set<string> emailSet = new Set<string>(); for (Contact c : trigger.new){ emailSet.add(c.email); } Contact[] contacts = [select id from Contact where email in : emailSet]; if (contacts.size() > 0) { for(contact c:trigger.new){ c.email.addError('Contact cannot be created - Contact already exists'); } }
ta Angus
-
- angusgrant
- August 18, 2009
- Like
- 0
- Continue reading or reply
Recreate Edit page with WYSIWYG long text field on custom object.
Hi can anyone give me some examples of recreating the edit page on a custom object?
I wish to add a long text field that allow me to put some HTML formating into a long text field. This way on my Sites page I can display HTML formated text. Which is needed to make this text readable.
What are the implications of adding a WYSIWYG field here might it affect the formating within Salesforce.
Thanks in advance.
Angus
-
- angusgrant
- August 13, 2009
- Like
- 0
- Continue reading or reply
A few (basic) Questions????
Hi I've created a complete custom application using the Salesforceplatform. The only Standard objects that I'm using are Contacts andAccounts. I have had the following user questions and I wouldappreciate some help with?:
Can the heading "Messages and Alerts" be removed from the side bar as we will not need this for our application?
'CreateNew View' on all objects allows you to create two 'views' with the samename. Can it be changed so each 'view' must have a unique name?
First name on contacts object form needs to have a red line around it as it's mandatory can this be done?
How can I mark certain address details such as country, city on the Accounts and Contacts object as mandatory also?
Account and Contacts home page has links under the heading Tools and Reports that we don't need on there how can I edit these?
-
- angusgrant
- August 13, 2009
- Like
- 0
- Continue reading or reply
Cant work out how to add an error message to be displayed to users on the execution of a trigger.
Hi Every time I run this trigger. I get sent a Apex exception email with the following how do I add an error ?
System.Exception: SObject row does not allow errors
trigger EventDuplicateTigger on SBS_Event__c (before insert) {
Set<string> eventnameSet = new Set<string>();
for (SBS_Event__c e : trigger.new){
eventnameSet.add(e.Name);
}
SBS_Event__c[] events = [select id from SBS_Event__c where Name in : eventnameSet];
if (events.size() > 0) {
for(SBS_Event__c e:events){
e.Name.addError('Event cannot be created - Event already exists');
}
}
}
-
- angusgrant
- August 12, 2009
- Like
- 0
- Continue reading or reply
Error: Unknown property 'VisualforceArrayList.Name'
Hi I have added a apex controller to my vf page in which I am trying to return a list of a related objects that I am then going to display in the vf page in a apex:datatable. I'm able to create the controller extension no problem but when I view the vf page I get this error:
Error: Unknown property 'VisualforceArrayList.Name'
Apex Code:
public class event_session {
private SBS_Event__c sbs_event;
public event_session(ApexPages.StandardController controller) {
this.sbs_event =
(sbs_event__c)controller.getRecord();
}
List<event_sessions__c> event_session = new List<event_sessions__c>();
public List<event_sessions__c> EventSession {
get{
event_session = [Select e.Lecture_Event_Period__c, e.Name from Event_Sessions__c e Where e.SBS_Event__c = :sbs_event.id Order by e.CreatedDate];
return event_session;
}
}
}
//vf fragment<apex:page showHeader="false" standardController="SBS_Event__c" extensions="event_session" > <apex:composition template="StdOCEITemplate" > <apex:define name="pagebody"> <apex:pageBlock title="Event Registration Form"> <apex:form > <table width="100%" border="0" cellspacing="4" cellpadding="0"> <tr> <th width="20%" scope="col"> </th> <th width="80%" scope="col"> </th> </tr> <tr> <th scope="row" style="">Event:</th> <td style="text-align:left;padding-left:10px;"><strong>{!SBS_Event__c.name}</strong></td> </tr>
-
- angusgrant
- August 03, 2009
- Like
- 0
- Continue reading or reply
Visualforce and ordering list data from related object
Hi I have created a standard vf page with a standard controller pointing at a custom object I called "sbs_event__c".
I want to display the related items from a child object of this event on the page. This works fine however it is displaying the data in a different order to that displayed in the application.
Do I have to resort to Apex and a controller extension to order this data. Or is there a way of natively ordering the data with visulaforce?
<apex:page showHeader="false" standardController="SBS_Event__c" >
//Code snippet
<tr> <th scope="row" style="">Event Details:</th> <td style="padding:5px;border-top:1px dotted black;border-bottom:1px dotted black;"> <p> {!SBS_Event__c.Full_Event_Details__c}</p></td> </tr> <tr> <th scope="row" style="">Event Date:</th> <td style=""> <apex:outputText value="{!SBS_Event__c.Event_Date_Time_Period__c}"></apex:outputText> </td> </tr> <apex:actionRegion id="lectures" rendered="{!SBS_Event__c.Number_of_lectures__c > 1}"> <tr> <th scope="row" style="">Lecture Program:</th> <td style=""> <table width="100%" border="0" cellspacing="4" cellpadding="4"> <apex:repeat value="{!SBS_Event__c.Event_Sessions__r}" var="eventsession"> <tr> <td width="40%">{!eventsession.}</td> <td width="40%">{!eventsession.Name}</td> <td width="60%">{!eventsession.Lecture_Event_Period__c}</td> </tr> </apex:repeat>
-
- angusgrant
- July 31, 2009
- Like
- 0
- Continue reading or reply
How to populate the date/time from a parent object into a child date/time field
Hi I have two custom objects they have a master detail relationship between them.
One is called SBS_Event__c the child object Event_session__c.
The SBS_Event Object has a date time start date and start date finish date.
I also want to add a date time start and finish fields to Event_session__c custom child object.
I want the date/time Start date to be populated with the SBS_Event__c start date time by default and likewise for the Finish date.
I have tried both creating a custom fomula field that takes the date/time from the SBS_Event object and then sets it as the default value for the date/time field in Event_session__c. But the value never appeares to be populated.
I have also tried creating a workflow that checks if the date time field is saved as NULL and then runs a fomula that should populate this field from date Time from SBS_Event__c into the date time field in Event_session__c.
But in my tests this field never gets populated. Please help advise.
-
- angusgrant
- July 28, 2009
- Like
- 0
- Continue reading or reply
Simple Questions but I cant work out how they are done? User Login and Contact Label Change
First Question:
I have created a number of new users with a particular profile restricting there access to certain data. Before giving each user a login. I wanted to test logging in as the user. How can this be done it seems from the documentation as if I can only login as the user if they allow me permissions to do so? Surely there is a way of testing each user prior to giving each a login? Please help.
Second Question:
How do I change the address contact label names on the Contact object. In the developer account this is set to "mailing street", "mailing zip post code" etc.. however in the enterprise account it is set to "primary street" and "primary zip post code". I wish it to be the "mailing" address not "primary" address. Please advise.
-
- angusgrant
- July 27, 2009
- Like
- 0
- Continue reading or reply
Can you create dynamic reports in sf where you pass a parameter in?
Hi I would like to know if you can create dynamic reports in native sf where you can pass a parameter from example a vf page or another salesforce page (passing through Querystring) that creates a dynamic report?
Or should i look at the Google charts toolkit to do this?
-
- angusgrant
- July 22, 2009
- Like
- 0
- Continue reading or reply
Deploying Code from Developer account to Enterprise account.
Hello,
I have created an application in a developer account. Deployed all Apex Classes, Visualforce Pages, Triggers, Objects Custom, Profiles via Eclipse to Enterprise account sucessfully.
I was unable to retrieve or copy the "application" that I created for some reason into Eclipse?
Also when I login into my Salesforce production application none of the Recordtypes assignment has been settup? Is this Normal? Should I manualy do this? Please advise.
I have the latest version of the Salesforce IDE. So this is not the issue.
What is the next step? Should I create a Sandbox version and then manually make these changes please advise?
thanks
Angus
-
- angusgrant
- July 21, 2009
- Like
- 0
- Continue reading or reply
Test Method help. 63% test coverage thus far.
Im having problems with my apex test method how can i test the following line highligted in red I know the test method is getting into the if statment. i guess what i need to do is test for the existance of a new account? How is this done? I also then need to test the population of this new (database) object account with data? pls advise.
I dont know if its just me but I found the test mehod documentation very poor. On the apex official documentation site it gives examples of test methods without giving the code that the test methods actually relates too. Pls wake up Salesforce there needs to be better documentation vote for idea
thanks for your time
Angus
-
- angusgrant
- July 06, 2009
- Like
- 0
- Continue reading or reply
Eclipse IDE move app from developer account to sandbox
Hi I have created an application on a developer account and am in the process of writing test methods for the classes that I have written. Which are not finished.
In the meantime Is it possible to move the application to the Sandbox version of my enterprise salesforce account? or can I only move it to Sandbox once all test methods have been written?
If it is possible how can this be done in eclipse IDE?
Many thanks
Angus
-
- angusgrant
- July 04, 2009
- Like
- 0
- Continue reading or reply
Rewrite Apex class with only one SOQL statment not 26!
Hi I have written this apex class for a visualforce page which displays a list of Contacts sorted into Alpahabetical order displayed on a (pdf) page. I know that the way that I have written it will probably result in me hitting some of those governor limits. What I really need to do it write one SOQL statment that I then put into one list that then gets sorted by Surname 1st character and seperated into 26 sepaerate lists. My Apex knowledge is not there yet can somone point me in the right direction? Thanks in advance.
current vf page and result:
current Apex class:
public class attendeecheckinlist2 {
string eventID = System.currentPageReference().getParameters().get('id');
public List<App__c> getApplicant_A() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'A%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_B() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'B%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_C() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'C%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_D() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'D%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_E() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'E%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_F() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'F%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_G() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'G%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_H() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'H%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_I() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'I%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_J() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'J%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_K() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'K%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_L() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'L%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_M() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'M%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_N() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'N%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_O() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'O%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_P() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'P%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_Q() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'Q%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_R() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'R%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_S() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'S%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_T() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'T%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_U() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'U%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_V() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'V%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_W() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'W%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_X() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'X%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_Y() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'Y%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_Z() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'Z%' Order by a.Applicant__r.Firstname ];
}
}
-
- angusgrant
- July 02, 2009
- Like
- 0
- Continue reading or reply
Apex test class mimic visualforce page fields using controller Extension.
How can I get Apex to mimic passing the field data from the visualforce page to the controllerexstension save method. I have looked at 100's of examples yet still cant find a solution.
vf:
<apex:page standardController="contact" showHeader="false" extensions="appExtension">
<apex:composition template="StdOCEITemplate">
<apex:define name="pagebody">
<apex:form rendered="{!(SelectedEvent.Name != '')}" >
<apex:pageMessages />
<apex:pageBlock title="{!SelectedEvent.Name} - Application Form">
<apex:pageBlockSection title="Main Details" columns="2" >
<apex:inputField value="{!contact.Salutation}" id="title" required="true" />
<apex:outputText > </apex:outputText>
<apex:inputField value="{!contact.FirstName}" id="firstname" required="true" />
<apex:inputField value="{!contact.LastName}" id="lastname" />
<apex:inputField value="{!contact.Email}" id="email" required="true" />
<!-- more vf page here -->
<apex:pageBlockButtons location="bottom" title="Submit">
<apex:commandButton action="{!save}"
value="Submit New Application"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
controller
public class appExtension {
// Decare Vars from Querystring
Id accountrecordtypeid = ApexPages.currentPage().getParameters().get('AccountRecordTypeID');
Id contactrecordtypeid = ApexPages.currentPage().getParameters().get('ContactTypeID');
Id eventid = ApexPages.currentPage().getParameters().get('eventID');
public appExtension(ApexPages.StandardController controller) {
this.contact =
(Contact)controller.getRecord();
}
/*More Controller code hear */
//This is the method that will save the details to the database
public PageReference save()
{
//set savepoint at start so as to stop account information being set if applicant has already applied for event.
Savepoint sp = Database.setSavepoint();
// Logic to make sure first letter of name/surname is in upper case
String FirstName = Contact.FirstName;
String LastName = Contact.LastName;
if (FirstName != null && LastName != null && FirstName != '' && LastName != ''){
}
test method:
public static testMethod void testappExtensionBusApp() {
ApexPages.standardController controller = new ApexPages.standardController(new Contact());
// Business applicant test where Business applicant selects an existing account.
ApexPages.currentPage().getParameters().put('AccountRecordTypeID',[Select ID from RecordType Where SobjectType = 'Account' and Name = 'Business Organisation' Limit 1].id);
ApexPages.currentPage().getParameters().put('ContactTypeID',[Select ID from RecordType Where SobjectType = 'Contact' and Name = 'Business Applicant' Limit 1].id);
ApexPages.currentPage().getParameters().put('eventID',[select id from SBS_Event__c Where Display_on_website__c = True and Event_Start_Date__c > Today Limit 1].id);
appExtension busextension = new appExtension(controller);
//select a random existing account to associate with.
busextension.picklistValue = [select name from Account limit 1].id;
// this is a insert because email is new in system
//decalre fields from application form
/* Contact contact = new Contact(
Firstname = 'testier',
Lastname = 'tester',
Email = 'test@test.com');
Attempt 1 does not get into If statment*/
/* busextension = new appExtension(controller);
busextension = Firstname('test.');
busextension = Lastname('testier');
busextension = Email('test@test.com');
Attempt 2 does not complile Method does not exist incorrect signiture */
String nextPage = busextension.save().getUrl();
busextension.save.getURL();
// Verify that the success page displays
System.assertEquals('/events/confirmsave', nextPage);
}
}
-
- angusgrant
- June 18, 2009
- Like
- 0
- Continue reading or reply
Test Method Questions do you have to assume there is no test data in the system?
I am in the process of writing a test method in the developer version of Salesforce for a visualforce controller class that i have created.
The creation of which I have assumed there will be some test data in the system to work with?
When migrating my project accross to the Enterprise version of the Salesforce system I am assuming that I can initailly import all my code into a sandbox version of my system... (without needing to pass the unit tests) and then input some test data which will allow the test methods to pass? Or should I rewrite my test methods in such a way that no data(other than reference data) need be in the sytem. Also some of my reference data is held in its own Objects in the sytem can I package this up for the main export. Excuse theses newbie questions.
-
- angusgrant
- June 18, 2009
- Like
- 0
- Continue reading or reply
SOQL runs in Apex Explorer 8 but errors in custom apex class
Hi I have created the following SOQL query:
Select a.Application__c, a.Application__r.LastModifiedById, a.Attended_Session__c, a.Event_Session__c from App_Session__c a Where a.Application__r.SBS_event__c = 'a018000000MC48UAAT' and Event_Session__c = 'a0580000005lAMXAA2'
Which runs fine in Apex Explorer.
However when I put it into an apex class controller and attempt to return it as a list I get the following error:
Error: Invalid field Applicant__r for SObject App_Session__c
public class attendeesbyeventcontroller { string eventID = System.currentPageReference().getParameters().get('id'); public string eventsessions { get; set;} public List<App_Session__c> getApplicant() { return [Select a.Application__c, a.Application__r.App_Sessions_Attended__c, a.Application__r.Applicant_Email__c, a.Application__r.Applicant_Name__c, a.Attended_Session__c, a.Event_Session__c from App_Session__c a Where a.Application__r.SBS_event__c = :eventid and Event_Session__c ='a0580000005lAMXAA2' Limit 40]; } }
Can anyone help me with this?
-
- angusgrant
- June 16, 2009
- Like
- 0
- Continue reading or reply
How to create attendee register where there are a dynamic number of sessions
I have created the following database/object scheme: http://www.gliffy.com/publish/1673148/
I am trying to create a dynamic register to allow the marking of attendees(Contacts) as attending or not a given event session for an event.
I have writen some SOQL that returns the data that I require and have created a controller that reurns this data as a list.
However i have come to an issue when I try to use <apex:checkboxes> to allow the checking of applicants as attending a given event session. I get an error Invalid selectOptions found. Use SelectOption type in Apex. How can I do this can I combine 2 lists together?
Controller Code:
public class attendeesbyeventcontroller {
string eventID = System.currentPageReference().getParameters().get('id');
public string eventsessions { get; set;}
public List<App__c> getApplicant() {
return [Select a.name, a.Applicant__r.Email, a.Applicant__r.FirstName, a.Applicant__r.LastName, (Select Attended_Session__c From App_Sessions__r) from App__c a Where a.sbs_event__c = :eventid Limit 40];
}
}
Visualforce:
<apex:page controller="attendeesbyeventcontroller" tabStyle="App_Session__c" >
<apex:form >
<apex:pageblock id="thePage">
<apex:pageblocktable value="{!Applicant}" var="AE" id="candidateTable">
<apex:column value="{!AE.Applicant__r.FirstName}"/>
<apex:column value="{!AE.Applicant__r.LastName}"/>
<apex:column value=" {!AE.Applicant__r.Email}" />
<apex:column >
<apex:facet name="header">Event Sessions</apex:facet>
<apex:selectCheckboxes value="{!eventsessions}">
<apex:selectOptions value="{!AE.App_Sessions__r}"/>
</apex:selectCheckboxes>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
My 2nd concern is regarding governor limits on my SOQL query. Can anyone give me an idea on how many records would need to be returned before I would be hitting those governor limits?
-
- angusgrant
- June 16, 2009
- Like
- 0
- Continue reading or reply
Test Method not returning querystring values
// Decare Vars from Querystring
String accountrecordtypeid = ApexPages.currentPage().getParameters().get('AccountRecordTypeID');
String contactrecordtypeid = ApexPages.currentPage().getParameters().get('ContactTypeID');
String eventid = ApexPages.currentPage().getParameters().get('eventID');
/* Retrieve current Event name to be displayed in application form.
We also need to handle the circumstances when no event is returned in which case a */
public SBS_Event__c SelectedEvent{
get{
try {
sbs_event = [select Name from SBS_Event__c where ID = :eventid and Display_on_website__c = True and Event_Start_Date__c > Today limit 1];
}
catch (DmlException de){
System.debug('Data exception:'+ de.getMessage());
return null;
}
catch (Exception e) {
System.debug('General exception:'+ e.getMessage());
}
return sbs_event;
}
private set;}
For some reason I cant return any rows from the SOQL marked in red above.
This is my test method in which I am passing in valid querystring paramters
//select random events to test Note there Must be an event in the system ApexPages.currentPage().getParameters().put('AccountRecordTypeID',[Select ID from RecordType Where SobjectType = 'Account' Limit 1].id); ApexPages.currentPage().getParameters().put('ContactTypeID',[Select ID from RecordType Where SobjectType = 'Contact' Limit 1].id); ApexPages.currentPage().getParameters().put('eventID',[select id from SBS_Event__c Where Display_on_website__c = True and Event_Start_Date__c > Today Limit 1].id); SBS_Event__c SBSEvent = extension.SelectedEvent; extension.picklistValue = '0';
see error log below:
20090613120908.297:Class.appExtensionTestClass.testappExtension: line 15, column 74: SOQL query with 1 row finished in 5 ms
20090613120908.297:Class.appExtensionTestClass.testappExtension: line 16, column 68: SOQL query with 1 row finished in 2 ms
20090613120908.297:Class.appExtensionTestClass.testappExtension: line 17, column 62: SOQL query with 1 row finished in 4 ms
20090613120908.297:Class.appExtension: line 38, column 18: SOQL query with 0 rows finished in 2 ms
20090613120908.297:Class.appExtension: line 45, column 4: General exception:List has no rows for assignment to SObject
If I cut and paste the IDs passed through the page to the actual form it works perfectly.
Any ideas?
-
- angusgrant
- June 13, 2009
- Like
- 0
- Continue reading or reply
how to transform the entire instances of my developers account to some other editions
Hi i have a developers account and i want to transfer the entire instances of my
developer account to some other edition like professional edition or group edition
.how can i do it
- anu_karthi
- August 26, 2009
- Like
- 0
- Continue reading or reply
A few (basic) Questions????
Hi I've created a complete custom application using the Salesforceplatform. The only Standard objects that I'm using are Contacts andAccounts. I have had the following user questions and I wouldappreciate some help with?:
Can the heading "Messages and Alerts" be removed from the side bar as we will not need this for our application?
'CreateNew View' on all objects allows you to create two 'views' with the samename. Can it be changed so each 'view' must have a unique name?
First name on contacts object form needs to have a red line around it as it's mandatory can this be done?
How can I mark certain address details such as country, city on the Accounts and Contacts object as mandatory also?
Account and Contacts home page has links under the heading Tools and Reports that we don't need on there how can I edit these?
- angusgrant
- August 13, 2009
- Like
- 0
- Continue reading or reply
Need help with custom field
I have a fairly stright forward problem, but I'm not sure how I should solve it. Basically, I need a new custom field on the Campaign table that is a count of the number of leads that have a particular status. Unfortunately, I can't simply create a Roll-Up Summary field on Campaigns, because it's not the master in a master-detail relationship. In other words, I need a field on Campaigns that is essentially a count of the number of leads associated with that campaign that have a particular status. How should I approach this?
The one possibility that I can see is that I could add a trigger that fires on insert/update/delete of leads that performs the appropriate SOQL query and updates the associated Campaign record(s); however, this seems a bit round-about, and my have to be done for all Campaign records every time that a Lead record is updated. Is there a better way to do this?
Thanks in advance,
Max
- Max Power
- August 13, 2009
- Like
- 0
- Continue reading or reply
EventAttendee, how is it manipulated and what can you do with it?
I'm trying to design a feature we need that will allow scheduling of various seminars that will have attendees. I'm thinking of using the existing Event and EventAttendee objects but haven't figure out exaclty what you can do with them.
From the API documentation, it looks like I can't insert record into EventAttendee directrly.
I did find that I could create an Event using the Calendar on my home page. I also did it with a few lines of Apex code.
How does one add attendees to an event? I can't find a way to do it in the application or with code?
Is there anywhere where the vanilla out-of-the-box functionality for this sort of built-in functionalty is documented?
- Ken_Koellner
- August 13, 2009
- Like
- 0
- Continue reading or reply
Cant work out how to add an error message to be displayed to users on the execution of a trigger.
Hi Every time I run this trigger. I get sent a Apex exception email with the following how do I add an error ?
System.Exception: SObject row does not allow errors
trigger EventDuplicateTigger on SBS_Event__c (before insert) {
Set<string> eventnameSet = new Set<string>();
for (SBS_Event__c e : trigger.new){
eventnameSet.add(e.Name);
}
SBS_Event__c[] events = [select id from SBS_Event__c where Name in : eventnameSet];
if (events.size() > 0) {
for(SBS_Event__c e:events){
e.Name.addError('Event cannot be created - Event already exists');
}
}
}
- angusgrant
- August 12, 2009
- Like
- 0
- Continue reading or reply
Error: Unknown property 'VisualforceArrayList.Name'
Hi I have added a apex controller to my vf page in which I am trying to return a list of a related objects that I am then going to display in the vf page in a apex:datatable. I'm able to create the controller extension no problem but when I view the vf page I get this error:
Error: Unknown property 'VisualforceArrayList.Name'
Apex Code:
public class event_session {
private SBS_Event__c sbs_event;
public event_session(ApexPages.StandardController controller) {
this.sbs_event =
(sbs_event__c)controller.getRecord();
}
List<event_sessions__c> event_session = new List<event_sessions__c>();
public List<event_sessions__c> EventSession {
get{
event_session = [Select e.Lecture_Event_Period__c, e.Name from Event_Sessions__c e Where e.SBS_Event__c = :sbs_event.id Order by e.CreatedDate];
return event_session;
}
}
}
//vf fragment<apex:page showHeader="false" standardController="SBS_Event__c" extensions="event_session" > <apex:composition template="StdOCEITemplate" > <apex:define name="pagebody"> <apex:pageBlock title="Event Registration Form"> <apex:form > <table width="100%" border="0" cellspacing="4" cellpadding="0"> <tr> <th width="20%" scope="col"> </th> <th width="80%" scope="col"> </th> </tr> <tr> <th scope="row" style="">Event:</th> <td style="text-align:left;padding-left:10px;"><strong>{!SBS_Event__c.name}</strong></td> </tr>
- angusgrant
- August 03, 2009
- Like
- 0
- Continue reading or reply
Sites with Wordpress
Hello everyone!!
My boss asked me if It's possible to install Wordpress (or joomla, drupal...) in Salesforce Sites!!
Is it?
Thanks in advance!!
- javierjies
- July 30, 2009
- Like
- 0
- Continue reading or reply
How to populate the date/time from a parent object into a child date/time field
Hi I have two custom objects they have a master detail relationship between them.
One is called SBS_Event__c the child object Event_session__c.
The SBS_Event Object has a date time start date and start date finish date.
I also want to add a date time start and finish fields to Event_session__c custom child object.
I want the date/time Start date to be populated with the SBS_Event__c start date time by default and likewise for the Finish date.
I have tried both creating a custom fomula field that takes the date/time from the SBS_Event object and then sets it as the default value for the date/time field in Event_session__c. But the value never appeares to be populated.
I have also tried creating a workflow that checks if the date time field is saved as NULL and then runs a fomula that should populate this field from date Time from SBS_Event__c into the date time field in Event_session__c.
But in my tests this field never gets populated. Please help advise.
- angusgrant
- July 28, 2009
- Like
- 0
- Continue reading or reply
Simple Questions but I cant work out how they are done? User Login and Contact Label Change
First Question:
I have created a number of new users with a particular profile restricting there access to certain data. Before giving each user a login. I wanted to test logging in as the user. How can this be done it seems from the documentation as if I can only login as the user if they allow me permissions to do so? Surely there is a way of testing each user prior to giving each a login? Please help.
Second Question:
How do I change the address contact label names on the Contact object. In the developer account this is set to "mailing street", "mailing zip post code" etc.. however in the enterprise account it is set to "primary street" and "primary zip post code". I wish it to be the "mailing" address not "primary" address. Please advise.
- angusgrant
- July 27, 2009
- Like
- 0
- Continue reading or reply
Test Method help. 63% test coverage thus far.
Im having problems with my apex test method how can i test the following line highligted in red I know the test method is getting into the if statment. i guess what i need to do is test for the existance of a new account? How is this done? I also then need to test the population of this new (database) object account with data? pls advise.
I dont know if its just me but I found the test mehod documentation very poor. On the apex official documentation site it gives examples of test methods without giving the code that the test methods actually relates too. Pls wake up Salesforce there needs to be better documentation vote for idea
thanks for your time
Angus
- angusgrant
- July 06, 2009
- Like
- 0
- Continue reading or reply
Rewrite Apex class with only one SOQL statment not 26!
Hi I have written this apex class for a visualforce page which displays a list of Contacts sorted into Alpahabetical order displayed on a (pdf) page. I know that the way that I have written it will probably result in me hitting some of those governor limits. What I really need to do it write one SOQL statment that I then put into one list that then gets sorted by Surname 1st character and seperated into 26 sepaerate lists. My Apex knowledge is not there yet can somone point me in the right direction? Thanks in advance.
current vf page and result:
current Apex class:
public class attendeecheckinlist2 {
string eventID = System.currentPageReference().getParameters().get('id');
public List<App__c> getApplicant_A() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'A%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_B() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'B%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_C() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'C%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_D() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'D%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_E() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'E%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_F() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'F%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_G() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'G%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_H() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'H%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_I() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'I%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_J() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'J%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_K() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'K%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_L() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'L%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_M() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'M%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_N() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'N%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_O() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'O%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_P() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'P%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_Q() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'Q%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_R() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'R%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_S() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'S%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_T() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'T%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_U() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'U%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_V() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'V%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_W() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'W%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_X() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'X%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_Y() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'Y%' Order by a.Applicant__r.Firstname ];
}
public List<App__c> getApplicant_Z() {
return [Select a.Applicant__c, a.Applicant__r.FirstName, a.Applicant__r.LastName, a.Applicant__r.Salutation from App__c a Where a.SBS_Event__c = :eventID and a.Applicant__r.Lastname like 'Z%' Order by a.Applicant__r.Firstname ];
}
}
- angusgrant
- July 02, 2009
- Like
- 0
- Continue reading or reply
How to create attendee register where there are a dynamic number of sessions
I have created the following database/object scheme: http://www.gliffy.com/publish/1673148/
I am trying to create a dynamic register to allow the marking of attendees(Contacts) as attending or not a given event session for an event.
I have writen some SOQL that returns the data that I require and have created a controller that reurns this data as a list.
However i have come to an issue when I try to use <apex:checkboxes> to allow the checking of applicants as attending a given event session. I get an error Invalid selectOptions found. Use SelectOption type in Apex. How can I do this can I combine 2 lists together?
Controller Code:
public class attendeesbyeventcontroller {
string eventID = System.currentPageReference().getParameters().get('id');
public string eventsessions { get; set;}
public List<App__c> getApplicant() {
return [Select a.name, a.Applicant__r.Email, a.Applicant__r.FirstName, a.Applicant__r.LastName, (Select Attended_Session__c From App_Sessions__r) from App__c a Where a.sbs_event__c = :eventid Limit 40];
}
}
Visualforce:
<apex:page controller="attendeesbyeventcontroller" tabStyle="App_Session__c" >
<apex:form >
<apex:pageblock id="thePage">
<apex:pageblocktable value="{!Applicant}" var="AE" id="candidateTable">
<apex:column value="{!AE.Applicant__r.FirstName}"/>
<apex:column value="{!AE.Applicant__r.LastName}"/>
<apex:column value=" {!AE.Applicant__r.Email}" />
<apex:column >
<apex:facet name="header">Event Sessions</apex:facet>
<apex:selectCheckboxes value="{!eventsessions}">
<apex:selectOptions value="{!AE.App_Sessions__r}"/>
</apex:selectCheckboxes>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
My 2nd concern is regarding governor limits on my SOQL query. Can anyone give me an idea on how many records would need to be returned before I would be hitting those governor limits?
- angusgrant
- June 16, 2009
- Like
- 0
- Continue reading or reply
Test Method not returning querystring values
// Decare Vars from Querystring
String accountrecordtypeid = ApexPages.currentPage().getParameters().get('AccountRecordTypeID');
String contactrecordtypeid = ApexPages.currentPage().getParameters().get('ContactTypeID');
String eventid = ApexPages.currentPage().getParameters().get('eventID');
/* Retrieve current Event name to be displayed in application form.
We also need to handle the circumstances when no event is returned in which case a */
public SBS_Event__c SelectedEvent{
get{
try {
sbs_event = [select Name from SBS_Event__c where ID = :eventid and Display_on_website__c = True and Event_Start_Date__c > Today limit 1];
}
catch (DmlException de){
System.debug('Data exception:'+ de.getMessage());
return null;
}
catch (Exception e) {
System.debug('General exception:'+ e.getMessage());
}
return sbs_event;
}
private set;}
For some reason I cant return any rows from the SOQL marked in red above.
This is my test method in which I am passing in valid querystring paramters
//select random events to test Note there Must be an event in the system ApexPages.currentPage().getParameters().put('AccountRecordTypeID',[Select ID from RecordType Where SobjectType = 'Account' Limit 1].id); ApexPages.currentPage().getParameters().put('ContactTypeID',[Select ID from RecordType Where SobjectType = 'Contact' Limit 1].id); ApexPages.currentPage().getParameters().put('eventID',[select id from SBS_Event__c Where Display_on_website__c = True and Event_Start_Date__c > Today Limit 1].id); SBS_Event__c SBSEvent = extension.SelectedEvent; extension.picklistValue = '0';
see error log below:
20090613120908.297:Class.appExtensionTestClass.testappExtension: line 15, column 74: SOQL query with 1 row finished in 5 ms
20090613120908.297:Class.appExtensionTestClass.testappExtension: line 16, column 68: SOQL query with 1 row finished in 2 ms
20090613120908.297:Class.appExtensionTestClass.testappExtension: line 17, column 62: SOQL query with 1 row finished in 4 ms
20090613120908.297:Class.appExtension: line 38, column 18: SOQL query with 0 rows finished in 2 ms
20090613120908.297:Class.appExtension: line 45, column 4: General exception:List has no rows for assignment to SObject
If I cut and paste the IDs passed through the page to the actual form it works perfectly.
Any ideas?
- angusgrant
- June 13, 2009
- Like
- 0
- Continue reading or reply
Make first Letter for FirstName / LastName Upper case apex visualforce page
How can i convert the firstname and Lastname first character to uppercase?
Sorry I am not a Java coder so am not sure how this is done.
- angusgrant
- June 11, 2009
- Like
- 0
- Continue reading or reply
Can Visualforce display items horizontally
Nomal behaviour in vf tables is to display one object per row of a table, with your desired fields as columns.
I'm trying to create a page where only one field per object is shown but they are displayed horizontally.
<apex:dataTable id="teamtable" value="{!MyTeam}" var="person">
<apex:column > <apex:image url="{!person.Photo_URL__c}" height="150" width="200" /> </apex:column>
<apex:column > <apex:outputText value="{!person.Name__c}" /> </apex:column>
</apex:dataTable>
So this is displaying all the team members vertically with a lot of white space on the right. Ideally I'd like to have 4 or 5 team members photos on a line each with their name underneath. Is this possible in VF ?
- ColinKenworthy1
- June 10, 2009
- Like
- 2
- Continue reading or reply
Using Only Salesforce with No Local Database - Bad Idea?
It would be great to use the SF cloud for website data and forgo the local DB completely. Is this a recommended approach? Are slow responses or timeouts ever an issue?
Thanks.
- James
- espeed
- June 03, 2009
- Like
- 0
- Continue reading or reply
What is the sort order on the dataTable tag?
I wrote the following Visualforce page to be used on our asset object. It works as designed, but the records that are retruned are in a random order. So two questions in reguard to this;
- First, what determines the sort order of the dataTable tag?
- Second, is there an attribute or command that I can use to specify which field is used to sort the data in the dataTable?
<apex: page standardController="Company_Asset__c" standardStylesheets="true" standardStylesheets="true">
<apex:dataTable value="{!Company_Asset__c.Loaner_Instruments__r}" var="LDI"
style="font-family:Arial,helvetica,sans-serif" style="font-size:11px" bgcolor="#F3F3fC" >
<apex:column width="25" rendered="{!Company_Asset__c.Loaner__c}" >
</apex:column>
<apex:column width="85" rendered="{!Company_Asset__c.Loaner__c}" >{!LDI.Name} </apex:column>
<apex:column width="60" rendered="{!Company_Asset__c.Loaner__c}" style="color:red" >
<b>Status:</b>
</apex:column>
<apex:column width="150" rendered="{!Company_Asset__c.Loaner__c}">
{!IF(Contains(LDI.Instrument_Status__c,"flag_red.gif" ), "Checked Out " ,"Checked In " )}
</apex:column>
<apex:column width="150" rendered="{!Company_Asset__c.Loaner__c}" >
<b>Loaner Returned Date:</b>
</apex:column>
<apex:column width="150" value="{!LDI.Loaner_Returned_Date__c}"
rendered="{!Company_Asset__c.Loaner__c}">
</apex:column>
<apex:column width="120" rendered="{!Company_Asset__c.Loaner__c}" style="color:green">
<b>Trade Show Ready:</b>
</apex:column>
<apex:column width="15" value="{!LDI.Inspected__c}" rendered="{!Company_Asset__c.Loaner__c}">
</apex:column>
<apex:column width="100" rendered="{!Company_Asset__c.Loaner__c}">
</apex:column>
</apex:dataTable>
</apex: page>
Any help would be appreciated.
- Kent Manning
- April 24, 2009
- Like
- 0
- Continue reading or reply