LoginSignup
0
0

More than 1 year has passed since last update.

[salesforce] defaultFieldValues

Posted at

やりたいこと

カスタムボタンやリンクをクリックすると、初期値が設定されている新規活動画面を作成したい。
例)割り当て先を特定のユーザ、開始日がtoday+3に設定できている新規活動画面

defaultFieldValues :
デフォルト項目値をレコード作成ページに渡すカスタムボタンとリンクを作成します。この機能は、すべてのエディションの Lightning Experience に適用されます。この機能は、Lightning Out、エクスペリエンスビルダーサイト、Salesforce モバイルアプリケーションには適用されません。
https://help.salesforce.com/articleView?id=sf.links_useful_custom_buttons_create_record_dfv.htm&type=5

を利用する。


  1. カスタムリンクに以下の値を設定する
/lightning/o/Event/new?defaultFieldValues=OwnerId=005000~,IsAllDayEvent=true,StartDateTime=TODAY()+3

・OwnerId(割り当て先)とIsAllDayEvent(終日行動)の設定は順調にできるが。。
開始日の設定がうまくできない。。

まず、活動(Event)の日付項目には

  • ActivityDate(日付)

    • Contains the event’s due date if the IsAllDayEvent flag is set to true.
    • The value for this field and StartDateTime must match, or one of them must be null.
  • ActivityDateTime

    • Contains the event’s due date if the IsAllDayEvent flag is set to false.
    • The value for this field and StartDateTime must match, or one of them must be null.
  • StartDateTime(作成日)

    • the time portion of this field is always transferred in the Coordinated Universal Time (UTC) time zone.

活動の日付項目と作成日項目の違いは何ですか?

ActivityDate(日付)
- ToDo の場合は、ToDo の期日を示します。
行動の場合は、終日行動 が True に設定されている場合のみ、行動の開始日を示します。
この項目には、UTC (協定世界時) のタイムゾーンで午前 0 時に常に設定されているタイムスタンプがあります。 このタイムスタンプは関係ありませんので、 タイムゾーンの違いを調整するために変更しないでください。

StartDateTime(作成日)
- ToDo または行動が作成された日付を示します。 多くの場合、作成日の日付と日付項目は同じです。 レコードで [活動の記録] ボタンをクリックするなどして活動を記録すると、この ToDo は事前にスケジュールされておらず、必要に応じて生成されたため、作成日と日付項目は同じになります。作成日は監査項目であり、システムによって作成され、更新されます。 監査項目の詳細については、システム項目 記事を参照してください。

datatimeタイプ

StartDateTimeはdatatimeタイプなので、時間まで設定する必要がありそう。
例えは、2021-08-04T01:07:12.000Z

カスタムボタンまたはカスタムリンクの構文
/lightning/o/Event/new?defaultFieldValues=StartDateTime={!TEXT( TODAY()+3)}T00:00:00.000Z

参考したリンク
https://developer.salesforce.com/docs/atlas.ja-jp.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0