Salesforce for Android/iOS では PDF ビューを開くことができます。PDF はサムネイルビューとして表示され、ダウンロードリンクをクリックすると別のブラウザウィンドウでフルビューにアクセスできます。この場合に従うべきベストプラクティスと、認識しておく既知の制限事項について説明します。
モバイルアプリケーション環境では、sforce.one.navigateToSObject() イベントコールを使用して PDF を開きます。このメソッドコールは、Salesforce for Android/iOS アプリケーション環境でのみ使用するものです。Salesforce for Android/iOS アプリケーションで URL 値をハードコードして PDF を開くことはお勧めしません。Salesforce for Android/iOS アプリケーションから PDF ビューを表示する場合の推奨方法は、navigateToSObject() イベントコールです。
注意: モバイルデバイスでは、navigateToSObject() イベントをコールすると、新しいブラウザウィンドウに PDF が開きます。モバイルアプリケーションのコンテキスト内に PDF ビューを表示することはできないため、これが設計に基づく動作です。モバイルブラウザの設定でポップアップを許可し、PDF がシームレスに表示されるようにします。
PDF を Salesforce フルサイト組織の [ファイル] タブにアップロードした場合は、ファイルのレコード ID を navigateToSObject() メソッドコールのパラメータに使用して、PDF ビューページに移動できます。PDF をアップロード済みの場合に、PDF のファイルのレコード ID を確認するには、Salesforce デスクトップで [ファイル] タブを開き、PDF の URL からレコード ID をコピーして貼り付けます。「069」プレフィックスで始まる番号がファイルのレコード ID です。
注意: 標準オブジェクトのレコード ID とそのプレフィックスのリストについては、ヘルプ記事を参照してください。Salesforce for Android/iOS アプリケーション環境で PDF を開く場合、navigateToSObject コールに Attachment オブジェクトのレコード ID を使用しても PDF は開かないため、この ID を使用しないでください。
<apex:page standardController="Campaign">
<script>
sforce.one.navigateToSObject('06946000000WeeL');
</script>
</apex:page>
注意: lightning:navigation では navigate() に pageReference を設定します。
({
handleClick: function(cmp, event, helper) {
var navService = cmp.find("navService");
var pageReference = {
type: 'standard__recordPage',
attributes: {
recordId: '069e0000000azKYAAY',
objectApiName: 'ContentDocument',
actionName: 'view'
}
}
event.preventDefault();
navService.navigate(pageReference);
}
})
PDF ファイルを動的に生成して表示する場合は、コントローラを使ってこのファイルを生成して保存してから、新しい ID に移動します。PDF をサーバ側で生成して保存すれば、各種のプラットフォームで WebView がコンテンツタイプを正しく処理しない場合や、表示に関する他の問題が発生した場合にみられる競合を排除できます。このアプローチでファイルに直接移動すれば、サポートされているモバイル環境のユーザエクスペリエンスが一貫したものになります。
注意: Salesforce サポートが PDF を動的に生成する機能の構築について相談に応じることはできませんが、動的に生成された PDF を表示したときに特定のエラーが生じた場合はサポートします。
000384273

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.