Based on just that snippet of code, it looks like that should work. While it should be functionally the same, I would suggest the following code to assign the custom field:
Is it possible to share a larger snippet showing some of the logic for how you create and submit the contact data? (Please note that you'll want to censor your API key and access token from any code snippets that you share)
You can post a new message in the Community or find us on Twitter Mon-Fri 8am-8pm ET, Sat 10am-8pm ET, & Sun 10am-6pm ET. We've got real people waiting to help you out. Click below to start a conversation!