function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kenichi MatsudaKenichi Matsuda 

VisualForceでダッシュボードページのレイアウトを変えたものを作る際のStandardControllerの指定について

標準のダッシュボードページのフィードが長く見づらくなったので、フィードを右に・ダッシュボードのコンポーネント群を左に配置するようなVisualforceページを作ろうと思っています。
商談であれば下記のようにスタイルシートと組み合わせ standardController="Opportunity" で apex:detail,relatedlist,chatter:feed を並べますが、これをダッシュボードでも出来るでしょうか?

<apex:page standardController="Opportunity" sidebar="false">
<style type="text/css">
#contents {
          border: 1px solid #FF9900;

#center {
          float: left;
          width : 750px ;
          border: 1px solid #FF9900;
          margin : 5px auto;
}
#right {
          float: right;
          width : 500px ;
          border: 1px solid #FF9900;
          margin : 5px auto;
}
</style>

    <div id="contents">
        <div id="center">
            <div id="ObjectActions">
                <apex:detail title="false" />
            </div>
        </div>
        <div id="right">
            <chatter:followers entityId="{!Opportunity.ID}"></chatter:followers>
            <div id="ObjectActivity">
                <h2>chatterフィード</h2>
                <chatter:follow entityId="{!Opportunity.ID}"></chatter:follow>
                <chatter:feed entityId="{!Opportunity.ID}"></chatter:feed>
            </div>
        </div>
    </div>      
</apex:page>
Taiki YoshikawaTaiki Yoshikawa
今まで試したことがなかったので、ちょっと確認してみました。


ひとまず、standardController="Dashboard"のような指定自体は利用できるみたいです。
<apex:page standardController="Dashboard" showHeader="true" sidebar="false" tabStyle="Dashboard">
    <chatter:followers entityId="{!Dashboard.Id}"></chatter:followers>
    <chatter:follow entityId="{!Dashboard.Id}"></chatter:follow>
    <chatter:feed entityId="{!Dashboard.Id}"></chatter:feed>
</apex:page>
User-added image

通常のVisualforceページにダッシュボードのグラフを表示させることはできないと思います。
(グラフを自分で実装する必要があったはずです)


ダッシュボードにはVisualforceを埋め込む機能が用意されています。なのでこれで対応できそうかなと思いました。
User-added image


ですが、埋め込まれたVisualforceページからはダッシュボードページのIDを取得することができないみたいです。
ID部分を固定文字列で試したときはきちんと認識されたのでchatterタグ自体は利用できそうでした。


standardControllerに頼らず自作のcontrollerを用意する方法も試してみました。controller側で用意した文字列はページ側に渡すことが出来ましたが、やはりダッシュボードIDの取得が難しそうです。。
<apex:page controller="VFDashboardController" showHeader="false" sidebar="false" tabStyle="Dashboard">
    <div>
        <apex:outputText value="{!label}" />
        <apex:outputText value="{!dashboardId}" />
    </div>
    <chatter:followers entityId="{!dashboardId}"></chatter:followers>
    <chatter:follow entityId="{!dashboardId}"></chatter:follow>
    <chatter:feed entityId="01Zi0000000MyuF"></chatter:feed>
</apex:page>
public with sharing class VFDashboardController {
    
    public Id dashboardId {get; set;}
    public String label {get; set;}
    
    public VFDashboardController() {
        this.label = 'Dashboard ID = ';
        this.dashboardId = System.currentPageReference().getParameters().get('id');
    }
}

最後にapex:detailタグはダッシュボードページの情報を取得できないみたいです。
もしかすると何かいい解決方法があるかもしれませんが、自分が試してみた感じではちょっと難しそうに感じました。
Kenichi MatsudaKenichi Matsuda
Yoshikawaさん、いつもありがとうございます。
最近のPCは横幅が広いので、横に並べて表示できれば見やすいのになと思い質問しました。
コンポーネントとしてChatterの表示も選択肢として検討させて頂きます。
もう少しこのスレッドはオープンにしておきます。