0

I'm trying to get the current time minus 4 hours using the dateTime function. With the next expression:

#[server.dateTime.plusHours(-4)format("yyyy-MM-dd'T'HH:mm:ss'Z'")]

Flow:

<sub-flow name="retrieve-time-last-run-os">
        <objectstore:retrieve config-ref="ObjectStore_Connector" key="timeNow" defaultValue-ref="#[server.dateTime.plusHours(-4)format(&quot;yyyy-MM-dd'T'HH:mm:ss'Z'&quot;)]" doc:name="Retrieve Time Now"/>
        <set-variable variableName="time" value="#[payload]" doc:name="Save time"/>
</sub-flow>

locally it works fine. The problem is when I deploy this function seems not to work. Does anyone know how to fix this?

Thank you

aled
  • 21,330
  • 3
  • 27
  • 34
Makavelines
  • 111
  • 6
  • What version of Mule are you using? 'Does not work' is not very helpful. What is the result? – aled Apr 26 '22 at 14:00
  • I am using mule 3 – Makavelines Apr 26 '22 at 14:11
  • I have after that function a set payload which gives an error: Message : Execution of the expression "Payload" failed. (org.mule.api.expression.ExpressionRuntimeException). – Makavelines Apr 26 '22 at 14:23
  • Please add both the XML for where you use the function and the set payload to understand the context. What version exactly of Mule 3? Mule 3.9? – aled Apr 26 '22 at 14:58
  • @aled I have added in the question section. Thanks aled – Makavelines Apr 26 '22 at 15:06
  • I posted a possible solution based on the expression in the flow. Note that this is a Mule Expression Language (MEL) expression, not DataWeave. – aled Apr 26 '22 at 23:01

1 Answers1

1

In the flow there seem to be a missing dot between plusHours() and format().

aled
  • 21,330
  • 3
  • 27
  • 34