- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2018 08:39 AM
Hi All, I am working on updating our RITM form to add in a ship date.
I have a choice field called "Item Status" (u_item_status_choice). The default value is "NEW" There are 2 other status's...."Awaiting Configuration" and "Shipped" (The Label and Value is exactly the same)
I also added a field called "Date Shipped" (u_date_shipped_glide_date)
What I am looking to do is set the value of the "Date Shipped" field to "now" when the Item status changes to "Shipped".
I tried to make a before business rule on update but it's not working for me.
(function executeRule(current, previous /*null when async*/) {
var now = new GlideDateTime();
if(current.u_item_status_choice == Shipped && previous.u_item_status_choice == New){
current.u_date_shipped_glide_date = now;
}
})(current, previous);
Could someone help me correct this script.
We don't use the RITM and Request as intended. This is just a solution for me to be able to show what I shipped today on a report.
The report would show all RITM's where Date Shipped = today or last 7 days, or this month or this year, etc.
Thanks in advance for any help.
Regards,
Carl
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2018 09:03 AM
Hi Carl,
try this:-
set Business Rule
when to run condition as -----> u_item_status_choice -- changes to -- Shipped
and in scipt--------> current.u_date_shipped_glide_date = gs.nowDateTime();
Please mark answer correct if it solves your problem.
Cheers
Santosh Kshirsagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2018 09:03 AM
Hi Carl,
try this:-
set Business Rule
when to run condition as -----> u_item_status_choice -- changes to -- Shipped
and in scipt--------> current.u_date_shipped_glide_date = gs.nowDateTime();
Please mark answer correct if it solves your problem.
Cheers
Santosh Kshirsagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2018 09:51 AM
thank you!!! this works great. the date format is funny but I can deal with it. I appreciate your prompt reply!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2018 10:16 AM
No Problem,
Actually today I dealt with the similar problem for date field validation for Record Producer variable set. I spend my half day figuring out solution for that still couldn't find out.