docs: Clarify that value 0 is valid when setting contact fields via API#297
Draft
promptless-for-oss wants to merge 1 commit intomautic:5.xfrom
Draft
Conversation
Signed-off-by: promptless-for-oss <promptless-for-oss@users.noreply.github.com>
| * - ``overwriteWithBlank`` | ||
| - If true, then empty values get set to fields. Otherwise empty values get skipped | ||
|
|
||
| .. note:: Mautic only treats ``null`` and empty strings (``''``) as empty values. The value ``0`` - whether integer or string - counts as a valid value and gets saved to the field. This matters when using ``overwriteWithBlank`` or setting numeric fields to zero. |
Author
There was a problem hiding this comment.
Citation: Based on bug fix in LeadModel::setFieldValues() that changed from loose to strict comparison for empty value detection. The PR description explains that null == 0 returned true (buggy) but now null === 0 returns false (correct), allowing 0 to be saved as a valid value.
View source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Open this suggestion in Promptless to view citations and reasoning process
Adds a note to the Contacts API documentation explaining that Mautic only treats
nulland empty strings as empty values. The value0(integer or string) is a valid value and will be saved to the field. This clarification helps API developers who need to set numeric fields to zero.Trigger Events
mautic/mautic PR #15900: fix: use strict comparison for isEmpty to allow saving value 0 in contact fields
Promptless Research (1 GitHub PR)
Agent Response
Tip: Use labels in the Promptless dashboard to categorize suggestions by release or team 🏷️