- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 07:45 PM
Hi All,
I have a requirement like, when we create a change request based on the type we need to set date and time on duration filed?
normal change = 4 days
expiated change = 24 hr
standard change = 12 hr
how can we set the date and time dynamically based on the change type.
I'm using before business rule
type: before
condition: state is of normal,expedite,standard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 10:39 PM - edited 10-10-2023 10:40 PM
Hi @pvv1045330
Can you simply try to set like below :
if(current.type=='normal'){
/*Days Hr:mm:ss - As we know 14 days for normal*/
var approvalDuration = "14 00:00:00";
current.u_minimum_lead_time=approvalDuration;
}
else if(current.type=='expedite'){
/* Days Hr:mm:ss - As we know 48 hrs will be converted into days automatically*/
var Duration = "00 48:00:00";
current.u_minimum_lead_time=Duration;
}
else if(current.type=='standard'){
var approval = "00 24:00:00";
current.u_minimum_lead_time=approval;
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 12:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 12:35 AM
Hi @pvv1045330
Yes....Its OOTB functionality.
The Hours will converted into days.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 12:47 AM
You mean we can't make it as hours.
if we want make it as hr what are the changes we need to do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 12:54 AM - edited 10-11-2023 12:56 AM
Hi @pvv1045330
Yes....
Its like ....
24 Hr = 1 day
So if you put 28 hrs it will be like (24 hr + 4 hrs) & it will converted into like below
Days Hr:mm:ss
01 04:00:00
if you put 15 hrs then it will be like
Days Hr:mm:ss
00 15:00:00
You can put some value manually & save the form , you will know it how it works.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 12:58 AM