- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2022 11:35 PM
Hello!
I have 2 date/time fields - Opened Date and Populated Date.
I have a before BR that populates the Populated Date.
I also have a Duration field.
I created an Update before BR which runs when the Populated Date is not empty. My script is:
(function executeRule(current, previous /*null when async*/ ) {
getTimeDiff();
function getTimeDiff() {
var openDate = current.opened_date.getGlideObject();
var popDate = current.u_populated_date.getGlideObject();
current.u_duration = gs.dateDiff(openDate.getDisplayValueInternal(), popDate.getDisplayValueInternal(), false);
}
})(current, previous);
This script is not working.
Please help troubleshoot the script.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2022 11:47 PM
Hi
use the below script, it's tested.
function executeRule(current, previous /*null when async*/ ) {
getTimeDiff();
function getTimeDiff() {
current.u_duration = gs.dateDiff(current.opened_date.getDisplayValue(), current.u_populated_date.getDisplayValue(), false);
}
})(current, previous);
Regards,
Snehangshu Sarkar
Please mark my answer as correct if it resolves your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2022 11:39 PM
Please try this script -
function executeRule(current, previous /*null when async*/ ) {
getTimeDiff();
function getTimeDiff() {
var openDate = current.opened_date.getDisplayValue();
var popDate = current.u_populated_date.getDisplayValue();
current.u_duration = gs.dateDiff(openDate, popDate, false);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2022 11:47 PM
Hi
use the below script, it's tested.
function executeRule(current, previous /*null when async*/ ) {
getTimeDiff();
function getTimeDiff() {
current.u_duration = gs.dateDiff(current.opened_date.getDisplayValue(), current.u_populated_date.getDisplayValue(), false);
}
})(current, previous);
Regards,
Snehangshu Sarkar
Please mark my answer as correct if it resolves your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2022 06:46 AM
It worked when I used only this line of code in the BR:
current.u_duration = gs.dateDiff(current.opened_date.getDisplayValue(), current.u_populated_date.getDisplayValue());