Import stock items with images
Following KB introduces the way how we can import inventory stock items information with attaching images and adding this image as an image of the item on the Attributes tab. The same approach can be used to import attachments to any import with attachments.
Article Outline
- Section 1 (Subtitle)
- Section 1 > Sub-section 1 (Heading 5)
- Section 1Sub-section 2 (Heading 5)
- Section 2 (Subtitle)
- Section 2 > Sub-section 1 (Heading 5)
- Section 2 > Sub-section 2 (Heading 5)
- Section 3 (Subtitle)
- Section 3 > Sub-section 1 (Heading 5)
- Section 3 > Sub-section 2 (Heading 5)
Preparing importing data
attachment data limitation
Unfortunately import scenario cannot deal with the file itself. It operates with base64 string massive.
converting files into base 64
There are a lot of ways to convert file to the base 64:
- You can use 3rd party utilities (like Total Commander)
- You can use C# or any other programming environment and prepare your own converter
- You can use online converter. I found a lot of them and some of them works pretty well. Example:
having source data
Now you just insert converted file content into the excel file:
import scenario
prerequisitions
- Create the provider based on the import file
- Create a new import scenario and make sure the Show All Commands option is enabled
having it done
Here is how it should looks like:
There are 2 major thing:
- This is how the attachment will be named in the system – “<filename>.<file extension>”. Make sure that the extension is provided and allowed in the system.
- The internal link to the file must be placed into the ImageUrl field. This link is autogenerated by the process so we just need to replicate it in out import scenario. Here is the formula:
='Import by Scenario ('+PadRight(UCase([Inventory ID]), 12, ' ')+')\\pict.jpg'
Where:
‘Import by Scenario’ – prefix generated by the system
[Inventory ID] – the column for inventory item code in the import file
12 – the length of the inventory item segment
pict.jpg – the name of the attachment we are using in this particular scenario
As a result of this formula the ImageURL would be
Import by Scenario (TESTNEW1 )\pict.jpg
for the example above.
And this is it. We’re done.