30
Mitsuhiro Okamoto @mitsuhiro 実践!カスタマー エクスペリエンス 向上のためのアプリ開発 前編

実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Embed Size (px)

Citation preview

Page 1: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Mitsuhiro Okamoto@mitsuhiro

実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Page 2: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Statement under the Private Securities Litigation Reform Act of 1995:

This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.

The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site.

Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Forward-Looking Statement

Page 3: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

ソーシャルメディアをフォロー

@salesforcedevjp / #forcewebinar

Salesforce Developers Japan

Salesforce Developers (English Only)

Salesforce Developers Japan

このwebセミナーは録画されています このビデオは後にYouTubeおよびWebセミナーお申し込みページにアップロードされます

Page 4: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

DreamHouseとは?2016年における、Salesforce版の 「Pet Store」 アプリケーション

http://www.dreamhouseappjp.io/

Page 5: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

– 前編

§ DreamHouse概要§ コンポーネント指向開発

– 後編

§ インテグレーションの制御§ 中間サービスの実装

前編と後編の位置付け

Page 6: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

コンポーネントによるUI設計

Page 7: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

コンポーネント指向にすることのUXへの利点

§ コンポーネント/デザインの再利用– ユーザの学習コストを減らす

• UXデザイン

§ コンポーネントは独立しつつ相互に通信– よりインタラクティブなコンテンツの提供

§ コンポーネントの柔軟性– コンポーネントはコンフィグレーションによってカスタマイズ

可能• No Code でカスタマイズ

Page 8: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

開発生産性Lightning Component , Apex , App Builder …

Field Level SecurityCRUD PermissionCustom Endpoint…

Page 9: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

UXと生産性を両立させる

1. コンポーネントの開発効率を高める– Lightning Base Component– Lightning Data Service

2. コンポーネントの独立性を保つ– イベントによる相互の通信

3. コンポーネントの活用箇所を広げる– カスタムアクション– ユーティリティバー

3つの開発Tips

Page 10: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Lightning Base Component

§ シンプルなコンポーネント週§ バリデーション§ カスタムメッセージ§ 表示フォーマット§ SLDSにマッチしたデザイン§ 少量のCSS

SLDSベースのUIに馴染む軽量のコンポーネント

Page 11: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

例 : 簡単なフォーム

<lightning:input label="姓" value="{!v.contact.LastName}" /> <lightning:input label="名" value="{!v.contact.FirstName}" /> <lightning:input label="メール" value="{!v.contact.Email}" /> <lightning:button onclick="{!c.onSaveClicked}">保存</lightning:button>

Page 12: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

例 2: バリデーション

<lightning:input label="姓" value="{!v.contact.LastName}" /> <lightning:input label="名" value="{!v.contact.FirstName}" /> <lightning:input label="メール" value="{!v.contact.Email}"

required="true" pattern=".*@.+\..+" /><lightning:button onclick="{!c.onSaveClicked}">保存</lightning:button>

Page 13: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Lightning Data Service

§ 宣言的なCRUD処理§ Apexいらず§ SOQLいらず§ 少量のJavaScript (編集モードのみ必要)§ 共有ルールおよびFLSのハンドリング§ 共有レコードキャッシュ

Lightningのための新しいデータアクセス方法

Page 14: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Lightning Data Serviceの前のDreamHouse

物件ステータス

物件地図

住宅ローン計算機

PropertyController- getProperty

getProperty(abc)

getProperty(abc)

getProperty(abc)

Client Server

Page 15: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

以前の方式の課題

1. 同じレコードを参照するのにサーバへ複数回のコール2. コードが非常に煩雑– JavaScriptはクライアントサイドで動作し、コントローラを含め

る– Apexコントローラはサーバサイドで動作 (CRUD および FLS への

遵守も含む)3. UIの矛盾– それぞれのコンポーネントは自分専用のデータのコピーを持つ– 一つのコンポーネントがデータを変更しても、他のコンポーネン

トに反映されなかった

Page 16: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Lightning Data Serviceの導入

物件ステータス

物件地図

