0
Dynamic Visualforce& Fieldsets<br />Tim Youngblood<br />Cofounder & CTO<br />
Agenda<br /><ul><li>Intro
Goals
Why Dynamic VF?
Who needs Dynamic VF?
Dynamic aspects of the Force.com platform
Dynamic Visualforce
Fieldsets
Conclusion</li></li></ul><li>Shameless Plug<br /><ul><li>Salesforce.com Consulting/SI/AppExchange Partner
Based in Atlanta and San Francisco
Focus:
Force.com development: both for- and non-profit clients
Data integration:
IBM CastIron™
Dell Boomi™ Partner
AppExchange product development:
Constant Contact InfoTransfer
Digital River, Glance.net</li></li></ul><li>Goals<br />Send you away with some clue as to:<br /><ul><li>When this feature ...
Upcoming SlideShare
Loading in...5
×

Building Robust Applications with Dynamic Visualforce

1,942

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,942
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Building Robust Applications with Dynamic Visualforce "

  1. 1. Dynamic Visualforce& Fieldsets<br />Tim Youngblood<br />Cofounder & CTO<br />
  2. 2. Agenda<br /><ul><li>Intro
  3. 3. Goals
  4. 4. Why Dynamic VF?
  5. 5. Who needs Dynamic VF?
  6. 6. Dynamic aspects of the Force.com platform
  7. 7. Dynamic Visualforce
  8. 8. Fieldsets
  9. 9. Conclusion</li></li></ul><li>Shameless Plug<br /><ul><li>Salesforce.com Consulting/SI/AppExchange Partner
  10. 10. Based in Atlanta and San Francisco
  11. 11. Focus:
  12. 12. Force.com development: both for- and non-profit clients
  13. 13. Data integration:
  14. 14. IBM CastIron™
  15. 15. Dell Boomi™ Partner
  16. 16. AppExchange product development:
  17. 17. Constant Contact InfoTransfer
  18. 18. Digital River, Glance.net</li></li></ul><li>Goals<br />Send you away with some clue as to:<br /><ul><li>When this feature should be considered for a project
  19. 19. What is involved roughly to implement
  20. 20. What are some limitations</li></li></ul><li>Why Dynamic VF?<br /><ul><li>Baggage
  21. 21. Maintenance is the true cost of software
  22. 22. Empower the System Admin is a good philosophy
  23. 23. Code that runs dynamically is really cool</li></li></ul><li>Who needs Dynamic VF?<br /><ul><li>Do you have projects that require fields that change regularly?
  24. 24. Do you have projects that have a large number of fields involved? >100
  25. 25. Geeks: Have you created your own Lists of field name references in code before? You may be a target.</li></li></ul><li>Dynamic Aspects of Force.com<br /><ul><li>SOQL: Database.query(soqlstring)
  26. 26. SObject: superclass
  27. 27. Metadata: Schema
  28. 28. Visualforce: “{!reference[expression]}”</li></li></ul><li>Syntax<br />!reference[expression]<br /><ul><li>Reference: either an SObject or Apex Class
  29. 29. Expression: evals to a string indicating a field or child object
  30. 30. If it evals to a child object, further iteration can occur</li></li></ul><li>Syntax<br /><ul><li>Object1__c.Object2__c[‘Field1__c’]
  31. 31. Object1__c[‘Object2__c. Field1__c’]
  32. 32. Object1__c[‘Object2’][‘Field1__c’]
  33. 33. Object1__c.Relationship__r[Field1__c]
  34. 34. Object1__c[Relationship__r. Field1__c]
  35. 35. Object1__c[Relationship__r][Field1__c]</li></li></ul><li>Examples #1<br />Simple example 1: <apex:repeat> across collection of field names.<br /><apex:repeat value="{!acctFields}" var="field"><br /> <apex:outputText value="{!Account[field]}" /><br /></apex:repeat><br />public List<String> getAcctFields() {<br />returnnew List<String>{'Name', 'Industry', 'AnnualRevenue'};<br />}<br />
  36. 36. Example #2<br />Fairly simple example 2: same across metadata driven field names.<br /><apex:repeat value="{!accountFields}" var="field"><br /> <apex:inputField value="{!Account[field]}" /> <br /></apex:repeat> <br />public List<String> getAcctFields() {<br />Map<String, Schema.SObjectField> fieldmap = Schema.SObjectType.Account.fields.getMap();<br />List<String> fieldlist = new List<String>();<br />for(String fieldname: fieldmap.keyset()) {<br />fieldlist.add(fieldname);<br />} <br />}<br />
  37. 37. Nice<br />This works how you would expect:<br /><ul><li>Rich fields
  38. 38. Field security</li></li></ul><li>Fieldsets<br /><ul><li>Tied to DVF functionality.
  39. 39. Allows configuration of available fields for DVF driven pages.
  40. 40. Are not accessible via Apex Code, as far as I can tell, which is a bit disappointing.
  41. 41. Is there database access to fieldsets? No.
  42. 42. Max of 50 Fieldsets per VF page. </li></li></ul><li>Example #3<br />Painfully simple example 3: simple Fieldset driven DVF page with no controller  I want my MVC!<br /><apex:repeat<br />value="{!$ObjectType.Account.FieldSets.FSName}" var="field"><br /> <apex:inputField value="{!Account[field]}" /> <br /></apex:repeat> <br />
  43. 43. Availability<br /><ul><li>Spring 11 is considered beta but it is found in production orgs.</li></li></ul><li>Goals<br />Send you away with some clue as to:<br /><ul><li>When this feature should be considered for a project
  44. 44. Copious number of fields that change regularly
  45. 45. Repetitive GUI elements
  46. 46. Dynamic section on a standard page is a good use case
  47. 47. What is involved roughly to implement
  48. 48. reference[expression] inside an <apex:repeat>
  49. 49. What are some limitations:</li></li></ul><li>Limitations<br /><ul><li>Page layout control for DVF: no control over order outside of sorting the List.
  50. 50. Fieldsets order can be controlled by config.
  51. 51. Need access to Fieldsets from Apex!
  52. 52. Beta Warning: Don’t tell the client/boss the first time you use this approach, just bask in the efficiency for a bit.</li></li></ul><li>Questions?<br />Thank you!<br /> <br />Tim Youngblood<br />tim@codescience.com<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×