urlwithparameters() function is converting a datetime query parameter into a timestamp when other numerical query parameters are involved.

Certified Senior Developer

Earlier today I was helping another developer understand an issue involving links using a urlwithparameters() function. They were experience an issue where a datetime passed as a query parameter was reading out one minute behind in the linked interface. When I investigated the issue I noticed that the query parameter was showing as a timestamp; however when I ran some small-scale tests I noticed when I passed datetimes as query parameters they were formatted appropriately (see screenshots for context). Ultimately what we discovered is that their use case they were passing two parameters, one an integer ID and the other the datetime. In my testing I was initially only testing with a datetime. When I included a similar integer parameter I was able to get the odd behavior to replicate. The solution for us was to cast the other parameters to strings. What is more interesting is that the behavior only occurs when the datetime is taken from a record. If I replace the datetime query param with a local variable or a datetime() function is works just fine and does not convert the datetime into a timestamp. My questions is whether or not this is expected behavior and if so then why?

a!localVariables(
  local!eventSchedule: 'recordType!{dc1b103d-69d8-42ae-b33f-ce537e281d61}CMGT_Event_Schedule'(
    'recordType!{dc1b103d-69d8-42ae-b33f-ce537e281d61}CMGT_Event_Schedule.fields.{78f9f05d-8087-4e02-81a8-903d96225e71}startDateTime': now()
  ),
  local!dateTime: now(),
  {
    urlwithparameters(
      path: "https://dummy.path",
      parameterNames: { "param1",  },
      parameterValues: {
        local!eventSchedule['recordType!{dc1b103d-69d8-42ae-b33f-ce537e281d61}CMGT_Event_Schedule.fields.{78f9f05d-8087-4e02-81a8-903d96225e71}startDateTime']
      }
    ),
    urlwithparameters(
      path: "https://dummy.path",
      parameterNames: { "param1", "param2" },
      parameterValues: {
        1,
        local!eventSchedule['recordType!{dc1b103d-69d8-42ae-b33f-ce537e281d61}CMGT_Event_Schedule.fields.{78f9f05d-8087-4e02-81a8-903d96225e71}startDateTime']
      }
    ),
    urlwithparameters(
      path: "https://dummy.path",
      parameterNames: { "param1", "param2" },
      parameterValues: {
        1,
        local!dateTime
      }
    ),
    urlwithparameters(
      path: "https://dummy.path",
      parameterNames: { "param1", "param2" },
      parameterValues: {
        tostring(1),
        local!eventSchedule['recordType!{dc1b103d-69d8-42ae-b33f-ce537e281d61}CMGT_Event_Schedule.fields.{78f9f05d-8087-4e02-81a8-903d96225e71}startDateTime']
      }
    )
  }
)

  Discussion posts and replies are publicly visible