Problem/Motivation
When sending an address field to SF via an object mapping, if the field was not filled in it is transmitted as an empty array, instead of being excluded from the data packet. This results in the following error:
Cannot deserialize instance of textarea from START_ARRAY value [line:1, column:395]
Looking at the logs, this is the data that was transmitted for the address:
"Mailing_Address__Street__s":[]
"Mailing_Address__City__s":[]
"State__c":[]
"Mailing_Address__PostalCode__s":[]
"Country__c":[]
The issue here appears to be the address fields being set to empty arrays.
I'm not 100% certain if the issue is with the Webform module or Salesforce, but figured I'd start somewhere.
This is also made more complicated because it doesn't happen every time - most submissions go through as "null", which is correct.
Steps to reproduce
Set up a webform with an optional address field.
Set up an object mapping for the webform submission that maps individual address fields to individual SF fields.
Submit the webform without filling in the address field.
(exact steps TBD as not every submission has this issue)
Proposed resolution
Don't send address fields if they are empty.
Remaining tasks
Work out the best fix for the issue.
Add test coverage.
User interface changes
Empty data would not be transmitted as an empty array.
API changes
TBD
Data model changes
n/a