I’m hoping that someone can help me with my Go template logic. I built a template to use with the audit API to provide me information when a user was created, since this information isn’t readily available in the in the UI, or from the User APIs. I have all the correct data, but the user name and e-mail values of the user created are surrounded by square brackets and I can’t figure out how to modify my template to not display them.
Here is the template:
{{printf "User ID,User Name,EventDate,User Created ID,User Created Name, User Created Email\n"}}
{{- range . -}}
{{printf "%q,%q,%q,%q" .user.id .user.name .eventDate .entity.id}}
{{- range .propertyChanges -}}
{{if eq .property "name"}}{{printf ",%q" .newValues}}{{end}}{{if eq .property "email"}}{{printf ",%q\n" .newValues}}{{end}}{{end}}{{end}}
And here is a sample of the results I get:
"a0c173d1-3529-268a-a103-06da2ce8c19c","Bob Marley","2024-05-18T18:13:44Z","da4ad73d-2458-4dcb-a2a5-8fdd3c6e07f6",["Tom Smith"],["tsmith@company.com"]
"a0c173d1-3529-268a-a103-06da2ce8c19c","Bob Marley","2024-05-18T21:08:05Z","82abc54f-23f0-4e40-b125-fabba2347214",["Bonnie Tyler"],["btyler@company.com"]
Thanks for any help!