Developer forum

Forum » Integration » Import - xml provider - set default value on create

Import - xml provider - set default value on create

Lars Larsen
Reply

Hi

I have an import job that is using the xml provider and the job is set up to do mapping automatically at runtime. Now I want one field in the import to have the value "True" when the record is created in Dynamicweb. But only when the record is created not when it is updated. How can I achieve that?


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Lars

Maybe ommit the field on updates...?

BR Nicolai

 
Lars Larsen
Reply

Hi Nicolai

Yes but how do I do that? It's the same job that do the insert and update.

 
Nicolai Høeg Pedersen
Reply

Hi Lars

You must have something that generates the XML that gets imported. When you generate that, do not add that field.

 
Lars Larsen
Reply

Hi Nicolai

Let me explain what the scenario is:

It's products coming from NAV imported to Dynamicweb via the Batch Integration. We want products to be inactive when they are imported and created in Dynamicweb for the first time. Later a product is set active by the editor and then we don't want the product to be set inactive again after the next import from NAV. How could this be done?

 

 
Jonas Krarup Dam
Reply
This post has been marked as an answer

Hi Lars,

When using data integration, the products are added directly to the database.

On the database, the default value for the EcomProduct.Active column is "true".

The simplest way to achieve your desired behaviour is to change the default value on the table to "false". That way, when you are importing products without a value for the "active" column, they start out as inactive, and that state will only change if you do so manually, via the GUI (or if you import the value "true" to the column).

Regards, Jonas

Votes for this answer: 1
 
Lars Larsen
Reply

Hi Jonas

Yes of course, that's the way to do it. Thanks smiley

 

You must be logged in to post in the forum