Hi guys,
I have a data integration job that gets basic product data from NAV, such as the number, name and price. These products need to be enriched in Dynamicweb before they can be activated. In my data source (from NAV) I can't tell if products are new, or already exist in Dynamicweb. How do I handle the Active flag? If I default to False, I am going to disable existing and previously activated products. If I default to true, they'll be true immediately.
I was thinking to use a table script, like this:
public override void ProcessInputRow(Mapping mapping, Dictionary<string, object> row)
{
var productId = row["ProductID"].ToString();
var product = Product.GetProductByID(productId);
if (product == null)
{
row["ProductActive"] = false;
}
else
{
row["ProductActive"] = product.Active;
}
}
This would check if the product exists and then use its current Active state. (I would optimize this a little further by fetching maybe all product IDs and Active states once first).
Does that make sense? Or is there an easier solution?
Imar