Update product on litium connect erp import

Im trying to import existing products using litium connect erp import, but the report returns that it fails.
Am I missing anything essential?
It’s not obvious to me that I missed something when reading this section of the documentation.

Message from erp import report:
“status”: “failed”,

    "importRecords": [
        {
            "importEntityId": null,
            "importEntityType": null,
            "status": "failed",
            "operation": "create",
            "errors": {
                "6515112e-cb2c-4ab8-be72-ebf23ede47d1": {
                    "errorCode": "ImportProductFailed",
                    "description": "Importing for product with article number 557013 was failed. Detail message: Validation error for BaseProduct(SystemId: 3e1476d9-79fe-4dbe-8cef-a0a9513210d9, Id: 557013), Id: 'Value is not unique.'.."
                }
            }
        }
    ],

    "errorMessage": "Importing for product with article number 557013 was failed."

Litium version: 7.7.1

The error clearly says that BaseProduct exists. So you need to use “update” operation on this product.

The error clearly says that BaseProduct exists. - Yes, thank you.

So you need to use “update” operation on this product. - Would you be so kind to refer to any documentation? Or atleast try and elaborate your answer a bit? Thank you.

I can’t find anything how to “use update operation” looking Here or Here or Here

The erp import seems to do every operation and make it fail instead of checking if product exists or not.

Make sure to set
ImportBehavior = ImportBehavior.ProceedWithErrors
in the ImportBatch class. The import will proceed with update after create.

This is what happens for you so you got some error in your import:

                    try
                    {
                        var product = _baseProductService.Get(importProduct.ArticleNumber)?.MakeWritableClone();
                        if (product == null)
                        {
                            _logger.LogInformation($"Create base product with article number {importProduct.ArticleNumber}.");
                            importRecord.Operation = ImportOperation.Create;
                            CreateProduct(importRecord, importProduct, productImportSettings, importErrors);
                        }
                        else
                        {
                            _logger.LogInformation($"Update base product with article number {importProduct.ArticleNumber}.");
                            importRecord.Operation = ImportOperation.Update;
                            UpdateProduct(importRecord, product, importProduct, productImportSettings, importErrors);
                        }

                        UpdateReportRecordSucceed(importReport, importRecord, importErrors);
                    }
                    catch (Exception ex)
                    {
                        var errorMessage = $"Importing for product with article number {importProduct.ArticleNumber} was failed.";
                        _logger.LogError(errorMessage, ex);
                        UpdateReportRecordFailed(importReport, importRecord, new List<ImportError>() { new ImportError(
                                ErrorCode.ImportProductFailed,
                                description: $"{errorMessage} Detail message: {ex.Message}."
                            )});
                        if (!isProceedWithErrors)
                        {
                            throw new Exception(errorMessage, ex);
                        }
                    }

This:

ImportBehavior = ImportBehavior.ProceedWithErrors

means continue with other products if one fails.
So your perception “The erp import seems to do every operation and make it fail instead of checking if product exists or not” is wrong. Your import has some faulty values and that throws an exception.

Yes ok I understand. Thanks for clarifying

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.