Want to expire action in next 30 mins

Hi I am trying to auto expire action in next 30 mins via rest api call but facing challenge in client local time / UTC time

when i set client local time it takes the clock from the client machine and having difference in hours

but when i take UTC time , some action got expired immediately after execution ,seems it passes the UTC time as servers are in different time zone

<EndDateTimeLocalOffset>PT30M</EndDateTimeLocalOffset>
            <HasDayOfWeekConstraint>false</HasDayOfWeekConstraint>
            <UseUTCTime>false</UseUTCTime>

What does the action start time looked like in that action? Please post the whole ‘Settings’ node.

I am not choosing start time as endpoints are in different time zones and have to start the action immediate once i execute , only intention is to stop them after 30 mins of execution

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
	<SingleAction>
		<Title>Custom Action</Title>
		<Relevance>true</Relevance>
		<ActionScript MIMEType="application/x-Fixlet-Windows-Shell">// Enter your action script here

begin prefetch block
add nohash prefetch item name=dns.txt url=https://server:52311/Uploads/adhoc/dns.txt
end prefetch block

copy __Download/dns.txt "c:\temp\vj\dns.txt"
</ActionScript>
		<SuccessCriteria Option="RunToCompletion"></SuccessCriteria>
		<Settings>
			<PreActionShowUI>false</PreActionShowUI>
			<HasRunningMessage>false</HasRunningMessage>
			<HasTimeRange>false</HasTimeRange>
			<HasStartTime>false</HasStartTime>
			<HasEndTime>true</HasEndTime>
			<EndDateTimeLocalOffset>PT30M</EndDateTimeLocalOffset>
			<HasDayOfWeekConstraint>false</HasDayOfWeekConstraint>
			<UseUTCTime>false</UseUTCTime>
			<ActiveUserRequirement>NoRequirement</ActiveUserRequirement>
			<ActiveUserType>AllUsers</ActiveUserType>
			<HasWhose>false</HasWhose>
			<PreActionCacheDownload>false</PreActionCacheDownload>
			<Reapply>false</Reapply>
			<HasReapplyLimit>true</HasReapplyLimit>
			<ReapplyLimit>3</ReapplyLimit>
			<HasReapplyInterval>false</HasReapplyInterval>
			<HasRetry>false</HasRetry>
			<HasTemporalDistribution>false</HasTemporalDistribution>
			<ContinueOnErrors>true</ContinueOnErrors>
			<PostActionBehavior Behavior="Nothing"></PostActionBehavior>
			<IsOffer>false</IsOffer>
		</Settings>
		<SettingsLocks>
			<ActionUITitle>false</ActionUITitle>
			<PreActionShowUI>false</PreActionShowUI>
			<PreAction>
				<Text>false</Text>
				<AskToSaveWork>false</AskToSaveWork>
				<ShowActionButton>false</ShowActionButton>
				<ShowCancelButton>false</ShowCancelButton>
				<DeadlineBehavior>false</DeadlineBehavior>
				<ShowConfirmation>false</ShowConfirmation>
			</PreAction>
			<HasRunningMessage>false</HasRunningMessage>
			<RunningMessage>
				<Text>false</Text>
			</RunningMessage>
			<TimeRange>false</TimeRange>
			<StartDateTimeOffset>false</StartDateTimeOffset>
			<EndDateTimeOffset>false</EndDateTimeOffset>
			<DayOfWeekConstraint>false</DayOfWeekConstraint>
			<ActiveUserRequirement>false</ActiveUserRequirement>
			<ActiveUserType>false</ActiveUserType>
			<Whose>false</Whose>
			<PreActionCacheDownload>false</PreActionCacheDownload>
			<Reapply>false</Reapply>
			<ReapplyLimit>false</ReapplyLimit>
			<RetryCount>false</RetryCount>
			<RetryWait>false</RetryWait>
			<TemporalDistribution>false</TemporalDistribution>
			<ContinueOnErrors>false</ContinueOnErrors>
			<PostActionBehavior>
				<Behavior>false</Behavior>
				<AllowCancel>false</AllowCancel>
				<Deadline>false</Deadline>
				<Title>false</Title>
				<Text>false</Text>
			</PostActionBehavior>
			<IsOffer>false</IsOffer>
			<AnnounceOffer>false</AnnounceOffer>
			<OfferCategory>false</OfferCategory>
			<OfferDescriptionHTML>false</OfferDescriptionHTML>
		</SettingsLocks>
		<IsUrgent>false</IsUrgent>
	</SingleAction>
</BES>

@JasonWalker, any suggestion on the shared data?

To expire “30 minutes after the absolute time we issue the action”, regardless of time zones, you have to change a couple of values in the Settings.

You must specify “UseUTCTime” is True, and then you need to calcalute the <EndDateTimeLocalOffset> based on the current UTC time + 30 minutes. Usually the Console does this for you, but when sending from the API you’ll have to calculate that yourself. In my case, with my root server running in UTC-0600, instead of an expiration in 30 minutes, I have to specify an expiration in 6 hours 30 minutes.

<EndDateTimeLocalOffset>PT6H30M</EndDateTimeLocalOffset>
<UseUTCTime>true</UseUTCTime>

What language are you using to send the API commands? The correct time offset can be determined programmatically, but the steps will vary by language. In Relevance you can query something like ‘current time zone’ to return -0600; there are ways in Python or PowerShell that can determine your system’s current time zone should you need it.

1 Like

we are using .Net for api call , does it mean that i need to find out the time zone on root server only to execute action to endpoints , as my root server in EST time and that is UTC -5:00 so it is -5 hours how to enter -5 in PT value ?

Once i send PT value then action will automatically close after 30 mins with start time regardless of agent time zones ??

As always, test…but my thinking is that the time zone offset should be relative to the machine on which your script runs. In my case the root server and console are in the same time zone.

Oh, I misunderstood…enter it as

<EndDateTimeLocalOffset>PT5H30M</EndDateTimeLocalOffset>

That’s adding 5 hours to get from UTC-0500 to UTC, and then 30 minutes to get to “30 minutes from now”

in my case root and console servers are in different time zone and rest api server in different time zone , i tried with PT5H30M and some of the action comes in expired state immediately after start time .

so it is not clear this PT entry depends on Rest API or console or root or endpoints time zone server :stuck_out_tongue: