on 02-10-2021 7:22 AM
Hi experts!
By default the user who execute the impex created by hotfolder is anonymous, but I would like changed the user because I need use a user with admingroup.
In my case, I developed a hotfolder to create B2BUnits but I B2BUnitModelValidateInterceptor throws the exception because anonymous doesn't have admingroup. I attach the snapshot where the exception was thrown it
Thank you very much for your help and best regards
Hi Maria,
Impex API provides a way to execute Java Code blocks before you execute an Import Statement.Below is the given Syntax.
#% <Code Block>
INSERT_UPDATE <ItemType>;<attribute>[Header Qualifiers];<attribute>[Header Qualifiers]
From from your Question it looks like you may have to change the Session user before executing the script which could look something like below
#% import de.hybris.platform.core.Registry
#% import de.hybris.platform.servicelayer.user.UserService
#% import de.hybris.platform.core.model.user.UserModel
#% UserService userService = Registry.getApplicationContext().getBean("userService")
#% userService.setCurrentUser((UserModel)userService.getAdminUser())
INSERT_UPDATE B2BUnit;uid[unique=true];name[lang=en]
;1234556;"Example"
The Above is also applicable to Hot Folders
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.