feed-me icon indicating copy to clipboard operation
feed-me copied to clipboard

Mapping issue if custom field has the same handle as the element's attribute

Open i-just opened this issue 2 years ago • 0 comments

Description

If you have an element with an attribute and then create a field with a handle that’s the same as the attribute and try to map the attribute to a node in the feed and that field to another node in the feed, the first mapping will be overwritten with the second one.

For example, the User element has a preferredLocale attribute.

Steps to reproduce

  1. Create a custom field with a handle preferredLocale (e.g. plain text field)
  2. Add that field to Settings > Users > Fields
  3. Create a feed for User element
  4. Use the json pasted below
  5. Map preferredLocale attribute to preferredLocale node from the json
  6. Map preferredLocale custom field to customFieldPreferredLocale node from the json
  7. Save your mapping and view it again
  8. Both preferredLocale attribute and custom field are mapped to customFieldPreferredLocale

JSON:

{
	"users": [
		{
			"username": "u1",
			"email": "[email protected]",
			"photo": "",
			"preferredLocale": "es",
			"customFieldPreferredLocale": "my custom field value"
		},
		{
			"username": "u2",
			"email": "[email protected]",
			"photo": "",
			"preferredLocale": "en",
			"customFieldPreferredLocale": "my custom field value"
		},
		{
			"username": "u3",
			"email": "[email protected]",
			"photo": "",
			"preferredLocale": "",
			"customFieldPreferredLocale": ""
		},
		{
			"username": "u4",
			"email": "[email protected]"
		}
	]
}

Additional info

  • Craft version: 3.8.8 and 4.4.8
  • PHP version: 8
  • Database driver & version: n/a
  • Plugins & versions: Feed Me 4.6.2 and 5.1.2

i-just avatar Apr 27 '23 09:04 i-just