• Jon Mountjoy_
  • SMARTIE
  • 1035 Points
  • Member since 2007

  • Chatter
    Feed
  • 26
    Best Answers
  • 35
    Likes Received
  • 0
    Likes Given
  • 39
    Questions
  • 215
    Replies

Hi, this is my second day toying with Salesforce. I am trying to run the following simple query from an ObjC app:

Select Id, Name, Username, Email, Phone, FullPhotoUrl from User

 

But that query yields an undefined error.

 

If I modify it to :

Select Id, Name, Username, Email, Phone from User

 

Then it works (but of course, I'm not returning the photo...).

 

Is this a security setting? Does anyone know why that could be? I ran the initial query using Soql Xplorer, and it works...

 

Thanks for any help!

 

J.

Im new to salesforce chatter and tried to  update status through the following code

<apex:page>
<apex:form>
<apex:inputText value="{!status}" id="status" maxlength="100" />
<apex:commandLink style="button" value="Update User Status" action="{!doUserStatus}" />
</apex:form>
</apex:page>

but got an error like this "Error: Unknown property 'status' referenced in fFirst1"

plz help me out..?

Hi,

We have designed 1 component which displays some basic informatin to the user let say emails.

We have a VF page on which we would like to show as many components of those as the number of emails that we have.

 

The page controller knows the number of emails and they are kept in a collection.

For example: String [] emails;

if we have two emails we want our VF page to display two of our custom VF components and we want to pass to them emails[0] and emails[1] to display.

 

Any help with this will be appreciated.

 

Kos

 

  • March 14, 2011
  • Like
  • 0

I am new to salesforce.com and am on a self -pace learning with various materials available.  This will be a career change for me but have worked with salesforce.com as a end user. 

 

I am going to build the Recruiting App that is in the Force.com Platform Fundamentals : An Introduction to Custom Application Development in the Cloud.  Since this will be built on the Developers Edition, I know its not "live".  So how do I know if I built it incorrectly or have some errors?  This goes for any future apps that I hope to build on DE.

I would like to use of Chatter API to enable the "Follow" capability on assets in an external (to force.com) system. In other words, we have a website/application that has assets which we are interested in enabling our sales team to "Follow" so that updates to those assets are posted to their Chatter feed in our salesforce.com installation.  We want to put a "Follow" button on one of our non-Force.com hosted sites so it can post updates to Chatter in our salesforce.com installation.

 

Here's an example scenario:

Sally Salesperson finds KillerApp: A Sales Presentation in our site (a non salesforce.com hosted web application) and decides she wants to know about any updates to the document, so she clicks the Chatter "Follow" button next to it.  This posts a quick chatter status to Sally Salespersons Chatter feed indicating "Sally Salesperson is now following KillerApp: A Sales Presentation" (and "KillerApp: A Sales Presentation" has a hyperlink back to that resource on our site).  Sometime later KillerApp: A Sales Presentation is updated on our site (say a new revision is uploaded), at which time Sally Salesperson's Chatter feed is updated with something like "KillerApp: A Sales Presentation has been revised." (again, the document title is a hyperlink). If Sally Salesperson then downloads the updated presentation, a Chatter update like "Sally Salesperson downloaded KillerApp: A Sales Presentation" would be posted.

 

I've been told by salesforce.com online chat support that this is not currently possible and that I should put this idea out here. Does anyone else have this use case?  Anyone have ideas as to how this could be implemented currently?

I have created a set of triggers that block duplicates on Leads,  Contacts and Accounts that are entered through the standard edit screen.   The trigger puts an error message at the top of the edit screen using Trigger.addError() when it blocks a duplicate record from  being created .    I am trying to implement an override button that shows up alongside the error.   I have the button code in place and the button shows up fine.   When clicked, I would like the override button to signal to the trigger that the current record that is being edit should not be blocked.   I need a way to signal to the trigger that the record that is currently being edited should not be blocked.

 

My initial thought was to create a new Custom Settings object that would contain a session ID field.  The override button 'onclick' javascript event handler would insert a new record into the Custom Setting table (by invoking apex class method) that includes the current session ID (UserInfo.getSessionId()).  After the API call, the event handler would auto-click the  “Save” button on the standard edit page.

 

My thought was that the trigger would get the current session Id using UserInfo.getSessionId() and query the Custom settings for a record that matches the the current session ID and is not older than a hard coded time (e.g. 5 seconds).  If it finds a matching record, it exits instead of running the trigger logic.

 

I printed the session ID from the Web Servcie method and again from the trigger and the Ids are different so this approach does not work.

 

Apex WebService method sessionId:

00DA0000000c7YG!AQ4AQE6qc65itrKsrkPRxobinnc_Q7NaaECyv7Iyciu_pLtt_Asz_uISpmDRfpxQQJhV3k_cJCOYrlufnhU7D0zqNXkoCRk6

 

Trigger sessionId:

00DA0000000c7YG!AQ4AQMqmgZYEVoCtC12KYptrbLEbznz8HVvaIFtgf1KvpP5Mb4s6ODZJloN8.8M1rwN0XQ8WppIvT8YA_zxCaDr4hyXNpHv_

 

Does anyone know of something I can use to correlate a new record that is being created in an edit page to a trigger that is invoked when that record is saved?

 

Any ideas or help this would be greatly appreciated.

 

Tom DesJardins

  • February 03, 2011
  • Like
  • 0

public class New2 {

    public  Invoice_Statement__c accc {get; set;}
    public  Line_Items__c accc1 {get; set;}
    public New2(){
    accc =new Invoice_Statement__c();
    accc1 =new Line_Items__c();
    }
        
    public PageReference save() {         
           insert(accc); 
             accc1.Invoice_Statement__c=accc.id;                    
           insert(accc1); 
      return (new ApexPages.StandardController(accc)).view();   
       }  

 

test coverage=50%

 

my test class

 

@isTest
private class invtest {
static testMethod void invtest1() {
New2 invo = new New2();
    Invoice_Statement__c acccc = new Invoice_Statement__c(); 
         acccc.Description__c='desci';
         acccc.Status__c='open'; 
       
                                          
         insert acccc;
      
         
         Line_Items__c acccc1 = new Line_Items__c();
         acccc1.Unit_Price__c=3;
         acccc1.Units_Sold__c=4;
         acccc1.Invoice_Statement__c=acccc.id;
                                      
         insert acccc1;
        
  
          
       
         }
}

I'm a programmer checking out salesforce.

I'm a programmer checking out salesforce.

 

 

I've done tutorials #s 1-4 in the force.com workbook.  Prior to #5 the documentation says you need to create a sandbox and continue the tutorials there.  The documentation says you should find Sandbox under Setup | Data Management.

I'm a programmer checking out salesforce.

 

 

I've done tutorials #s 1-4 in the force.com workbook.  Prior to #5 the documentation says you need to create a sandbox and continue the tutorials there.  The documentation says you should find Sandbox under Setup | Data Management.

 

No Sandbox in that location with my free, developer version - nor anywhere else that I've looked?

  • December 19, 2010
  • Like
  • 0

Hi,

 

Sorry if this post is in the wrong board, feel free to move it to the right place. Could someone at DeveloperForce fix this form on your site please? .

 

http://developer.force.com/sitesgallery/SubmitSite

 

The screenshot of the error message here if it helps.

 

Thanks

 

Sonny

In written english, what I am trying to accomplish is the following:

 

  • Build a visualforce page displaying details for a specific Property__c record
  • For that property, show a list on the page of related child Suite__c records where Status__c = 'Available'
  • For that property, show a list on the page of related child Spec_Sheet__c records where Property__c = 'the id of the property being viewed'
  • Use this visualforce page publically as part of a Force.com Site (meaning, users will not authenticate)

Here is my controller extension:

 

 

public class MyPropertyExtension {

Property__c prop;

public MyPropertyExtension(ApexPages.StandardController PropertyController) {
this.prop = (Property__c)PropertyController.getRecord();
}

public List<Suite__c> getSuiteRecords() {
return [Select s.id, s.Name, s.Status__c, s.Property__c, Total_Raised_Floor_sqft__c, KVA__c, kW_of_UPS__c, Available_PDU_Capacity_kW__c from Suite__c s Where (s.Status__c!= 'Leased') AND (s.Property__c =:ApexPages.currentPage().getParameters().get('id'))];
}

public List<Spec_Sheet__c> getSpecRecords() {
return [Select s.id, s.Name, s.Property__c, s.Suite__c from Spec_Sheet__c s Where (s.Suite__r.Status__c = 'Available') AND (s.Property__c =:ApexPages.currentPage().getParameters().get('id'))];
}
}

 

 

And here is what I have as my test class:

 

 

@isTest
private class TestMyPropertyExtension {

private final Property__c prop;

public TestMyPropertyExtension(ApexPages.StandardController PropertyController) {
this.prop = (Property__c)PropertyController.getRecord();
}

static testmethod void testGetSuitesPositive(){

// Create dummy data for test purposes.
// Always assume your org has no data because the record may not be there later.
Property__c p = new Property__c();
p.Name = 'foo';
System.debug('Inserting the test property record...');
insert p;

Suite__c sAvailable = new Suite__c();
sAvailable.Name ='bar';
sAvailable.Property__c = p.Id;
sAvailable.Status__C = 'Available';
System.debug('Inserting the test suite record with status = Available...');
insert sAvailable;

Suite__c sLeased = new Suite__c();
sLeased.Name ='bar';
sLeased.Property__c = p.Id;
sLeased.Status__c = 'Leased';
System.debug('Inserting the test suite record with status = Leased...');
insert sLeased;

// Use the vf page in my org named 'locatorDetails'
PageReference pageRef = Page.locatorDetails;
Test.setCurrentPage(pageRef);

// Set the id of the current vf page to a Property__c record that I know has child Suite__c and Spec_Sheet__c records
ApexPages.currentPage().getParameters().put('id', p.Id);
TestMyPropertyExtension controller = new TestMyPropertyExtension();

//Call controller.suiteRecords() and assert the list contains the expected records.
List<Suite__c> suiteRecords = controller.suiteRecords();

system.assertEquals(suiteRecords.size(),1);

for(Suite__c s: suiteRecords)
{
System.assertEquals('Available', s.Status__c);
System.assertEquals(sAvailable.Id, s.Id);
}
}

static testmethod void testGetSpecSheetsPositive(){
// Create dummy data for test purposes.
// Always assume your org has no data because the record may not be there later.
Property__c p = new Property__c();
p.Name = 'foo';
insert p;

Suite__c sAvailable = new Suite__c();
sAvailable.Name ='bar';
sAvailable.Property__c = p.Id;
sAvailable.Status__C = 'Available';
insert sAvailable;

Spec_Sheet__c spec = new Spec_Sheet__c();
spec.Name ='bar';
spec.Property__c = p.Id;
spec.Suite__c = sAvailable.Id;
insert spec;

// Use the vf page in my org named 'locatorDetails'
PageReference pageRef = Page.locatorDetails;
Test.setCurrentPage(pageRef);

// Set the id of the current vf page to a Property__c record that I know has child Suite__c and Spec_Sheet__c records
ApexPages.currentPage().getParameters().put('id', p.Id);
TestMyPropertyExtension controller = new TestMyPropertyExtension();

//Call controller.getSpecSheetLookup() and assert the list contains the expected records.
List<Spec_Sheet__c> specRecords = controller.specRecords();
system.assertEquals(specRecords.size(),1);
}
}

 

 

The error message I receive is:

 

 

Error: Compile Error: Constructor not defined: [TestMyPropertyExtension].<Constructor>() at line 39 column 46

 

 

Which has to do with this line in my test class:

 

 

TestMyPropertyExtension controller = new TestMyPropertyExtension();

 

 

I'm not certain why it is giving me a "constructor not defined" error message when I have the constructor at the top of my test class. Here:

 

 

private final Property__c prop;

public TestMyPropertyExtension(ApexPages.StandardController PropertyController) {
this.prop = (Property__c)PropertyController.getRecord();
}

 

Two questions:

 

  1. Can you tell me what the "constructor not defined" error message means, so that I can learn from this?
  2. Can you tell me what I am doing wrong at that particular line where I am receiving the error message?

Recieving the error (NullPointerException) Unable to save resoure(s), when I try to compile the code below. 

 

Any guidance would be greatly appreciated. Thanks in advance.

 

 

public with sharing class TestUpDtCnt {

static testMethod void ActUpdateTest(){
//create the test account
Account a = new Account(Name='My Test Account',
industry='corporate');
insert a;

//create the test contact
Contact c = new Contact(
FirstName='Tester10101',
LastName='Tester10101',
CompanyInterest__c='NetSim',
accountid = a.id);
insert c;

Set<String> accSet = new Set<String>();
List<Contact> cnts = new List<contact>();

for (Account a2 : [select id from Account where name = 'My Test Account'] ){
accSet.add(a2.id);
}

cnts = [Select ID from Contact where accountid in:accSet];

try{
for (Account acct : [select id from Account where id in:accSet]){
for(Contact ct:cnts){
if (acct.Type == 'Customer - Netsim' || acct.Type =='Customer - NetsimOD'){
ct.Customer_Type__c = 'Former';
}
update cnts;
}
}
}catch (System.DmlException e){
System.debug('we caught a dml exception: ' + e.getDmlMessage(0));
}
}
}

 

 

 

I realize I can iterate through all objects in an organization, but this is very expensive (in terms of SOQL queries).

 

Is it on the roadmap to be able to query the SObject metadata to find out if an object is Chatter-enabled, and, if so, when can we expect to see it available?

 

This substantially affects some things I am working on...

 

I am getting the error above.  The code is below. I have systematically removed all code from this trigger to try and pinpoint what is generating this error. This what is left and it still generates the error;

 

 

trigger UpdCnt on Account (after update) {
List<Contact> cnt = new List<Contact>();
}

Obviously this trigger does nothing.  If I take out the one line that's in there it will Save to the Server.  

 

Any suggestions?

 

Austin_Steve

 

 

 

Hi everyone! :) I'm new to Salesforce.. I'm hoping you guys could help me...

First off, I wanna know how can I have that 'CHATTER' app?? 

 

 

Thanks!

Raine

I've got some Chatter enabled objects. How can I automatically make a user follow them with APEX/Visualforce code?

 

There doesn't seem to be a recipe for this yet...

 

 

Logged in from the sysadmin account to another user in order to load some automatically generated sample/test data.  Get this error when it tries to run a for loop in the constructor inserting FeedPosts:

 

"DML currently not allowed"

 

Will report back as I explore further...

If I'm building something and have a question about chatter should I log it on this board or in the chatter dev zone?
Message Edited by mtbclimber on 03-17-2010 03:44 PM

Hi,

 

I have simply copy and pasted this ajax code from the tutorial in a vf page yet it does not seem to be working. Help will be appreciated

 

 

<apex:page> <script type="text/javascript"> var __sfdcSessionId = '{!GETSESSIONID()}'; </script> <script src="../../soap/ajax/18.0/connection.js" type="text/javascript"></script> <script type="text/javascript"> window.onload = setupPage; alert("hi"); function log(message) { alert(message); } function setupPage() { //function contains all code to execute after page is rendered var state = { //state that you need when the callback is called output : document.getElementById("output"), startTime : new Date().getTime()}; var callback = { //call layoutResult if the request is successful onSuccess: layoutResults, //call queryFailed if the api request fails onFailure: queryFailed, source: state}; sforce.connection.query( "Select Id, Name, Industry From Account order by Industry", callback); } function queryFailed(error, source) { source.output.innerHTML = "An error has occurred: " + error; } /** * This method will be called when the toolkit receives a successful * response from the server. * @queryResult - result that server returned * @source - state passed into the query method call. */ function layoutResults(queryResult, source) { if (queryResult.size > 0) { var output = ""; The AJAX Toolkit Sample Visualforce Page Using the AJAX Toolkit //get the records array var records = queryResult.getArray('records'); //loop through the records and construct html string for (var i = 0; i < records.length; i++) { var account = records[i]; output += account.Id + " " + account.Name + " [Industry - " + account.Industry + "]<br>"; } //render the generated html string source.output.innerHTML = output; } } </script> <div id="output"> </div> </apex:page>

 

 I cannot see any output not even that alert("hi") message!!!

 

  • March 17, 2010
  • Like
  • 0

Hello All,

 

I'm in the process of trying to learn as much as I can as quickly as I can about development on the Force.com platform.  I've found a number of resources to look at on the Force.com site, including the incredibly intimidating 2400+ page "How to be Successful with Salesforce" eBook.  There is a huge amount of documentation, and I've found it difficult to tell where to start really, since there are so many eBooks they have available for download, each of which is anywhere from 200 to 600 pages in length

 

If cost were no object, I'd be signing up for the developer courses offered by Salesforce.com:

  1. Dev 401 ($4,000)
  2. Dev 501 ($4,000)
  3. Dev 502 ($2,400)
  4. Dev 531 ($4,000)

 

That is so far beyond my training budget as an independent developer that it's just not even an option.  I got all excited when I saw that perhaps the 401 & 501 classes could be downloaded (for free, no less) as a podcast from the iTunes Music store... but it became quickly apparent that significant chunks of the hands-on coding part of the class are not there, making things difficult to really follow along with from a very early point in the series.  They're still a great source of information, but they seem more like a preview/teaser to the class than a suitable substitute.  I would gladly pay for some sort of online version of the course that was (a lot) less expensive than the in-person class, but no such thing seems to exist.  I would sign up for 3rd party training if it seemed to be of sufficient quality, and again, was affordable... but so far, I've not found anything useful.

 

Can anyone recommend or point me in the direction of some resources I can use to gain the equivalent experience one might get from the courses Salesforce.com provides, without the accompanying bankruptcy forms I'd probably have to fill out if I took those courses?

 

Thanks in advance for any tips, hints or pointers!

 

Cheers,

Jon

Hi guyz, can anyone help me out in creating salesforce Sites.  I tried to do it but failed.

Can anyone explain me the basics involved in creating sites.I mean the steps required for building my personal website.

 

 

I tried creating sites but failed to do so.

 

Please help me out in creating Sites from salesforce.

 

Thanks in advance

shaan

The Force.com Streaming API developer preview lets you push data from your Force.com applications to clients in a secure and scalable way using a persistent HTTP connection. 

 

Join the webinar on July 7 to:

  • Get familiar with typical use cases for this Streaming API 
  • Learn about Comet and persistent HTTP technologies 
  • See the Streaming API in action 
  • Understand the data model 

Access to this developer preview will be very limited. Details of the developer preview will be shared during the webinar .

 

> Sign-up for Webinar

 

 

 

 

 

 

 

Hello All

 

We're consolidating mobile topics on Developer Force - and have launched a new Mobile Resource Page as well as this Mobile Discussion Board.

 

This will be the home for all discussions concerning mobile application development - whether about Salesforce Mobile, or bespoke applications built on iOS, Android and Blackberry etc. using the SOAP/REST web service APIs and OAuth.

 

 

Regards,

Jon

 

If you're using the REST API - check out this new article we've just published:

 

Building Android Applications with the Force.com REST API

 

Thanks

Jon

Will we be able to use the Summer '10 announced URL Rewriting on Ideas on Sites?

 

ie. will I be able to have, instead of 

 

https://foo.force.com/mysite/ideaView?id=087S00000004JhlIAE

 

something like this:

 

https://foo.force.com/mysite/recipe/summer+rocks

 

Thanks

Jon

Hi

 

I have a site (called "protected") with portal setup.  Login on the portal works.

 

I have a page ("foo") on that site. The page just has the words "hello". 

 

How do I prevent:

 

/protected/foo from being accessible if I'm not logged in?  Right now it is. Have I made a mistake? Ideally I'd like all anonymous users to be kicked back to the login prompt.

 

Thanks,
Jon

 

Hi

 

I tried to use the Spring '10 rich text editor field in one of my own Visualforce forms, but it didn't seem to work (online editor complained about the field).  Am I doing something wrong, or is that by design?

 

Thanks,
Jon

The new Adobe® Flash® Builder™ for Force.com is a jointly developed integrated development environment (IDE) that gives developers a single, powerful tool for building cloud-based rich Internet applications (RIAs), which can easily be deployed to end users through the browser via the Adobe® Flash® Player, or directly to the desktop using the Adobe® AIR® runtime. These applications run seamlessly online or offline while taking full advantage of the security, scalability, and reliability of Force.com.

 

Check it out:

http://developer.force.com/flashbuilder

 

We've also got a new discussion board for it as well:

Adobe Flash Builder Discussion Board

 

We've just announced the new Force.com Cloud Developer Challenge!

 

All the details here!

Hi

 

I'm building in authentication using Customer Portal - and the Site class.  This provides methods for logging in, and registration.

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm

 

However, I can't find out how to log out. There is no log out method.  How can I do that?

 

Thanks

Jon

Register for the Summer '09 release preview Force.com Summer ’09 Platform Release Preview webinar! Actually, we have two webinars: one for the platform, and one for salesforce.com applications.

 

The platform webinar, part of the Tech Talk Series, will describe and demonstrate many of the new Force.com features that will be available in Summer '09.

 

Full details on the blog post.

Message Edited by Jon Mountjoy_ on 05-08-2009 08:47 AM

Hi All

 

A new article has just been published on Developer Force:

 

  • An Introduction to Environments (link) - There are several types of environments available to you while developing and testing on Force.com. This article provides an outline of these environments. It will discuss the various editions, best practices and design considerations, and recommend particular environments during the application life-cycle.

 

As always, any feedback is welcome.

 

Thanks,
Jon

Hi All

 

Two new articles for you here:

 

  • An Introduction to Formulas (link) - This article introduces formulas on Force.com. It provides an overview of the syntax for formulas and the operations that are available in formulas. Finally, it provides examples of where formulas can be used on the platform, ranging from default values, to Visualforce and validation rules.
  • An Introduction to Force.com Mobile Application Development (link) - This tutorial provides an introduction to Force.com Mobile application development. It shows how to deploy a Force.com application to a mobile device, and sketches the additional functionality that you get out of the box.

 

As always, any feedback is welcome.

 

Thanks,
Jon

Learn about the Apex programming language and how it is used on Force.com in this webinar, recorded in April 6.

 

View the webinar here:  Tech Talk Series: Introduction to Apex Code

 

Regards,
Jon

Hi

 

ie. how can I pass a parameter to a "page" component's "action" method? 

 

I have a simple Visualforce page 

 

<apex:page controller="JoinController" action="{!go}"/>

 

 with a simple controller

 

public class JoinController {

public PageReference go() {
PageReference regPage = new PageReference('http://wiki.developerforce.com/events/regular/registration.php');

regPage.getParameters().putAll(ApexPages.currentPage().getParameters());
return regPage;
}
}

 

 

(It redirects, copying the HTML params)

 

What I'd prefer to do is parameterize go().   Can you recommend how I do that?  ie. I want to write this

 

 

<apex:page controller="JoinController" action="{!go}">
<apex:param assignTo="{!website}" value="http://wiki.developerforce.com/events/regular/registration.php"/>
</apex:page>

 

 But param doesn't appear to be supported for a page component.  

 

Any ideas how I can solve this?

 

Thanks,

Jon 

 

 

 

 

 

Check out this great webinar recorded last week:  Webinar: A Practical Overview of Building Apps on Force.com

It does what it says on the tin, and provides a practical introduction to key processes and technologies used in building native applications on the Force.com platform.  

As described in the webinar writeup, the webinar includes:

 

  • Building an application's data model, business logic, and user interface
  • Integrating with external systems
  • The development and deployment process 

 

Message Edited by Jon Mountjoy_ on 03-05-2009 12:42 AM

In case you missed it, you can now watch the archived webinar of  Multitenant Magic - Under the Covers of the Force.com Data Architecture - Multitenant Magic - Under the Covers of the Force.com Data Architecture.  The associated FAQ is also well worth a read.

 

This is from the webinar introduction:

The Force.com platform scales to support over 51,000 organizations and upwards of 150 million transactions a day. It does this using a metadata-driven multitenant SaaS architecture pioneered by salesforce.com, which lies at the heart of all Force.com applications. 

Watch this webinar—and discover how the innovative multitenant architecture scales to your application needs. 

This recorded webinar explains the capabilities of multitenancy, including:

 

  • Our multi-tenant ethos, where everything is shared, including the database
  • Metadata-composed applications and the Force.com application runtime
  • The patent-pending database and application server technology
  • Managed procedural development via Apex Code 

Enjoy 

 


Message Edited by Jon Mountjoy_ on 03-05-2009 12:37 AM

I've just posted a blog about integrating with Force.com.  As I say, there are so many ways to integrate:

 

For example:


    • Callouts to external SOAP Web services - just slurp in the WSDL and generate.

    • Expose Apex Code methods as external Web services - which auto-generates WSDL for your clients.

    • The Force.com Web Services API - the über Web services API for your data, which magically updates as you add persistent objects etc. Lots of tooling is already built around this API.

    • The very interesting Metadata API - giving you programmatic control of your programs - treating them as metadata.

    • Email handlers in Apex - so that you can react to incoming email

    • Email output - so that you can send email

    • Outbound messaging - allowing you to send SOAP messages on data changes, usually triggered by workflow rules.

    • HTTP support, and hence REST support

    • and last, but not least, Force.com Sites (public pages can be a form of integration), and Force.com Sites Syndication Feeds (Atom goodness) - though you can only do these in Developer Edition accounts right now.

    Read on for more.

     

    As you've probably just seend, we've just rolled out a new feature on the discussion boards called Accepted Solutions (AS).

     

    I've posted all the details on the blog - please take a read - and let me know how it goes!

     

    Regards,
    Jon

    We recently published Ten Common Mistakes Architects Make When Building a Force.com Application. As I wrote in my blog post, "Force.com makes it easy to create applications. But take a minute to think about architecting solutions as well." 

     

    Feedback welcome.

     

    Regards,
    Jon

    test post ignore

     

    Here is some code 1 2 3 4 5 hello a b c d e A B C D E

     Thank you.

     

    Hi All

     

    A new article has just been published on Developer Force:

     

    • An Introduction to Environments (link) - There are several types of environments available to you while developing and testing on Force.com. This article provides an outline of these environments. It will discuss the various editions, best practices and design considerations, and recommend particular environments during the application life-cycle.

     

    As always, any feedback is welcome.

     

    Thanks,
    Jon

    Hi All

     

    Two new articles for you here:

     

    • An Introduction to Formulas (link) - This article introduces formulas on Force.com. It provides an overview of the syntax for formulas and the operations that are available in formulas. Finally, it provides examples of where formulas can be used on the platform, ranging from default values, to Visualforce and validation rules.
    • An Introduction to Force.com Mobile Application Development (link) - This tutorial provides an introduction to Force.com Mobile application development. It shows how to deploy a Force.com application to a mobile device, and sketches the additional functionality that you get out of the box.

     

    As always, any feedback is welcome.

     

    Thanks,
    Jon

    Learn about the Apex programming language and how it is used on Force.com in this webinar, recorded in April 6.

     

    View the webinar here:  Tech Talk Series: Introduction to Apex Code

     

    Regards,
    Jon

    Hi

     

    ie. how can I pass a parameter to a "page" component's "action" method? 

     

    I have a simple Visualforce page 

     

    <apex:page controller="JoinController" action="{!go}"/>

     

     with a simple controller

     

    public class JoinController {

    public PageReference go() {
    PageReference regPage = new PageReference('http://wiki.developerforce.com/events/regular/registration.php');

    regPage.getParameters().putAll(ApexPages.currentPage().getParameters());
    return regPage;
    }
    }

     

     

    (It redirects, copying the HTML params)

     

    What I'd prefer to do is parameterize go().   Can you recommend how I do that?  ie. I want to write this

     

     

    <apex:page controller="JoinController" action="{!go}">
    <apex:param assignTo="{!website}" value="http://wiki.developerforce.com/events/regular/registration.php"/>
    </apex:page>

     

     But param doesn't appear to be supported for a page component.  

     

    Any ideas how I can solve this?

     

    Thanks,

    Jon 

     

     

     

     

     

    Check out this great webinar recorded last week:  Webinar: A Practical Overview of Building Apps on Force.com

    It does what it says on the tin, and provides a practical introduction to key processes and technologies used in building native applications on the Force.com platform.  

    As described in the webinar writeup, the webinar includes:

     

    • Building an application's data model, business logic, and user interface
    • Integrating with external systems
    • The development and deployment process 

     

    Message Edited by Jon Mountjoy_ on 03-05-2009 12:42 AM

    In case you missed it, you can now watch the archived webinar of  Multitenant Magic - Under the Covers of the Force.com Data Architecture - Multitenant Magic - Under the Covers of the Force.com Data Architecture.  The associated FAQ is also well worth a read.

     

    This is from the webinar introduction:

    The Force.com platform scales to support over 51,000 organizations and upwards of 150 million transactions a day. It does this using a metadata-driven multitenant SaaS architecture pioneered by salesforce.com, which lies at the heart of all Force.com applications. 

    Watch this webinar—and discover how the innovative multitenant architecture scales to your application needs. 

    This recorded webinar explains the capabilities of multitenancy, including:

     

    • Our multi-tenant ethos, where everything is shared, including the database
    • Metadata-composed applications and the Force.com application runtime
    • The patent-pending database and application server technology
    • Managed procedural development via Apex Code 

    Enjoy 

     


    Message Edited by Jon Mountjoy_ on 03-05-2009 12:37 AM

    I've just posted a blog about integrating with Force.com.  As I say, there are so many ways to integrate:

     

    For example:


      • Callouts to external SOAP Web services - just slurp in the WSDL and generate.

      • Expose Apex Code methods as external Web services - which auto-generates WSDL for your clients.

      • The Force.com Web Services API - the über Web services API for your data, which magically updates as you add persistent objects etc. Lots of tooling is already built around this API.

      • The very interesting Metadata API - giving you programmatic control of your programs - treating them as metadata.

      • Email handlers in Apex - so that you can react to incoming email

      • Email output - so that you can send email

      • Outbound messaging - allowing you to send SOAP messages on data changes, usually triggered by workflow rules.

      • HTTP support, and hence REST support

      • and last, but not least, Force.com Sites (public pages can be a form of integration), and Force.com Sites Syndication Feeds (Atom goodness) - though you can only do these in Developer Edition accounts right now.

      Read on for more.

       

      As you've probably just seend, we've just rolled out a new feature on the discussion boards called Accepted Solutions (AS).

       

      I've posted all the details on the blog - please take a read - and let me know how it goes!

       

      Regards,
      Jon

      We recently published Ten Common Mistakes Architects Make When Building a Force.com Application. As I wrote in my blog post, "Force.com makes it easy to create applications. But take a minute to think about architecting solutions as well." 

       

      Feedback welcome.

       

      Regards,
      Jon

      test post ignore

       

      Here is some code 1 2 3 4 5 hello a b c d e A B C D E

       Thank you.

       

      Hi All

      The discussion boards are going to get a few tweaks tonight - somewhere between midnight and 4am PDT.  During the upgrade itself, the discussion boards won't be available - sorry about that!

      If all goes well, you won't notice any difference - though it will allow us to switch on a new feature or two in the coming weeks!  If you find something has broken, please email me: j mountjoy at salesforce dot com.

      Thanks,
      Jon
      Hi all

      We've just published a new article:
      An Introduction to Apex Code Test Methods

      Here's the abstract:

      To facilitate the development of robust, error-free code, Apex Code requires the creation and execution of unit tests. Unit tests are comprised of test methods and classes that verify whether a particular piece of code is working properly.

      This article introduces test methods. It details why test methods are a critical part of Force.com application development, test method syntax, best practices, and advanced topics such as test methods for Visualforce controllers and Apex web service callouts.

      Enjoy! (And if you want to contribute an article, feel free to ping me)

      Jon

      --
      Jon Mountjoy ||  Community Manager || http://developer.force.com/

      chal.png
      As Bulent points out, we had record numbers attending our Force.com Sites webinar last week, during which we announced the Force.com Sites Developer Challenge.

      The challenge page has all the details, but in short the rules are pretty simple: "You can use any or all parts of the Force.com platform, as long as you use Force.com Sites, and you can submit as many applications as you like." And you have a month to do it in - submissions close on January 9 January 30.

      That's it! Create anything, as long as you use Force.com Sites. And Sites enables an entirely new breed of applications, so I'm really looking forward to seeing what you folk submit. If you're new to Sites and Visualforce, we have a couple of challenges that you can use to get you started. See the Developer Challenge Guide for details.

      Oh, we'll be handing out a number of prizes too! Developer Challenge t-shirts, iPod Nanos, iPod Touches and more!

      Here are some handy resources: Happy coding!
      Jon

      Message Edited by Tran Man on 01-06-2009 04:16 PM
      As I've just blogged, we've just released Force.com for Google App Engine!

      Force.com for Google App Engine is a Python library and test harness that lets you access the Force.com Web services API from within Google App Engine applications. Once it is installed in your Google App Engine application, that application can start to seamless make callouts to the Force.com Web services API. This API lets you query and manipulate data in your Force.com environment - effectively letting you tap into the Force.com platform from within the application.

      So if you're looking at building consumer apps on Google App Engine, and want to connect 'em with your data on the Force.com platform, check out the library!

      Jon
      Welcome to this new discussion board.  Post your questions, comments and discussions about Force.com Sites to this board.  If you have questions about pure Visualforce, post those to the Visualforce discussion board.

      Thank you
      Jon
      Message Edited by Jon Mountjoy_ on 06-14-2009 11:10 PM
      Development is made so much easier when you have access to open source applications and code that you can simply download and start using. You can now do this even more easily in the Developer Force community with the launch of Code Share, a directory of open source code projects built around the Force.com platform.

      To learn more about Code Share, check out my blog post that describes it and its use!

      Thanks
      Jon
      The Force.com IDE, a powerful client application for developing, testing and deploying Force.com applications, is now Generally Available. 

      You can find all the details and links on Jon's blog post.

      Regards,
      Jon
      There's a new Salesforce Mobile version for the iPhone (with add/edit/delete), and your new DE org mobile licenses let you connect.  I've blogged all the details.

      Regards,
      Jon
      I can successfully create an object and tab using the metadata API.  However, the tab isn't visible by default (uh), so I have to change the user profile information to correct.

      However, when I try and do this using the update() method I get
      UNKNOWN_EXCEPTION
      An unexpected error occurred.

      Can you tell me how to do the tab visibility update?  Am I doing something wrong?

      Profile p = new Profile();
      ProfileTabVisibility ptv = new ProfileTabVisibility("MyCustomObject__c",TabVisibility.DefaultOn );
      ProfileTabVisibility[] tabVisibilities = new ProfileTabVisibility[] {ptv };
      p.setTabVisibilities(tabVisibilities);
      UpdateMetadata pum = new UpdateMetadata("Admin", p);
      AsyncResult[] ars3 = (AsyncResult[]) metadatabinding.update(new UpdateMetadata[] { pum });

       The tab does exist, it does have that name, and the "Admin" profile does exist.

      Thanks
      Jon

      Hi

      If you want to stay on the cutting edge, you'll want to attend the Winter '09 Developer Highlights webinar.   October 7 @ 10:00 am PT

      For a taster, check out our Winter '09 page on the wiki.

      The webinar will cover many of the new features that are just about to be made available to you - new features ranging from paged Visualforce controllers to advanced SOQL joins.  See you there!

      Regards,
      Jon
      Hi

      I'm using a simple standard selectRadio Visualforce component, with selectOptions inside, just like that documented in the Visualforce developer's guide (and online help). However, I can't find any attribute on either of these components that lets me specify the default button.

      In particular, I display a rating, 1 2 3 4 5. Currently it defaults to 5, which is fatal.

      How do I specify which option will be the default? Am I missing something?

      Thanks!
      Jon
      From the blog:
       We're holding a webinar on Force.com Toolkit for Google Data APIs: Everything You Need to Know

      July 30 at 10:00am PST

      Hope you can make it.

      Regards,
      Jon
      I've just announced the Force.com Migration Tool Guide over on the blog

      (stay tuned for my blog if you want to be sure to get all of the announcements and community updates)

      Regards,
      Jon
      I've just posted the next community update.

      Click through to the blog for the full update. Here's the introduction:

      It's been far too long since the previous community update. To be fair, I have been doing a fair bit of traveling, mostly on the Tour de Force. Check out our videos from the Dublin event for a taste. In the interim we've released the awesome Google Data API Toolkit, and a new version of the Force.com IDE.

      Besides the events, I've been doing a fair bit of blogging and learning about the platform. Right now I'm spending a lot of time pruning the wiki. I hope to make a few improvements, including making things a little easier to find. I've also started to use some of the wiki capabilities such as categories. So for example, here is a page of multimedia items on the wiki. It's not complete yet, but I hope you find it useful. Feel free to ping me about the wiki and any changes you would like to see (or not to see :-) ).

      Enjoy the rest of this post, wherein I point to most of the new items that have appeared on developer.force.com recently.

      Regards,
      Jon
      --
      Jon Mountjoy || Community Manager || http://developer.force.com/
      After a lot of debugging, I figured out why a component of mine was behaving weirdly.  It turns out the setter wasn't being called to set the value from the passed attribute.  Moreover, it turns out it *only* doesn't work if the attribute defined in the component shares the same name as the variable in the controller.  This seems very weird - I see no such restriction in the documentation, and it compiles just fine - it just silently fails.

      Am I doing something wrong? 

      Thanks
      Jon


      Here's my code.

      Here's my Apex class that the component uses:
      public class jonTest {
        public Integer yikes = 5;
        public Integer getYikes() { return yikes; }
        public void setYikes(Integer oops) { 
           yikes = oops; 
           System.debug('******' + oops); 
        }
      }


      Not much here at all.  Note the attribute is called 'yikes'.

      Now define a component:

      <apex:component controller="jonTest">
      
        <apex:attribute name="um" 
           description="um" 
           type="Integer" 
           assignTo="{!yikes}"/>
      
      </apex:component>

      Note the attribute is called 'um'.
       
      Now in my Visualforce page I have this:
       <c:foo um ="44"  />

       If you access the page with the log window open, you'll see that the setter, setYikes(), is indeed called. Everything works.

      Now change the component definition code to read like this instead:

      <apex:component controller="jonTest"> 
      
      <apex:attribute name="yikes" 
      description="um" 
      type="Integer" 
      assignTo="{!yikes}"/> 
      
      </apex:component>

      The only thing changed here is the name, to "yikes" - which now correlates with the variable name in the controller.
      Now make the corresponding change in the Visualforce page:
         <c:foo yikes ="44"  />

       The result is no output in the debug window.  The setter isn't called at all. 

      I'm on sandbox, cs2, if that makes any difference.

       

       

      Hi

      How do I create a workflow rule that will fire when a new note is attached to an object? (I'm using standard Notes & Attachment functionality)

      Is there any other way to start an action if a new note is added? (I want to send an email whenever a new note is created and attached).

      Thanks!
      Jon
      I have a Visualforce page that renders as PDF (depending on an incoming parameter) when a button is pushed.
      However, if that button has a "rendered" attribute, then the PDF fails to render for some reason.  (I don't want the button rendered if I'm producing a PDF, as I don't want to see it in the PDF). Instead, the page simply refreshes.  This seems a little odd - any idea what's up?

      Here' s the page:
      <apex:page renderAs="{!chooserender}" controller="MyController" > 
        <apex:pageBlock title="Some Page Block">
         <apex:pageBlockSection title="Section 1"> Text </apex:pageBlockSection>
         <apex:pageBlockSection title="Section 2"> Text </apex:pageBlockSection>
        </apex:pageBlock>
        
        <apex:form >
        <apex:commandLink rendered="{!$CurrentPage.parameters.p == null}"  value="PDF" action="{!deliverAsPDF}" target="_blank"></apex:commandLink>
        </apex:form>
      
      </apex:page>

       Here's the controller:
      public class MyController {
      
        public String getChooserender() {
           if (ApexPages.currentPage().getParameters().get('p') != null)
              return 'pdf';
              else
            return null;
        }
      
        public PageReference deliverAsPDF() {
            PageReference pdf =  Page.foo;
              pdf.getParameters().put('p','p');
              return pdf;
        }
      
      }
      

      I've blogged about this (sans problem) here.
       
      I know I can solve my problem in a different way (style sheets come to mind), but I'd really like to figure out why, when a button has a rendered='false', it no longer generates a PDF. (I mean, I've already pushed it, and an action is occuring, so whether the button itself is present or not in the result shouldn't matter?)

      Thanks!




      What's the best way to ensure I see every new community message?

      RSS feed?

      Shame there isn't an app for the boards too.

      Hi there,

      I am looking to find any information if any one has already done this as yet.

      Coded a dll that can connect to a SalesForce API.

       

      What I am looking to do is this...

      Have a Trading indicator/strategy running in a trading platform (MulitCharts/TradeStation)

      so the indicator code can check to see if it can be used by a client or not.

       

      If there is anyone that can point me in the right direction or may even help with this, I would greatly appreciate the help.

       

      Many thanks,

       

      John

       

      jrtrader@orcon.net.nz

       

      The Force.com Streaming API developer preview lets you push data from your Force.com applications to clients in a secure and scalable way using a persistent HTTP connection. 

       

      Join the webinar on July 7 to:

      • Get familiar with typical use cases for this Streaming API 
      • Learn about Comet and persistent HTTP technologies 
      • See the Streaming API in action 
      • Understand the data model 

      Access to this developer preview will be very limited. Details of the developer preview will be shared during the webinar .

       

      > Sign-up for Webinar

       

       

       

       

       

       

       

      Hi,

      Just read this article on "Force.com as a Google Visualization Data Source"

      http://wiki.developerforce.com/index.php/Force.com_as_a_Google_Visualization_Data_Source

      Wanted to find out if that is still the current technical path to
      getting Force.com data into iGoogle.  Also curious if that use case is
      common among salesforce.com users. Also looking for any other similar

      technical articles.

      Hi,

       

      I'm greatly enjoying my journey into developing Force applications. I am new to this but not to programming in general.

       

      I am doing the MileageTracker work book and everything was fine until I started work on the Unit Tests.

       

      My negative tests are in a try catch block identical to the tutorial - I even copied and pasted the code - it saves ok but when I run the test the test fails. I know the code should throw an exception but it is as though it is not being caught?

       

      Here is what I see in the debug log...

      =======================

      00:18:50.419 (419341000)|EXCEPTION_THROWN|[99]|System.AssertException: Assertion Failed: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Mileage request exceeds daily limit: 500: []
      00:18:50.419 (419562000)|FATAL_ERROR|System.AssertException: Assertion Failed: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Mileage request exceeds daily limit: 500: []

      Class.MileageTrackertestSuite.runNegativeTestCases: line 99, column 13
      External entry point

       

      ======================

       

      So, my question is, has anyone else encountered this and how do I overcome it and get a green light on the test?

       

      Many thanks,

       

      Ian

      Hi, this is my second day toying with Salesforce. I am trying to run the following simple query from an ObjC app:

      Select Id, Name, Username, Email, Phone, FullPhotoUrl from User

       

      But that query yields an undefined error.

       

      If I modify it to :

      Select Id, Name, Username, Email, Phone from User

       

      Then it works (but of course, I'm not returning the photo...).

       

      Is this a security setting? Does anyone know why that could be? I ran the initial query using Soql Xplorer, and it works...

       

      Thanks for any help!

       

      J.

      Hi Guys,

       

      I am new to the cloud !!  I have a client with a Saleforce / Glovia system, and a wordpress website.  I would like to pull out the prroduct data from their system and display it on the website, so customers can browse their stock, and then have a place order function, for account customers only, which will create maybe a lead in salesforce.

       

      Any ideas on the best way to do this would be gratefully accepted !!  If it's too complicated, I can just replicate the data - but that is not obviously ideal !

       

      Many Thanks

      Emma

      Hi all,

       

      This is probably quite simple, but I haven't found any sample code anywhere, yet: How can I post to a certain from using the Chatter API?

      The background is that a user wants to batch-post the same item to several groups in one go, so I want to built a little utility app that grabs the latest post by that user and copies it to several groups.

      Any ideas?

       

      Kind regards,

       

      Martin

       

      Im new to salesforce chatter and tried to  update status through the following code

      <apex:page>
      <apex:form>
      <apex:inputText value="{!status}" id="status" maxlength="100" />
      <apex:commandLink style="button" value="Update User Status" action="{!doUserStatus}" />
      </apex:form>
      </apex:page>

      but got an error like this "Error: Unknown property 'status' referenced in fFirst1"

      plz help me out..?

      Hi,

      We have designed 1 component which displays some basic informatin to the user let say emails.

      We have a VF page on which we would like to show as many components of those as the number of emails that we have.

       

      The page controller knows the number of emails and they are kept in a collection.

      For example: String [] emails;

      if we have two emails we want our VF page to display two of our custom VF components and we want to pass to them emails[0] and emails[1] to display.

       

      Any help with this will be appreciated.

       

      Kos

       

      • March 14, 2011
      • Like
      • 0

      Hi Guys,

       

      I am trying to create Report using visual force and controller. I have made visual force page   but writing controller for this I'm finding difficult. Can anyone please provide some sample code.

       

       

      Thanks,

      Rajiv

      • March 14, 2011
      • Like
      • 0

      Hi All,

       

          We have written an apex class for multiple line items, but facing problem in writing the test case for the same.  So, could any one please suggest a solution to the making the test case successful. 

       

       

      Apex Code:

       

       

      public class DEV_MULTIPLE_InvoiceLineEntry {

          public List<Invoice_Line_Item__c> ords {get; set;}
          private final Invoice__c parOrd;
          public DEV_MULTIPLE_InvoiceLineEntry(ApexPages.StandardController myController) {
              parOrd=(Invoice__c)myController.getrecord();
              ords = new List<Invoice_Line_Item__c>();
               // Get the Current User
           user u1 =[select id ,name,Formula_Warehouse__c from user where id=:UserInfo.getUserId()];
               //Get The DefaultwareHouse for the user
           Warehouse__c[] w1 =[select id,name from Warehouse__c where name =: u1.Formula_Warehouse__c or name = null];
           
           // Condition to Check if Formula_Warehouse__c =null, if null Item_Warehouse__c on page is NULL
              if(u1.Formula_Warehouse__c ==null){
              Invoice_Line_Item__c LitOrd = new Invoice_Line_Item__c();
            
              LitOrd.Invoice_Number__c = parOrd.id;
              LitOrd.quantity__c=1;
             
              ords.add(LitOrd);
               
              }
              // Condition to Check if Formula_Warehouse__c !=null, if ! null Item_Warehouse__c on page is warehouse id(only ids display names in Lookups)
              else if(u1.Formula_Warehouse__c !=null){
              
              Invoice_Line_Item__c LitOrd = new Invoice_Line_Item__c();
            
              LitOrd.Invoice_Number__c = parOrd.id;
              LitOrd.quantity__c=1;
              LitOrd.Item_Warehouse__c =w1[0].id;
              ords.add(LitOrd);
              }
              }
              
             

          public void addrow() {
          
              // Get the Current User
           user u =[select id ,name,Formula_Warehouse__c from user where id=:UserInfo.getUserId()];
               //Get The DefaultwareHouse for the user
           Warehouse__c[] w =[select id,name from Warehouse__c where name =: u.Formula_Warehouse__c];
               // Condition to Check if Formula_Warehouse__c =null, if null Item_Warehouse__c on page is NULL
           if(u.Formula_Warehouse__c ==null){
              Invoice_Line_Item__c LitOrd = new Invoice_Line_Item__c();
              LitOrd.Invoice_Number__c = parOrd.id;
              LitOrd.Quantity__c=1;
             
              ords.add(LitOrd);
              }
              // Condition to Check if Formula_Warehouse__c !=null, if ! null Item_Warehouse__c on page is warehouse id(only ids display names in Lookups)
                      
              else if(u.Formula_Warehouse__c !=null){
              
              Invoice_Line_Item__c LitOrd = new Invoice_Line_Item__c();
              LitOrd.Invoice_Number__c = parOrd.id;
              LitOrd.quantity__c=1;
              LitOrd.Item_Warehouse__c =w[0].id;
              ords.add(LitOrd);
              
              }   
                 
              }  
                 
                  
          public void removerow(){
              Integer i = ords.size();
              ords.remove(i-1);}
                  
          public PageReference save() {
              insert ords;
             // PageReference home = new PageReference('/home/home.jsp');
              return(new ApexPages.StandardController(parOrd)).view();
             // home.setRedirect(true);
             // return home;
               }
              
              }

       

       

       

      Thanks and Regards

       

      Arun

      Hello freinds recently i am facing a starnge issue that all sites related to bloga such as "blog.sforce.com" or on clicking on "blog" link in website "Developer.force.com" the message displayed "could not connect to "blog.sforce.com"  I have checked in chrome, Mozilla and IE in all browsers the blogs are not opening. I don't why what has happened. but since 1 month i am facing this issue. Please suggest Me solution.

       

      Regards

      Raumil Setalwad

      Hi Code Gurus,

       

      Can someone plesae tell if we can use a List of standard objects with all its available methods like size() etc in a constructor?

       

       

      this.email_c = parameters.get('PersonEmail');
              this.dup = [SELECT id from Account WHERE PersonEmail =: email_c];
              if(dup.size()>0){	
              	this.duplicatelead = true;
              }

       this code should set the duplicatelead to true everytime there's a duplicate record on the basis of email. But its not happening, the list size stays 0 always. Any idea why?

       

      It seems like this should be simple, but...

      I have created a custom controller that selects sessions and their related speakers. I have a visualforce page that displays this information. All is working fine, but I need to get it moved to production. I've been reading about testing and searching the discussions but I can't get what exactly I need to test for, since my controller doesn't do anything, as far as writing any records, there are no buttons or input accepted on the visualforce page, nothing is passed in the url, it simply displays a list of sessions and speakers. I really need to get a test written so I can get this moved out of sandbox - can anyone help? Any suggestions are appreciated! Thank you.

      Below is the controller and page.

       

      public class SessionListingController
      {
          public String pitem { get; set; }
          Public List<WrapperSession> mainListSession {get;set;}
          Public List<Speaker__c> lstSpeaker {get;set;}
              
          public  SessionListingController()
          {
          mainListSession = new List<WrapperSession>();
          
          for (Session__c a : [SELECT id, name,Session_End_Time__c, Session_Abstract__c,
             Session_Code__c, Session_Start_Time__c, Session_Start_Date_Time__c,
                  (SELECT Name, NameTitle_Org_St__c, Web_Speaker__c,  Speaker__c.Contact__r.Photo__c FROM speaker__r 
                   WHERE Web_Speaker__c = 'CONFIRMED' ORDER BY Speaker_Order__c) 
             FROM session__c 
             WHERE Session__c.Event__r.Name = 'My Test Meeting' And Published__c = True
                 ORDER BY Session_Start_Date_Time__c, Session_Code__c]) 
          {
          WrapperSession wrapSess = new WrapperSession();
          wrapSess.sess = a;
          Speaker__c[] speakers = a.speaker__r;
          lstSpeaker = new List<Speaker__c>();
          For(Speaker__c speaker : speakers)
          {
              lstSpeaker.add(speaker);
          }
         
          wrapSess.speaker = lstSpeaker;
          mainListSession.Add(wrapSess);
          }
      
          
          }
          public class WrapperSession     // this is the wrapper class
          {
          public Session__c sess{get;set;}     //to capture the Session
          public List<Speaker__c> speaker {get;set;}  // to capture the related Speaker
          }
          
           
      }

       VF page:

       

      <apex:page standardStylesheets="false" showHeader="false" sidebar="false" Controller="SessionListingController" cache="false">
        <apex:outputText value="Meeting Sessions" />
         <apex:dataTable value="{!mainListSession}" var="lw" >
             <apex:column headerValue=" ">
             <br></br>
             <apex:outputField value="{!lw.sess.Session_Start_Time__c}"/><br></br>
             <strong><apex:outputField value="{!lw.sess.Name}" /></strong>
             <br></br><apex:outputField value="{!lw.sess.Session_Abstract__c}" />
             <apex:outputPanel rendered="{!lw.sess.Session_Abstract__c!=''}"> <br /></apex:outputPanel>
             
             <apex:dataTable value="{!lw.speaker}" var="lwNote">
                  <apex:column headerValue="  "  >
                  <apex:outputField value="{!lwNote.NameTitle_Org_St__c}"  />
                  </apex:column> 
             </apex:dataTable>
            </apex:column>
        </apex:dataTable>
      </apex:page>

       

       

       

      • March 08, 2011
      • Like
      • 0