- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 04:41 PM
Hi,
How can I display the weeks on "Duration Date" (u_duration_date)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 04:58 PM - edited 01-10-2024 05:07 PM
var start = new GlideDateTime(current.getValue('u_start_date'));
var end = new GlideDateTime(current.getValue('u_end_date'));
var dur = new GlideDuration();
dur = GlideDateTime.subtract(start, end);
var days = dur.getDayPart();
var weeks = parseInt(days/7);
current.setValue('u_duration_date' , weeks);
You cannot use g_form in a business rule.
I think you need to add this to your BR
current.setValue("u_duration_date" , weeks);
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 05:21 PM
I just tested it in my PDI and works fine.
What is the type for the duration, start date and the end date fields?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 05:31 PM
I found out that the issue is the type. I set duration into integer.
Thank you for your help its big help for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 05:34 PM