3

I'm trying to import the impex files using ant importImpex -DSource=items.impex. This is successfully importing the impex files but the changes are reflecting in the MASTER tenant.

How to specify a particular tenant as an argument with ant importImpex command?

I have tried ant importImpex -DSource=items.impex -Dtenant=tenantID but it is not working.

Is there any other way?

alain.janinm
  • 19,951
  • 10
  • 65
  • 112
ANIL
  • 2,542
  • 4
  • 25
  • 44

2 Answers2

2

There is no option to set tenant in this ant target.

To know available options type ant -p. Note that in hybris 6.1 you'll see that the option to set impex path is -Dresource

What you can do is use Bean Shell annotation in your impex file.

Add this line before your INSERT_UPDATE statements :

"#% Registry.setCurrentTenantByID(""tenantId"");"

Then run the regular ant importImpex target and you'll see that the data are only in the tenant set in the annotation.

alain.janinm
  • 19,951
  • 10
  • 65
  • 112
  • 1
    I also figured out another approach for this, with that we can use ant **importImpex -DSource=items.impex -Dtenant=tenantID**. For this we need to edit the **platformadministration.xml** present inside **HYBRIS_HOME/bin/platform/resources/ant** and add the following to the **importImpex** microdef. `Registry.setCurrentTenantByID("${tenant}");` Add this after `import de.hybris.platform.core.Registry; import de.hybris.platform.servicelayer.impex.impl.CmdImpExService;` – ANIL Nov 24 '16 at 06:52
0

Also you can go to the tenant section in the administration console and then open the console for the desired tenant( you might need to initialise it first if you haven't already done so). From there you can access the impex console of this particular tenant and execute your impex from there.

megalucio
  • 5,051
  • 2
  • 22
  • 26