Sending dynamic date fields with ISO format to a server

Hi everyone,

I’m trying to send dates to a server that expects ISO-formatted date strings. I’ve got a bunch of dynamic fields which are fetched from an RPC, some of which are dates and some of which aren’t. These fields are not known in advance.

If I knew in advance which fields were dates, I could just do this in the Communication part of the module:

"body": {
    "myfield": "{{formatDate(parameters.myfield, 'X')}}",
},

However, there is not an obvious way to achieve that only when working with fields which I’ve got from an RPC. At the moment, this is what the body for this request looks like:

"body": {
	"{{...}}": "{{omit(omit(omit(parameters, 'accountSid'), 'stackSid'), 'objectSid'}}"
},

The end result seems to be that, with this approach, dates are getting sent to the server in the local format, rather than as ISO strings.

I would like to know if there is any way to format the date parameters as ISO strings while not breaking any other parameters. Custom IML functions look like a possible alternative, but I don’t have access to these yet, so I would like to know if there’s a workaround as I would expect this to be a relatively common problem when working with dynamic fields from an RPC.

Thank you in advance!

Welcome to the Make community!

This is actually covered in the Make Partner Training, under Custom Apps Development Training, which I strongly recommend you complete before you continue.

You can use a custom IML function to “parseAllDates”, or parse timestamps. Your function would check the type of variable before attempting to parse the date/timestamp of each field.

For more information, see

Links

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

Feature Requests & Suggestions

Partner & Custom Apps

2 Likes