web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to link/restrict sales responsible with sales unit on sales order form? AX 2012 R2

(0) ShareShare
ReportReport
Posted on by 1,813

Hii,

On sales order form or when creating sales order, we want sales unit should be selected for a particular sales responsible.

Please guide where we can link sales units with sales responsible or where to do customization to achieve required results.

Please code with examples.

Thanks, 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    When we create a sales order default values for salesunitId and sales responsible are assigned in the method initValue_Server of table SalesTable. You can customize here to get the desired result.

    Thanks,

    Chaitanya Golla

  • Rana Anees Profile Picture
    1,813 on at

    Thanks Chaitanya Golla,

    Can you please give some coding example to restrict sales responsible for sales units.

    Thanks,

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi Rana,

    This is the place where salesunitId and sales responsible gets defaulted when a sales order is created.
    There are many ways to restrict sales responsible for sales units(based on the business need).
    One example could be a scenario to default/validate/lookup of the sales responsible workers that are associated Responsibility assignment workers to the salesUnit. 

    SMM.jpg

    1. In the initValue_Server method of table SalesTable:
       this.SalesUnitId = smmUtility::getCurrentSalesUnit();
       if (smmUtility::isValidWorkerInCurrentCompany(currentWorker()))
       {
       this.WorkerSalesResponsible = smmSalesUnitMembers::findUnitAndMember(this.SalesUnitId, currentWorker()).SalesPersonWorker;
        }

    2.  On the lookup of workersalesresponsible, shows only associated Responsibility assignment workers through the following relations:
         LookupField: (smmResponsibilitiesEmplTable).WorkerPerson     

         HcmWorker.RecId == smmResponsibilitiesEmplTable.Worker // Worker

         smmResponsibilitiesTable.SalesUnitId == smmSalesUnit.SalesUnitId // Responsibility tied to SalesUnit

         smmSalesUnit.tableId == smmResponsibilitiesEmplTable.RefTableId // Worker to salesunit and Responsibility
         smmSalesUnit.RecId == smmResponsibilitiesEmplTable.RefRecId //
         smmResponsibilitiesTable.ResponsibilityId == smmResponsibilitiesEmplTable.ResponsibilityId

    Please note its a assumed example scenario.  

    Thanks,

    Chaitanya Golla

  • Rana Anees Profile Picture
    1,813 on at

    Thanks Chaitanya Golla,

    It is giving following info log when trying to 'Responsibility assignment'

    "Employee - 'ABC' is not allowed here."

    I tried will all the employees but same message is coming. any idea what is not correct.

    sales-unit.jpg

    Thanks,

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi Rana,

    You should have the proper setup in Sales & Marketing module to assign worker.

    Refer links: 

    (Sales and Marketing [AX2012]) business process(es))

    https://technet.microsoft.com/en-us/library/hh227532.aspx

    (Setting up and maintaining Sales and Marketing[AX2012])

    https://technet.microsoft.com/en-us/library/gg243297.aspx

    (Sales Team Setup in Dynamics AX 2012 Sales and Marketing Module)

    http://dynamics.folio3.com/2015/02/09/setting-sales-teams-dynamics-ax-2012-sales-marketing-module/

    (Create Sales targets [AX2012])

    https://technet.microsoft.com/en-us/library/aa569698.aspx
    (Sales unit responsibility [AX 2012])

    https://technet.microsoft.com/en-us/library/hh227388.aspx

    (Sales unit/team (form) [AX 2012])

    https://technet.microsoft.com/en-us/library/aa500594.aspx

    Hope this helps.

    Thanks,

    Chaitanya Golla

  • George Huang Profile Picture
    20 on at

    I know this thread is old...but I just hit the same error. Employee ABC is not allowed here

    Any fix on this? Thanks

    pastedimage1643407787162v1.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
Basit Profile Picture

Basit 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans