リスト表示時に日付項目の値からの経過日数を表示したい

Masaki Uehara
Tera Contributor

お世話になっています。

テーブルの一覧表示時に、ある日付項目(仮に「受付日」とします)から本日までの経過日数を表示したいと考えています。

もちろん、「経過日数」という項目を作って計算結果を入れれば良いのですが、基本的にはフォームのonloadやonsubmitトリガで「受付日」ー「本日」を計算し、定期的に「経過日数」を更新しておく必要があると思われます。

そうではなく、リスト表示時にリアルタイムに計算して表示することは可能でしょうか。

1 件の受理された解決策

Ankur Bawiskar
Tera Patron
Tera Patron

@Masaki Uehara 

you will require a field to hold the data and then show in list.

Without field it's not possible.

Why not create that field as Calculated type so that it gets calculated in real-time? then include that field in list

Don't show this field on form and make it read-only at dictionary level as it will be auto calculated

Note: Calculated field gets calculated each time for each row when list is rendered, so performance impact will be there

Calculated Fields Documentation 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

元の投稿で解決策を見る

7件の返信7

This response is very helpful.

However, when I add a column to my custom table, the calculated type does not appear in the type options. Is there any documentation on what tables this field can be used in?

Thank you for your support.

@Masaki Uehara 

Field will be normal string type or duration and Calculated is a checkbox and there you will get script option

Go to advanced view of that dictionary and then you will see that

AnkurBawiskar_0-1741757648632.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I found it! Thank you for the detailed explanation.

I'll mark the previous answer as correct.

Best regards