Hi all
I have a requirement to build a WEB API and a Process model to update other external system. The request to the web api is:
{ "accountNumber": "20171941", "houseNumber": "13329892", "contractStartDate": "2022-08-25T00:00:00.0000000+01:00", "contractEndDate": "2023-08-25T00:00:00.0000000+01:00"}
From the WEB API I am using the function a!fromJson to get the values for the process model from the http!request.body, as usual. When we validate the process model and it execution the dates on the request changed from 2022-08-25T00:00:00.0000000+01:00 to 8/24/2022 11:00 PM GMT+00:00.
I understand that the JSON functions detects the Date but we really need to keep that format from the request. Any Idea?
Thanks
Mario
Discussion posts and replies are publicly visible
Can you explain more about the dates having "changed"? As a reminder, Appian carries all date values as their underlying GMT value, and typically upon rendering shows you the relative value according to your local timezone (but the underlying value is still the same). I'm unclear what may be happening in your case as it sort of depends on details you haven't provided yet.
I need to ask this question ... Are you aware that a value and it's visual representation are two different things?
So, my next question is: "Why do you need to keep that format?"
a!localVariables( local!json: "{ ""accountNumber"": ""20171941"", ""houseNumber"": ""13329892"", ""contractStartDate"": ""2022-08-25T00:00:00.0000000+01:00"", ""contractEndDate"": ""2023-08-25T00:00:00.0000000+01:00"" }", local!appian: a!fromJson(local!json), a!toJson(local!appian) )
This returns a date like: "2022-08-24T23:00:00Z" which is, by the ISO 8601 definition, the exact same value. In UTC.
When the value is passed from the WEB API to the process Model, I notice that the Strings for the date values change from 2022-08-25T00:00:00.0000000+01:00 to 8/24/2022. I understand that APPIAN understands that the string is a date based on the format but I need to keep the format, this is I need to treat it as string.
Hi Stefan, thanks for the explanation.
mrios0001 said:I notice that the Strings for the date values change from 2022-08-25T00:00:00.0000000+01:00 to 8/24/2022.
Can you clarify what you're seeing to make you think this? Where are you seeing "8/24/2022"? What data type is the PV it's being stored in - is it actually string?
Why do you think you would need to keep the format?