第二回Salesforce勉強会

1,220 views

Published on

11/16に開催されたForce.com開発者セミナー第2回の資料です。

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

第二回Salesforce勉強会

  1. 1. Salesforce.com 2011.11.16 Salesforce.com11 11 16
  2. 2. • Visualforce • Visualforce • • • Rich UI(Flash )11 11 16
  3. 3. Visualforce • Visualforce Rich UI11 11 16
  4. 4. Visualforce • •[ ]➤[ ]➤[ ] •[ ] •[ ] [ ]11 11 16
  5. 5. Visualforce • •[ ]➤[ ]➤[ ] •[ ] •[ ] [ ] •[ ] [testPage] •[ ]11 11 16
  6. 6. Visualforce • • apex/testPage (https://XXXX.salesforce.com/apex/testPage) ※11 11 16
  7. 7. Visualforce • • testPage • This is your new Page This is my Test Page •11 11 16
  8. 8. Visualforce •11 11 16
  9. 9. Visualforce • •<apex:page> sidebar="false" showHeader= "false" (<apex:page sidebar="false" showHeader="false">) • ※ showHeader true11 11 16
  10. 10. Visualforce • •Page Editor [Component Reference] ( )11 11 16
  11. 11. Visualforce • •<apex:pageBlock> •[Usage] •<!-- Begin Default Content REMOVE THIS --> <!-- End Default Content REMOVE THIS -->11 11 16
  12. 12. Visualforce • •<apex:page> <apex:pageBlock> title A Block Title •<apex:pageBlock> <apex:pageBlockSection> title A Section Title •<apex:pageBlockSection> </apex:pageBlockSection> Detail Text •11 11 16
  13. 13. • SFDC11 11 16
  14. 14. • • pageBlock title {! $User.LastName} • ※{! ... } Visualforce {! ... }11 11 16
  15. 15. • • pageBlockSection Todays Date is {! TODAY() } • http://www.salesforce.com/us/developer/docs/pages/Content/ pages_variables_global.htm11 11 16
  16. 16. • • Todays Date is {! TODAY() } <apex:outputText value="Todays Date is : {0,date,yyyy/MM/dd}"> <apex:param value="{!TODAY()}" /> </apex:outputText> •11 11 16
  17. 17. • • {!IF( ISNULL(TODAY()), "", CASE( MOD( TODAY() - DATE(1900, 1, 7), 7 ), 0, "( )", 1, "( )", 2, "( )", 3, "( )", 4, "( )", 5, "( )", "( )" ) )} •11 11 16
  18. 18. • Visualforce MVC Model = View = Controller =11 11 16
  19. 19. • •testPage <apex:page> standardController Account • Detail Text {!account.name}※ Visualforce{! account.name} : account name account ( )11 11 16
  20. 20. • ID • • • • (https://XXXX.salesforce.com/001U0000003XXXX) ※ ID •testPage ?ID= 001U0000003XXXX • •11 11 16
  21. 21. • •testPage searchMemberPage11 11 16
  22. 22. • •[ ]➤[ ]➤[ ] •Visualforce [ ] •Visualforce •[ ] [ ] •[ ] [searchMemberTab] •[ ] [ ] [ ] ※11 11 16
  23. 23. • • PageEditor •page standardController Member__c • Ctrl + S VisualForce VisualForce11 11 16
  24. 24. • •<!-- Begin Default Content REMOVE THIS --> <!-- End Default Content REMOVE THIS --> •apex:form •form apex:pageBlock title •pageBlock pageBlockSection title columns 1 • Ctrl + S11 11 16
  25. 25. • •pageBlockSection pageBlockSectionItem •pageBlockSectionItem <apex:outputText > </apex:outputText> <apex:inputText id="queryName"/> • Ctrl + S11 11 16
  26. 26. • •pageBlock <apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton value=" "/> </apex:pageBlockButtons> • Ctrl + S11 11 16
  27. 27. • Apex •<apex:page> extensions searchMemberController • •Apex public class searchMemberController • Apex with sharing11 11 16
  28. 28. • Apex •PageEditor searchMemberController • public List<Member__c> members {get; set;} public Member__c member{get;set;} private final String percentString = %; public PageReference runQuery() { members =[SELECT Name FROM Member__c WHERE Name LIKE :member.Name + percentString]; return null; } • Ctrl + S11 11 16
  29. 29. • •PageEditor searchMemberPage • </apex:pageBlock> pageBlock • pageBlock pageBlockTable value {!members} var member •pageBlockTable <apex:column headerValue=" "> <apex:outputlink >{!member.Name}</apex:outputlink> </apex:column> • Ctrl + S11 11 16
  30. 30. • • inputText value {!member.Name} • commandButton action {!runQuery} •PageEditor searchMemberController • (searchMemberController) this.member = (Member__c)controller.getRecord(); • Ctrl + S11 11 16
  31. 31. • • • OK11 11 16
  32. 32. • • • • Decade • ( 0) • FLOOR(Age__c / 10) •searchMemberPage searchMemberController11 11 16
  33. 33. • searchMemberPage <apex:page standardController="Member__c" extensions="searchMemberController"> <apex:form > <apex:pageBlock title=" "> <apex:pageBlockSection title=" " columns="1"> <apex:pageblockSectionItem > <apex:outputText > </apex:outputText> <apex:inputText value="{!member.Name}" id="queryName"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputText > </apex:outputText> <apex:inputfield value="{!member.SkillLevel__c}" id="querySkillLevel"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputText > </apex:outputText> <apex:inputfield value="{!member.Skill__c}" id="querySkill"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputText > </apex:outputText> <apex:selectCheckboxes value="{!ageSelections}" > <apex:selectOptions value="{!ageOptions}"/> </apex:selectCheckboxes> </apex:pageblockSectionItem> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton value=" " action="{!runQuery}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> <apex:pageBlock > <apex:pageBlockTable value="{!members}" var="member"> <apex:column headerValue=" "> <apex:outputlink value="/{!member.Id}" target="_blank">{!member.Name}</apex:outputlink> </apex:column> <apex:column headerValue=" "> <apex:outputText >{!member.Age__c}</apex:outputText> </apex:column> <apex:column headerValue=" "> <apex:outputText >{!member.SkillLevel__c}</apex:outputText> </apex:column> <apex:column headerValue=" "> <apex:outputText >{!member.Skill__c}</apex:outputText> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:page>11 11 16
  34. 34. • searchMemberController public class searchMemberController { public Member__c member{get;set;} public String[] ageSelections{get;set;} public List<Member__c> members {get; set;} private final String percentString = %; public searchMemberController(ApexPages.StandardController controller) { this.member = (Member__c)controller.getRecord(); ageSelections=new String[]{}; } public List<SelectOption> getAgeOptions() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption(2, 20 )); options.add(new SelectOption(3, 30 )); return options; } public PageReference runQuery() { String soql = Select Name,Age__c, Mail__c, Skill__c, SkillLevel__c FROM Member__c WHERE ; soql += Name LIKE + member.Name + percentString + ; if(member.SkillLevel__c != null){ soql += AND SkillLevel__c = + member.SkillLevel__c + ; } if(member.Skill__c != null){ soql += AND Skill__c includes( + member.Skill__c +); } if(ageSelections.size() > 0) { soql += AND Decade__c IN + ageSelections; } System.debug(soql); members =Database.query(soql); return null; } }11 11 16
  35. 35. • SQL • • URL http://wiki.developerforce.com/page/JP:Secure_Coding_SQL_Injection11 11 16
  36. 36. Rich UI • Flash Visualforce Flash ※ SFDC11 11 16
  37. 37. Rich UI • Flash •[ ]➤[ ]➤[ ] • • flashResource • swf • ※Chatter URL http://www12113u.sakura.ne.jp:3000/taskchart.swf11 11 16
  38. 38. Rich UI • Flash • <apex:page sidebar="false" > <apex:flash src="{!$Resource.flashResource}" height="600" width="100%" /> </apex:page> •11 11 16
  39. 39. • Visualforce → • Visualforce →PageEditor • → • →Apex DB • Rich UI(Flash ) →swf11 11 16

×