Lead module
The lead module can be used to establish two-way integration with XDMS. You can separately set how leads will be pushed to XDMS from HyperPortal and vice-versa. In XDMS leads are stored in the relation tab -> Prospect Desk -> Leads

From XDMS to HyperPortal mapping
NRid-cust-ext XDMS field contains the external ID of the lead and should be stored in the XDMS External Ref property in the HyperPortal because it acts as the unique property.

The mapping will look like this - XDMS External Ref = NRid-cust-ext
Organization(NMcust-2), Location(NRwh), Customer type(CDcust), Make(NMbrnd-curr), Model(NMmodel-curr), Language(CDlang), Gender(CDsex) all are 'property-type' fields. To map those fields correctly you should use this XDMS_REF_TO_ENTITY_ID command. It will select a proper entity based on the value from XDMS. You can read more about this command here. The communication preference fields - Allow post(YNmail), Allow phone(YNtel), Allow mobile phone(YNtel-mob), Allow email(YNemail), Allow SMS(YNsms) should be mapped using the INDEX command. Those fields are displayed as checkmarks in XDMS. When mapped to HyperPortal they return an array where the first item is TRUE or FALSE depending on the checkmark.

So to map this value correctly to HyperPortal we use this expression - INDEX(YNsms,1) where YNsms is a name of the XDMS field, INDEX is a command that chooses an item from the array, '1' is an index of the item in the array.
Other fields are mapped just by their name.
From HyperPortal to XDMS mapping
CDsrc field in XDMS stores the origin of the lead.

In our case, we store the lead origin in the entity-type field (leadOrigin), to pass the name of the lead origin we use this expression - CDsrc = leadOrigin.title
NRid-cust-ext is a unique property and is mapped to the entityId field.
Location(NRwh), organization(CDcust), language(CDlang), gender(CDsex) and organization(NMcust-2) are all an property type fields and should be mapped by their xdmsExternalRef property. You can read more about the mapping of such properties here.
The mapping will look like this - organization.xdmsExternalRef = NMcust-2

The country field should be mapped by the entity id.

The rest of the fields can be mapped using their property ID.
Example of the correct mappings - https://volodymyro.hyper1.net/settings/integrations/xdmsIntegration/xdmsLeadModule/