Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Salesforceのツールの作り方

2ac024b2f1f4da583ab751d28509c068?s=47 tzmfreedom
September 26, 2019

 Salesforceのツールの作り方

Salesforce World Tour Tokyo 2019で登壇したときの資料です

2ac024b2f1f4da583ab751d28509c068?s=128

tzmfreedom

September 26, 2019
Tweet

Transcript

  1. Salesforceͷπʔϧͷ࡞Γํ ా࣮ ੣

  2. ࣗݾ঺հ • Twitter: @tzm_freedom • GitHub: tzmfreedom • Blog: https://blog.freedom-man.com

    • ࣄۀ։ൃձࣾͷαʔόʔαΠυΤϯδχΞ • Ruby/Rails, PHP/Symfony, ... • ࠷ۙ͸ϨΨγʔΞϓϦվળۀ • Ϟϊͮ͘Γେ޷͖ܥΤϯδχΞ • Salesforceͷܦݧ͸લ৬Ͱ5೥൒͘Β͍ • Salesforceͷࢿ֨͸શࣦͯޮʘ(^o^)ʗ • ࠓ͸ۀ຿ͰSalesforceΛશ͘৮͍ͬͯͳ͍
  3. ࠓ·Ͱ࡞͖ͬͯͨπʔϧ • go-soapforce: Go੡ͷSalesforce SOAP APIΫϥΠΞϯτ • hsforce: Haskell੡ͷSalesforce APIΫϥΠΞϯτ

    • fluent-plugin-sforce: fluentdͷSalesforceϓϥάΠϯ • embulk-output-salesforce: embulkͷSalesforceϓϥάΠϯ • hubot-chatter: hubotͷSalesforceΞμϓλ • spm: SalesforceͷύοέʔδϚωʔδϟʔ • land: ApexͷϩʔΧϧ࣮ߦ؀ڥ • alt-apex: ApexΛKotlinͰॻ͚ΔΑ͏ʹ͢ΔτϥϯεύΠϥ
  4. ࠓ೔࿩͢͜ͱ • πʔϧΛ࡞Δʹ͸Ͳ͏͍͏஌ࣝɾٕज़ɾࢹ఺͕ඞཁͳ ͷ͔ʁ • ಛʹπʔϧ։ൃʹ͓͚ΔϞνϕʔγϣϯ໰୊ʹ͍ͭͯ • πʔϧΛ࡞Δ۩ମతͳํ๏Ͱ͸ͳ͘ɺϝλͳࢹ఺Ͱ͓ ࿩͠·͢

  5. ※͜ͷηογϣϯͷεϥΠυ͸ จࣈ͔͠ग़͖ͯ·ͤΜʂ

  6. Salesforce։ൃΛࢧ͑Δπʔϧ͸ͨ͘͞Μ͋Δ • Apex։ൃʢGUIɾEditorʣ • ݹ͘͸ force.com IDEɺݱࡏ͸VS Codeʴplugin • Salesforceૢ࡞؆қԽʢChrome

    Extension) • Salesforce Devtools • σʔλ౤ೖʢGUIʣ • Salesforce Dataloader • σϓϩΠͷࣗಈԽʢCUIʣ • ant, sfdx, jsforce • APIΛୟ͘ϥΠϒϥϦ • jsforce(JavaScript), restforce(Ruby), go-soapforce(Go), ...
  7. πʔϧΛ࡞ΔͨΊʹ ඞཁͳ஌ࣝɾٕज़ɾࢹ఺

  8. 1. SalesforceΛ஌Δ

  9. Salesforceʹ͍ͭͯ஌Δ • SalesforceͰग़དྷΔ͜ͱग़དྷͳ͍͜ͱ • ։ൃͤͣʹͰ͖ΔྖҬͱͰ͖ͳ͍ྖҬͷཧղ • SalesforceΛΧελϚΠζɾ։ൃ্͍ͯ͘͠ͰͲ͏͍͏ۀ ຿͕සൃ͢Δͷ͔ • SalesforceϓϥοτϑΥʔϜ͸Կ͕ۤखͳͷ͔

    • ۤखͳྖҬʹରͯ͠ผͷΞϓϩʔνͰิ͑Δ΋ͷͳͷ͔ • Salesforce͕ެࣜʹఏڙ͍ͯ͠Δπʔϧ • Dataloader, SFDX, VS Code Plugin... • ෆศͰ͸ͳ͍͔ʁࣗࣾυϝΠϯʹϑΟοτ͍ͯ͠Δ͔ʁ
  10. 2. ՝୊Λղܾ͢ΔͨΊͷ ٕज़Λ஌Δ

  11. ՝୊Λղܾ͢ΔͨΊͷٕज़Λ஌Δ • Salesforceͷը໘ΛΑΓ࢖͍΍͍ͨ͘͢͠
 => Chrome֦ுɾϒοΫϚʔΫϨοτɾϢʔβʔεΫϦϓτ • CLIͰSalesforceΛૢ࡞͍ͨ͠
 => CLIπʔϧʢCLIϑϨʔϜϫʔΫ oclifͱ͔Thorͱ͔ʣ

    • WebΞϓϦͰSalesforceͷAPIΛୟ͘
 => APIΫϥΠΞϯτʢRESTɾSOAPɾMetadataɾToolingʣ • σʔλΛ͍͍ײ͡ʹ͢ΔGUIΛ࡞Γ͍ͨ
 => WebΞϓϦɾσεΫτοϓΞϓϦɾεϚϗΞϓϦ • ੌ͍OSS͕ग़͚ͨͲSalesforce༻ͷϓϥάΠϯ͕ແ͍ʂ
 => OSSͷϓϥάΠϯ
  12. ՝୊Λղܾ͢ΔͨΊͷٕज़Λ஌Δ • ެ։ɾΠϯετʔϧํ๏ • GitHub • ֤छύοέʔδ؅ཧγεςϜ • WebΞϓϦ •

    Heroku Button • Salesforce Button • bashϫϯϥΠφʔ • Πϯετʔϥʔ • ·͊Ͱ΋ͿͬͪΌ͚ٕज़ͳΜͯޙ෇Ͱ͓̺ʢޙड़
  13. 3. ϞνϕʔγϣϯΛҡ࣋ͯ͠ ࡞Γ੾Δྗ

  14. ࣮͸πʔϧΛ࡞ΔٕྔΑΓ΋ ϞνϕʔγϣϯΛҡ࣋ͯ͠ ࡞Γ੾Δͷ͕Ұ൪೉͍͠

  15. πʔϧ։ൃͷϞνϕʔγϣϯ໰୊ • ԿΛ࡞͍͍ͬͯͷ͔Θ͔Βͳ͍… • ࣅͨΑ͏ͳπʔϧ͕͋Δ͠ंྠͷ࠶ൃ໌ʹͳͬͯ͠ ·͏ͷͰ͸… • ៉ྷͳίʔυॻ͚ͳ͍͠ɺίʔυΛެ։͢Δͷ͕ஏ ͔͍ͣ͠… •

    ͦ΋ͦ΋͜ͷπʔϧ࡞ͬͯҙຯ͋ΔͷͩΖ͏͔… • ࡞Γ͍ͨ΋ͷ͕͋Δ͚Ͳ೉қ౓͕ߴ͍…
  16. ԿΛ࡞͍͍ͬͯͷ͔Θ͔Βͳ͍…

  17. ԿΛ࡞ͬͯྑ͍ͷ͔Θ͔Βͳ͍ • ෆศʹؾͮ͘ɻ౰ͨΓલΛٙ͏ɻ • ৗʹ٬؍తʹݟͯΈΔɻ • Salesforce͸˓˓ͳ࢓༷͔ͩΒ͠ΐ͏͕ͳ͍ɺఘΊΔ… Ͱ͸ͳ͘ɺ։ൃͰϑΥϩʔͰ͖ͳ͍΋ͷͳͷ͔ɺͲ͏ͳ Ε͹΋ͬͱศརʹ࢖͑Δͷ͔Λߟ͑Δɻ •

    Salesforce͸API͕ॆ࣮͍ͯ͠ΔͷͰ։ൃͰϑΥϩʔͰ ͖Δൣғ͸޿͍ • ӡ༻ऀɾ։ൃऀʹෆศͳ఺͕ແ͍͔ฉ͍ͯΈΔ • ໨త͸SalesforceΛΑΓศརʹ࢖͑ΔΑ͏ʹ͢Δ͜ͱ
  18. ࣅͨΑ͏ͳπʔϧ͕͋Δ͠ ंྠͷ࠶ൃ໌ʹͳͬͯ͠·͏ͷͰ͸…

  19. ࣅͨΑ͏ͳπʔϧ͕͋Δ͠ंྠͷ࠶ൃ໌ʹͳͬͯ͠·͏ͷͰ͸… • ंྠͷ࠶ൃ໌্౳ • ׬શʹಉ͡πʔϧͱ͍͏ͷ͸ଘࡏ͠ͳ͍ • ࡉ͔͍࢖͍উखɺඞཁͳϥϯλΠϜ • ಉ͡Α͏ͳπʔϧ͕Կݸ͋ͬͯ΋ྑ͍ •

    ࣗ෼ͷٕज़ྗ͸࣮֬ʹ্͕Δ • ࣅͨΑ͏ͳπʔϧʹର͢Δཧղྗ΋্͕Δ • ཧղྗ্͕͕ΔͱτϥϒϧγϡʔςΟϯάʹ΋ڧ͘ͳΔ
  20. ៉ྷͳίʔυॻ͚ͳ͍͠ ίʔυΛެ։͢Δͷஏ͔͍ͣ͠…

  21. ៉ྷͳίʔυॻ͚ͳ͍͠ɺίʔυΛެ։͢Δͷஏ͔͍ͣ͠… • ͦ΋ͦ΋࠷ॳ͔Β៉ྷͳίʔυͳΜͯॻ͚ΔΘ͚͕ͳ͍ • ແཧʹެ։͠ͳͯ͘΋ྑ͍͠ɺ࠷ॳ͸ࣾ಺πʔϧͰશ͘໰ ୊ͳ͍ • ͕ɺίʔυΛެ։͢ΔϝϦοτ͸͔ͳΓ͋ΔͷͰ͓͢͢Ί • ঝೝཉٻΛຬͨ͢

    • ιʔγϟϧίʔσΟϯάΛମݧͰ͖Δ • ެ։͢Δͱ͍͏ϓϨογϟʔͰ඼্࣭͕͕Δ • ҙ֎ͱଞͷਓʹͱͬͯ΋༗༻ͳπʔϧͰ͋Δ͜ͱ͕ଟ͍ • ެ։ͯ͠΋ҙ֎ͱ୭΋ݟ͍ͯͳ͍ͷͰؾʹ͢Δඞཁ͕ͳ͍ • ެ։ʹଛͰ͸ͳ͍ɻ
  22. ͦ΋ͦ΋͜ͷπʔϧΛ࡞ͬͯ ҙຯ͋ΔͷͩΖ͏͔…

  23. ͦ΋ͦ΋͜ͷπʔϧΛ࡞ͬͯҙຯ͋ΔͷͩΖ͏͔… • ҙຯ͸࡞ͬͨ͋ͱʹߟ͑ͯ΋ྑ͍ • ͱΓ͋͑ͣϓϩτλΠϐϯάతʹਖ਼ৗܥ͚ͩ࡞ͬͯΈΔ • ҙຯΛߟ͑Δલʹ׬੒ͤ͞Δ • ҙ֎ͱ࢖ͬͯ͘ΕΔਓ͕͍ͨΓ͢Δ΋ͷ •

    ໾ʹཱͨͳͯ͘΋ྑ͍ɻָ͚͠Ε͹OK • ϓϩάϥϛϯά͸ָ͍͠
  24. ࡞Γ͍ͨ΋ͷ͕͋Δ͚Ͳ ೉қ౓͕ߴ͍…

  25. ࡞Γ͍ͨ΋ͷ͕͋Δ͚Ͳ೉қ౓͕ߴ͍… • ೉қ౓͕ߴ͍΋ͷΛ࡞Γ͍ͨͱࢥͬͨͱ͖͸ࣗ෼ͷٕ ज़ྗΛߴΊΔେ͖ͳνϟϯε • ن໛͕େ͖͍ɺ೉қ౓͕ߴ͍΋ͷ͸޻ఔɾඞཁͳٕज़ ཁૉΛ෼ղ͢Δ • ̍೔ʙ̍िؒ͘Β͍Ͱୡ੒Ͱ͖Δখ͍͞໨ඪΛ࡞ͬͯ ͓͘

    • ·ͣ͸௒؆୯ͳਖ਼ৗܥΛಈ͔͢ɻ͔ͦ͜Β޿͍͛ͯ͘ • ࡞Γͳ͕ΒֶͿɺֶͿͨΊʹ࡞Δ
  26. πʔϧΛ࡞Δ্Ͱ େࣄʹ͍ͯ͠Δ͜ͱ

  27. πʔϧΛ࡞Δ্Ͱେࣄʹ͍ͯ͠Δ͜ͱ • ͍͔ͭ΍ΔɺͰ͸ͳ͘ࠓ΍ΔɻίʔυΛॻ͘ɻ • ΍Γͨ͘ͳͬͨͱ͖͕νϟϯεɻ৸͔͢ͱϞνϕʔγϣϯԼ ͕ͬͯ΍Βͳ͘ͳΔɻνϟϯεΛಀ͞ͳ͍ • Ϟνϕʔγϣϯ͸Լ͕Δ΋ͷɻਖ਼ৗܥ͚ͩͰ΋Ұؾʹ࡞Γ੾Δ • ධ࿦ՈʹͳΒͳ͍ɺ·ͣखΛಈ͔͢ɻ

    • ΞΠσΞΛΞΠσΞͰऴΘΒͤͳ͍ɻ
 ࣮૷ͯ͠۩ݱԽͰ͖Δͷ͕ΤϯδχΞͷڧΈ • ۩ݱԽͰ͖Δ΋ͷΛ૿΍͍͚ͯ͠Δͷ͕ΤϯδχΞͷָ͠Έ Ͱ͋ΓՁ஋ʹͳΔ • ԿΑΓɺϓϩάϥϛϯάΛָ͠ΉɻϞϊͮ͘Γ͸ָ͍͠ɻ
 ϓϩάϥϛϯά͕໨తʹͳͬͯ΋ྑ͍ɻ
  28. ·ͱΊ • SalesforceͷπʔϧΛ࡞Δͷʹඞཁͳ஌ࣝɾٕज़ɾࢹ఺ • SalesforceΛ஌Δ • ՝୊ղܾ͢ΔͨΊͷٕज़Λ஌Δ • ϞνϕʔγϣϯΛҡ࣋ͯ͠࡞Γ੾Δ •

    ΞΠσΞΛ࣮ݱͰ͖Δͷ͕ΤϯδχΞͷՁ஋ɻ
 ίʔυΛॻ͍͍͖ͯ·͠ΐ͏ʂ
  29. Enjoy Programming!!