Developer forum

Forum » Integration » Auto-generating IDs

Auto-generating IDs

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

When using the EcomProvider as a target, is there a way to automatically create primary keys? I am integration into ProductItems to build a Parts List product and my code fails when I don't supply the ProductItemID. Is this by design?

Thanks,

Imar


Replies

 
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Imar,
This is not directly implemented for the ProductItems table, but there is a way to implement the primary key generation using new scripting functionality.
You need to add a mapping for PK column(in this case ProductItemId) and add a Scripting condition with @Code() C# statement. For example see the attached image with sample
code. Don't forget to check this column mapping as an Active mapping and do not include ProductItemAutoId column in the mapping as this column will have the db autogenerated value.
Regards, Dmitrij

Untitled.jpg
Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Dmitrij,

Thanks, that makes a lot of sense.

Imar

 

 

You must be logged in to post in the forum