
An optional company field left blank on a Contact Form 7 inquiry should not automatically erase a company’s name from an existing CRM contact. A new inquiry and a full profile replacement are different operations. Decide what missing and empty answers mean before allowing a connector to update established records.
This guide describes a receiving-adapter policy for authorized lead workflows. It is not a claim that core CF7 or CF7 Analytics performs these updates. The examples are synthetic, and each destination API needs its own documented translation. An HTTP method called PATCH does not make every CRM follow the same patch format.
Model intent before serializing a request
Separate three business operations: retain the existing value, replace it with a validated answer, and clear it deliberately. For an ordinary inquiry form, retaining information when an optional question is unanswered is often a reasonable starting policy. A profile-management interface may need an explicit clear control. Choose according to the purpose and authority of the form.
Represent those decisions inside your adapter before constructing the destination request. A missing key, an empty string, JSON null and an empty list are different data states. None tells you by itself whether the person intended to remove an existing value. A field that was hidden or disabled may also be absent for reasons unrelated to intent.
Use a per-field policy. A blank telephone answer might retain a saved telephone number, while a provided preferred-contact method might replace its previous value. Consent and subscription preferences need their own reviewed workflow. Do not turn a missing checkbox into an instruction to subscribe someone or treat this general data policy as permission to overwrite consent records.
Do not use truthiness as a data contract
A condition such as if (value) groups several distinct states together. Numeric zero and boolean false may be valid values in an adapter even though both are falsey in JavaScript. Check whether a key exists and then validate its type and meaning. MDN documents Object.hasOwn() for distinguishing an object’s own property from an absent property.
The following small fixture shows a presence check, not a complete CRM update implementation:
const answers = { follow_up_count: 0, company: "" };
const countWasProvided = Object.hasOwn(answers, "follow_up_count");
const phoneWasProvided = Object.hasOwn(answers, "phone");
// countWasProvided is true; phoneWasProvided is false.
Also review the serializer. JavaScript’s JSON serialization omits undefined object properties, while undefined array elements become null. A transformation that uses undefined as an internal marker can therefore change representation at the wire boundary. Inspect the actual serialized request rather than only the object shown in a debugger.
Translate into the destination’s actual update rules
JSON Merge Patch, specified by RFC 7396, gives null a removal role for object members. With a target containing a company member, this illustrative merge patch requests its removal:
{ "company": null }
That meaning applies when the receiver implements the specified merge-patch format. It is not a universal instruction for every CRM. Another API may reject null, interpret it as a value, or require a special clear mechanism. Read the endpoint documentation and property constraints for the exact destination and API version you use.
JSON Patch, specified by RFC 6902, expresses changes through operations instead. Its remove operation names a path, and the target location must exist. This deliberately different illustration is not interchangeable with the merge-patch body:
[
{ "op": "remove", "path": "/company" }
]
Some CRM APIs use neither representation. For example, HubSpot’s contact documentation describes updating selected contact properties through its own request structure. That is a reason to consult its contract, not to wrap a generic patch in a guessed properties field. Keep destination-specific behavior in a tested adapter rather than spreading assumptions through form templates.
Distinguish creating a record from updating one
A creation request may need a required identifier and only the information the inquiry actually supplies. An update should identify an existing record deliberately and list only approved changes. Do not merge people because their names happen to match. Use your established destination identity rules and review ambiguous matches.
For multi-value fields, define whether a new selection replaces the full list or adds to it. An empty array may have a clearing effect even where an omitted field would retain it. Our guide to preserving multi-select arrays covers the earlier transport boundary. Retaining the correct list type still leaves the update operation to decide.
Verify the policy against existing synthetic records
Create a staging record with recognizable synthetic company, phone and interest values. Send a request with each field omitted, then an empty string, null, a valid replacement, and any explicitly authorized clear operation. Inspect both the adapter’s decision and the resulting destination record. Record expected rejection as carefully as expected acceptance.
Include zero and false where the destination schema permits them. Repeat a request and check that a delivery retry does not reintroduce a value that a later legitimate update removed. Older queued messages can arrive after newer ones; a retain-versus-clear policy does not replace a version or ordering policy. See payload migration planning when contracts change.
Keep a minimal decision trail
Record which field policy ran, the operation chosen, destination record reference and result. Avoid copying complete inquiry bodies into general logs. A diagnostic statement such as “company retained because optional answer was absent” is more useful than an unexplained successful HTTP status. Check your logging implementation for appropriate structured context and retention.
For WordPress submission trends, review Svetlik Analytics for Contact Form 7, our free plugin. Those statistics serve a different purpose from CRM property history. They do not prove an external update succeeded, a contact is qualified or an email reached an inbox.
Sources
Checked October 27, 2026: JSON Merge Patch, JSON Patch, Object.hasOwn(), JSON.stringify() and HubSpot contact updates.
