user1865775 February 2016

How to get config data from local.properties to impex?

Is it possible to get a value from the environment variables defined at local.properties configuration file and access it via the impex file?

Ex.

$someMacro=<some variable from config>

Thank you!

Answers


Atsusa Kai February 2016

You can add this to your impex:

# Import config properties into impex macros
UPDATE GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true]

All your configurations from local.properties, etc. are now loaded and can be used via $config- prefix, say for example:

local.properties

your.config.property=322

So your impex would look something like:

# Import config properties into impex macros
UPDATE GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true]

$variable=$config-your.config.property

INSERT_UPDATE SampleItem;code[unique=true];name
;sample1;$variable

# OR you can just directly use the config macro
INSERT_UPDATE SampleItem;code[unique=true];name
;sample1;$config-your.config.property

Hope this works for you.

EDIT: Please also note that if there was no such property found, the value stored on the sample above shall be exactly: $config-your.config.property.

Post Status

Asked in February 2016
Viewed 3,817 times
Voted 4
Answered 1 times

Search




Leave an answer