how can i create a duration pill value in Flow Designer
This content was last updated in 2023. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 05:46 AM
I need to set a duration value based on a system property
The below script outputs as expected: the property lookup is 300000 which then outputs as 00:05:00 as expected.
var t = gs.getProperty('enhancement.wait.duration');
var t2 = parseInt(t);
gs.log('enhancement time get property = ' + t2);
var dur = new GlideDuration(t2);
gs.log('enhancement duration getdurval = ' + dur.getDurationValue());
return dur.getDurationValue();
but when pushing this through the action to return the duration value back to the flow it errors with: An error occurred while parsing the duration value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 06:39 PM
Create an Action with an output of type Duration. I pass in the name of a system property that holds the number of milliseconds I want to set the duration to, then I output this duration to Wait for a Duration of Time flow logic
// can't use sleep because it ties up threads and causes flows to back up, so use this with Wait for a Duration of Time flow logic
var waitFor = parseInt(gs.getProperty(inputs.in_sysProperty));
outputs.out_dur = new GlideDuration(waitFor);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 06:40 PM
// can't use sleep because it ties up threads and causes flows to back up, so use this with Wait for a Duration of Time flow logic
var waitFor = parseInt(gs.getProperty(inputs.in_sysProperty));
outputs.out_dur = new GlideDuration(waitFor);