Skip to Content
author's profile photo Former Member
Former Member

B2BUnit creation programatically with a nonadmin user


We have a requirement where B2BUnit and B2B customer details will be captured through Hybris storefront and will be passed to SAP CRM. If the customer and contact person created successfully in CRM then the same has to be created/stored in Hybris as B2BUnit and B2BCustomer. When we are trying to save the B2BUnit details we are getting the error "Only member of an 'admingroup' can create a top level Organization". I think we need to make sure to avoid executing the below logic.

if (ctx.getModelService().isNew(model) && this.getB2bUnitService().getParent(unit) == null && !this.getUserService().isMemberOfGroup(this.getUserService().getCurrentUser(), this.getUserService().getAdminUserGroup())) { throw new InterceptorException( this.getL10NService().getLocalizedString("error.b2bunit.root.create.nonadmin")); }.

Can you please help us in overriding this or any other possible solution to avoid this error programatically?

Thanks and Regards, Sumanth

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Sep 06, 2017 at 12:06 PM

    You can check this document about Disabling Interceptors:

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 22, 2017 at 02:57 AM


    You have to replace the 'B2BUnitModelValidateInterceptor' which is OOTB interceptor. Please follow replace interceptor steps in wiki.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.