- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2018 06:50 AM
I'm attempting to set a "start date" date/time field to the current date/time based upon the criteria that one field is true, and the "start date" field is empty. I've been able to make it set the date/time initially (that part works perfectly); however, every time I send a new update, it changes the date to the current time, even though the "start date" field is populated. I've done an exhaustive search, and can find nothing that remediates this. Help!
I'm sure I'm missing something simple. This is the relevant code:
__________
When: Before, on Insert or Update
I've done this with and without filter conditions: Send to Legal is true, Legal start date is empty
_________
(function executeRule(current, previous /*null when async*/) {
if (current.send_to_legal=='true' && (!current.legal_start_date.nil())) {
current.legal_start_date = gs.nowDateTime();
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2018 06:59 AM
You can do this with condition on the BR so it only runs if it's empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2018 08:05 AM
Use debug all and set field watcher to this field to see what is happening.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2018 08:07 AM
Did that, and saw...nothing relevant.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2018 08:53 AM
Yea, however, I'm confused and we just need to change it, lol. So make it work with == ''.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2018 10:07 AM
So, final update...
All of your suggestions worked. It was the field that was wonky (and I still don't know why). I created a new date/time field, plugged it into the old Business Rule, and everything works like a charm. I'm chalking this up to ghosts in the machine.
Thank you all for your time and expertise!
-Debbi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2018 10:20 AM
Yea...I figured it was something else. Ideally you would pick the first response that was the right answer as that right answer, but at least if you can, please mark all replies that were helpful to you as helpful.
Pretty sure you got about 4 responses all within 10 minutes, but some came in with more information than others. Up to you.
In the end, it works. Glad for that!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!