> For the complete documentation index, see [llms.txt](https://docs.thewalletcrew.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thewalletcrew.io/connectors/pos/cegid/customer-data-and-loyalty/cegid-retail-y2-fields-mapping.md). Agents can also search and read this documentation through its [MCP server](https://docs.thewalletcrew.io/~gitbook/mcp).

# Cegid Retail Y2 fields mapping

The customer create and update lifecycle, and the default field mapping between The Wallet Crew and Cegid Retail Y2, including its conditions.

The connector creates and updates customer records in Cegid Retail Y2 from enrolment forms, and reads them back to populate passes and pre-fill forms. This page documents that lifecycle and the field mapping applied by default.

## The create and update lifecycle

When an enrolment form is submitted, the connector maps the submitted data onto the Cegid customer structure, applies the brand's own mapping script if one is deployed, and writes the record. It then **reads the record back from Cegid** rather than assuming the write took effect as sent, which is why values normalized or rejected by Cegid are reflected immediately rather than at the next read.

## Finding an existing customer

Where a pass already carries a Cegid customer identifier, that identifier is used directly. Where it does not, the connector searches Cegid to avoid creating a duplicate.

That search runs in parallel across the email address and, for the telephone number, several formats — as entered, with the international prefix in either notation, and in national form — each checked against the four telephone fields a Cegid record carries. Closed records are excluded.

{% hint style="warning" %}
If more than one record matches, the most recently modified is used and the ambiguity is recorded in the logs. This is not rare: shared household telephone numbers and staff test records both produce it. Where duplicate matches are frequent, the underlying duplicates should be resolved in Cegid rather than tolerated, because which record a customer lands on can otherwise change over time.
{% endhint %}

## Default field mapping

The mapping below is applied before any mapping script runs. Almost every field is conditional, and the conditions are the source of most reported surprises: a field that appears not to map is usually a field whose condition was not met.

| The Wallet Crew field       | Cegid field                                   | Conditions and transformation                                                                                                                                                                |
| --------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `email`                     | `EmailData.Email`                             | Always written.                                                                                                                                                                              |
| `phoneNumber`               | `PhoneData.CellularPhoneNumber`               | Written when present.                                                                                                                                                                        |
| `firstName`                 | `FirstName`                                   | Always written.                                                                                                                                                                              |
| `lastName`                  | `LastName`                                    | Mandatory in Cegid. If blank on update, re-fetched from Cegid; if still blank, set to the literal `NEOSTORE`. On read, a last name of `NEOSTORE` is suppressed.                              |
| `sex`                       | `Sex`                                         | Only `M` or `F` are accepted. Any other value is written as empty.                                                                                                                           |
| `title`                     | `TitleId`                                     | Written when present.                                                                                                                                                                        |
| `advisor`, else `advisorId` | `SalesPersonId`                               | The first of the two that is present.                                                                                                                                                        |
| `storeId`                   | `UsualStoreId`                                | Written when present. On read, falls back to the store of creation when the store of attachment is empty.                                                                                    |
| `isProspect`                | `IsProspect`                                  | Always written, defaulting to false.                                                                                                                                                         |
| `birthDate`                 | `BirthDateData`                               | Day and month accepted when greater than zero; year only when after 1900 and not in the future. If all three are present but do not form a valid past date, the whole birth date is cleared. |
| `address`                   | `AddressData.AddressLine1`                    | Always written.                                                                                                                                                                              |
| `streetNumber`              | `AddressData.AddressLine2`                    | Always written.                                                                                                                                                                              |
| `postCode`, else `zipCode`  | `AddressData.ZipCode`                         | The first of the two that is present. Read back into `postCode`.                                                                                                                             |
| `city`                      | `AddressData.City`                            | Always written.                                                                                                                                                                              |
| `country`                   | `AddressData.CountryId`                       | **Only written when the value is exactly two characters**, and then as an ISO-2 code. Anything else is discarded with a warning. On read, Cegid's own identifier is converted back to ISO-2. |
| `nationality`               | `NationalityId`                               | Written when present.                                                                                                                                                                        |
| `consents_email`            | `OptinEmail` and `EmailData.EmailingAccepted` | Written **only when an email address is present**. True becomes brand-only consent, false becomes do-not-use.                                                                                |
| `consents_sms`              | `OptinMobile`                                 | Written **only when a mobile number is present**.                                                                                                                                            |
| `consents_post`             | `OptinPostal`                                 | Written **only when an address line, city, or postcode is present**.                                                                                                                         |
| `consents_emailReceipt`     | `EmailData.SendReceiptByMail`                 | Written only when an email address is present.                                                                                                                                               |
| `lastUpdated`               | `LastModificationDate`                        | Read only.                                                                                                                                                                                   |

{% hint style="danger" %}
The consent conditions are the most misread part of this table. A consent is written only when the channel it governs has data, so a form that collects postal consent but no address records nothing in Cegid, and the absence is silent. Where consents appear not to save, the first thing to check is whether the corresponding contact detail was captured on the same form.
{% endhint %}

## Reading back into a form

The same mapping applies in reverse when a customer is loaded, to pre-fill an edit form or to populate a pass. Empty Cegid values are not written over existing wallet values, and two sentinel values are filtered: a last name of `NEOSTORE`, and a birth year of 1900 or zero, which Cegid uses to mean unset.

## Extending the mapping

Everything beyond standard identity and contact fields is set through a mapping script: see [Customize the mapping](https://docs.thewalletcrew.io/connectors/pos/cegid/customer-data-and-loyalty/customise-the-mapping.md). The structure of the Cegid customer object a script works with is in the [Scripting reference](https://docs.thewalletcrew.io/connectors/pos/cegid/developer-reference/scripting-reference.md).

The structure of the Cegid customer object, as documented by Cegid, shows the exact property to read or write in a custom mapping script. The main properties are:

| Property                                                                                                                                                                                                                                                                                       | Type                      | Content                                                                                                                                                                                                                                                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AddressData`                                                                                                                                                                                                                                                                                  | `AddressDataType`         | `AddressLine1`, `AddressLine2`, `AddressLine3`, `BrandName`, `City`, `CountryId`, `CountryIdType` (`Internal`, `ISO2`, `ISO3` or `ISO3Numeric`), `Nata`, `RegionId`, `ZipCode`.                                                                                        |
| `EmailData`                                                                                                                                                                                                                                                                                    | `EmailDataType`           | `AlternativeEmail`, `Email`, `EmailingAccepted`, `SendReceiptByMail`.                                                                                                                                                                                                  |
| `PhoneData`                                                                                                                                                                                                                                                                                    | `PhoneDataType`           | `AlternativePhoneNumber`, `CellularPhoneNumber`, `HomePhoneNumber`, `OfficePhoneNumber`.                                                                                                                                                                               |
| `FirstName`, `LastName`, `AlternateFirstName`, `AlternateLastName`                                                                                                                                                                                                                             | `string`                  | Customer names.                                                                                                                                                                                                                                                        |
| `TitleId`, `SalesPersonId`, `SalesPerson2Id`, `SalesPerson3Id`                                                                                                                                                                                                                                 | `string`                  | Customer title and sellers.                                                                                                                                                                                                                                            |
| `IsCompany`                                                                                                                                                                                                                                                                                    | `boolean`                 | Whether the customer is a company.                                                                                                                                                                                                                                     |
| `LastModificationDate`                                                                                                                                                                                                                                                                         | `dateTime`                | Date of last change, available in read-only mode.                                                                                                                                                                                                                      |
| `UserDefinedBooleans`, `UserDefinedDates`, `UserDefinedTexts`                                                                                                                                                                                                                                  | arrays                    | User-defined values, each identified by an `Id` from 1 to 3.                                                                                                                                                                                                           |
| `UserDefinedData`                                                                                                                                                                                                                                                                              | `UserDefinedDataType`     | `UserDefinedTable0Value` to `UserDefinedTable9Value`.                                                                                                                                                                                                                  |
| `ActivitySectorCode`, `BusinessAreaCode`, `CpfCnpjCode`, `MunicipalRegistration`, `OriginCode`, `PriceListCode`, `RegionalRegistration`, `RiskLevel`                                                                                                                                           | `string`                  | Optional classification and registration codes.                                                                                                                                                                                                                        |
| `BirthDateData`                                                                                                                                                                                                                                                                                | `BirthDateDataType`       | `BirthDateDay`, `BirthDateMonth`, `BirthDateYear` (each an `int`).                                                                                                                                                                                                     |
| `OptinEmail`, `OptinAlternativeEmail`, `OptinMobile`, `OptinHomePhone`, `OptinOfficePhone`, `OptinPostal`                                                                                                                                                                                      | `CustomerInformationType` | Consent per channel: `AskCustomer`, `BrandOnly`, `ForPartners` or `DoNotUse`.                                                                                                                                                                                          |
| `ValidEmail`, `ValidAlternativeEmail`, `ValidMobile`, `ValidHomePhone`, `ValidOfficePhone`                                                                                                                                                                                                     | `boolean`                 | Whether the email address or phone number is valid.                                                                                                                                                                                                                    |
| `UserFields`                                                                                                                                                                                                                                                                                   | array of `UserField`      | Each user field has an `Id`, a `ValueType` (`BooleanValueKind`, `TextValueKind`, `DateValueKind`, `ListElementValueKind` or `NumberValueKind`) and its value in the matching property (`BooleanValue`, `TextValue`, `DateValue`, `ListElementValue` or `NumberValue`). |
| `CustomerId`, `CustomerGuid`, `UsualStoreId`, `Barcode`, `LanguageId`, `NationalityId`, `CurrencyId`, `Sex`, `ShortName`, `LongDescription`, `Notepad`, `PassportNumber`, `CompanyIdNumber`, `CompanyTitleId`, `FiscalId`, `ItalianFiscalId`, `VATSystem`, `ActivityCode`, `InvoiceCustomerId` | `string`                  | Other identity, profile and fiscal properties. `CustomerId` is assigned automatically when it is not specified and automatic assignment is enabled in the default store settings.                                                                                      |
| `Closed`, `IsProspect`, `DirectMail`                                                                                                                                                                                                                                                           | `boolean`                 | Whether the customer is closed, whether the customer is a prospect, and mail merge (`DirectMail`).                                                                                                                                                                     |

## FAQ

<details>

<summary><strong>Why is a customer's country missing in Cegid?</strong></summary>

The country value was not exactly two characters. The connector writes ISO-2 codes only, and discards anything else rather than sending a value Cegid would reject.

</details>

<details>

<summary><strong>Why does a customer have the last name <code>NEOSTORE</code>?</strong></summary>

The prefix `NEOSTORE` is the platform's former name, kept in this literal. Cegid requires a last name. Where a form allows it to be empty and no existing value can be recovered, that placeholder is written so the record can be created at all. It is hidden when read back, but visible in Cegid. Making the field mandatory on the form avoids it.

</details>

<details>

<summary><strong>Are consents overwritten on every update?</strong></summary>

Only where the corresponding contact detail is present on the submission. A brand that manages consent primarily in Cegid should confirm which fields the enrolment form submits, since a form that carries a consent value will write it.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.thewalletcrew.io/connectors/pos/cegid/customer-data-and-loyalty/cegid-retail-y2-fields-mapping.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
