Calculated hours based on time field in catalog item to auto populate duration hours on catalog form
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 03:52 AM
Hi,
I am having one field known as 'time' on my catalog item and once it is filled with a number then the field 'duration' on the same form should get autopopulated as time*8hrs(calculated).
Please let me know how I can achieve this using a catalog client script. This is urgent.
Thanks in advance!!!!
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 04:37 AM
Hi @PriyaRaj
try below script and modify as per your requirement.
var durStart = new GlideDateTime(gs.nowDateTime());
var durEnd = new GlideDateTime(gs.nowDateTime());
gs.print(durStart);
durEnd.addSeconds(28800);
gs.print(durEnd);
var duration = GlideDateTime.subtract(durStart, durEnd);
gs.print(duration.getDisplayValue());
If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.
Thanks
dgarad
Thanks
dgarad
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 07:46 AM