住宅ローン計算機

Client Server

共有レコードキャッシュ

<force:record recordId="abc"/>

<force:recordrecordId="abc"/>

<force:record recordId="abc"/>

Page 17: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

<aura:componentimplements="force:hasRecordId,flexipage:availableForAllPageTypes"

access="global"><aura:attribute name="recordId" type="Id" /><aura:attribute name="property" type="Property__c" /><force:recordPreview recordId="{!v.recordId}"

targetRecord="{!v.property}"fields="['Id', 'Status__c']" />

{!v.property.Status__c} </aura:component>

Page 18: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

例 2: 編集モード

<aura:componentimplements="force:hasRecordId,flexipage:availableForAllPageTypes"

access="global"><aura:attribute name="recordId" type="Id" /><aura:attribute name="property" type="Property__c" /><force:recordPreview aura:id="propertyService"

recordId="{!v.recordId}"targetRecord="{!v.property}"fields="['Id', 'Status__c']"mode="EDIT"/>

<ui:inputText label=“Status:” value=“{! v.property.Status__c}”/><lightning:button onclick=“{!c.onSaveClicked}”>保存</lightning:button>

</aura:component>

Page 19: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

レコードの保存

onSaveClicked : function(component) {component.find("propertyService").saveRecord();

}

Page 20: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

レコードの編集モードでの同期<aura:componentimplements="force:hasRecordId,flexipage:availableForAllPageTypes"

access="global"><aura:attribute name="recordId" type="Id" /><aura:attribute name="property" type="Property__c" /><force:recordPreview aura:id="propertyService"

recordId="{!v.recordId}"targetRecord="{!v.property}"fields="['Id', 'Status__c']"mode="EDIT"recordUpdated="{!c.onRecordUpdated}"/>

<ui:inputText label=“ステータス:” value=“{! v.property.Status__c}”/><lightning:button onclick=“{!c.onSaveClicked}”>保存</lightning:button>

</aura:component>

Page 21: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

レコードの再読み込み

onRecordUpdated : function(component, event, helper) {var changeType = event.getParams().changeType;if (changeType === "CHANGED") {

component.find("propertyService").reloadRecord();}

}

Page 22: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Lightning Data Serviceまとめ

Lightning Data Service無し Lightning Data Serviceあり

複雑なコード(Apex, SOQL, FLS, Javascript)

宣言的(no code)

コンポーネントごとに同一レコードを複数回呼び出す

コンポーネントはローカルのレコードキャッシュにアクセスし、サーバとは透過的かつ効率的に通信

それぞれのコンポーネントはレコードのコピーを保持

コンポーネントは単一のレコードコピー共有

Page 23: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Lightningアプリケーションイベント

§ 自身が選択された事をアプリケーションへ通知– ltng:selectSObject

§ コンポーネント間でメッセージを送受信– ltng:sendMessage

相互に通信を行うための仕組み

Page 24: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Lightningアプリケーションイベント

ltng:selectSObject

Page 25: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

§ Utility Bar– FlexiPageを作成し設定– 現状APIのみ

• Application内にあるutilityBarタグ

§ Quick Action– force:lightningQuickAction

» OR

– force:lightningQuickActionWithoutHeader

新しいLightningコンポーネントの利用先

Page 26: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

まとめ

§ コンポーネント指向はUXを向上させる§ UXと開発生産性を両立するには

– Lightningの提供する便利な機能活用• Lightning Services• Lightning Event• Utility Bar & Quick Action

Page 27: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

http://dreamhouseappjp.io/

Page 28: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Survey今後のプログラムの品質改善のために

アンケートにご協力ください!

http://bit.ly/devjp1102

Webinar資料のダウンロードURLはアンケートの回答後にリンクしています

Page 29: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Q & Aまたはディスカッションボードを活用

http://bit.ly/discussionboards

Trailheadを是非お試しください: trailhead.salesforce.com

その他お問い合わせなど: @salesforcedevjp

Page 30: 実践!カスタマー エクスペリエンス向上のためのアプリ開発 前編

Thank You