Hi there - i need clarification on ERP Sync list mappings, specifically for list fields such as Country.
I made a custom Business Central ERP connector exposing country list items from BC through WSGetList. Example ERP country
codes include:
- UK = United Kingdom
- NL = Netherlands
- CZ = Czechia
In SuperOffice ERP admin, we map the ERP list item UK to the SuperOffice country item “Storbritannien” / Great
Britain.
Our expectation was that when SuperOffice later calls the ERP connector, it would send the mapped ERP list key, i.e.
UK.
However, in our connector logs we see SuperOffice sending SuperOffice/internal country values instead:
During advanced search:
{
"FieldKey": "COUNTRY",
"Operator": "oneof",
"ScalarValue": "GB",
"Values": ["GB"]
}
During create actor:
{
"a:Key": "COUNTRY",
"a:Value": "GBR"
}
Business Central rejects this because GBR does not exist in the BC Country/Region table. The valid ERP value is UK.
So the question is:
When a list field is mapped in ERP Sync admin, should SuperOffice apply that mapping before calling connector methods
like WSCreateActor, WSSaveActors, and WSSearchActorsAdvanced?
Or are list mappings only used when importing/displaying ERP values in SuperOffice, meaning the connector must itself
translate SuperOffice values like GB/GBR back to ERP keys like UK (for example by receiving the mapping from netserver)?
Related questions:
1. Does the ERP connector SOAP contract ever receive the saved list mappings?
2. Is IErpSyncAgent.GetConnectionListMappings the right function to call IF i have to go and fetch the mapping manually, which honestly feels really stupid?
3. For CRM -> ERP flows, is the connector expected to receive CRM list values or ERP list values?
4. Is search different from save/create in this regard?
I have added connector-side aliases as a workaround, but I need to understand the intended contract. If the ERP admin
maps ERP UK to SuperOffice “Great Britain”, it seems logical that CRM -> ERP calls should send UK, not GB or GBR.
Can anyone confirm the expected behavior, before i end up ripping all my hair out? :)
Allt Svar (2)
Hi Dennis,
I think SuperOffice is supposed to translate list values to ERP keys before calling WSCreateActor, WSSaveActors and WSSearchActorsAdvanced. That said it looks like WSSearchActorsAdvanced do not follow the same translation layer so we would have to investigate/debug this to figure out if its a bug or by design.
It would be interesting to see what is stored in the `ERPLISTITEMEMAPPING` in your database and verify the CrmItemKey value match the actuall integer IDs from the SuperOffice country table. If that row is missing or has a wrong ErpFieldId the code falls back to the raw internal value which could be GBR in your case (?)
Do you have access to the database directly?
I suggest you send send an email to appdev@superoffice.com so we can investigate
//Eivind