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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

(0) ShareShare
ReportReport
Posted on by 122

Hi. I've been working on an XDS policy for displaying sales orders by specific sales taker. Initially I used the (HcmWorkerLookup::currentWorker()) as query range value. This displayed only the sales orders where the SalesTaker was the current user.

Later, based on feedback from the team, we needed to modify the access where one user would manage another's sales orders, which lead me to build separate XDS queries and policies for each salesman (our team is small) with the query on HcmWorker using personnel number and constraining the SalesTable. I assigned this to separate roles for each salesman. It worked fine. 

Now we have another scenario where a salesman goes on vacation and he needs to assign all his sales orders to another salesman. So the replacement salesman has to see his own Sales Orders and also that of the guy he's replacing. In this case, if I assign the going salesman's role with the XDS policy to the other salesman (who has an xds policy on his own role), the Sales Orders won't show anything because it will filter the same list twice.

I could of course fix it by adding both salesmen with both personal numbers as range values in a single query assigned to a single role. This shows both of them at the same time to whoever is assigned that role. But this needs to be more dynamic and I need to be able to change it often from the functional side without having to go back to development, which is why I assigned it to separate individual roles in the first place. 

So I have two questions. 

1) Is there a way to apply two individual salesman's xds roles (which I have already created) to one person and have both users' sales orders display for him? It's not currently doing this as I mentioned earlier. 

2) Or is there a better way to develop this so that I can switch/add/remove access for people whenever I need it from the functional end?

Thanks in advance and sorry about the long post!

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,843 Moderator on at

    Hi Vijay,

    My suggestion will be creating one form with table which has worker field with New and delete button. User can add 'n' number of workers as they want, without any duplicates.

    Add that table to XDS security query along with HcmWorker table with the relation.

    Now the query will filter the worker from parameter table, and it will constrain the sales table in the security policy without hard coding the worker personnel number in query range.

    Functional can add any workers as the replacement for a particular role and it will filter against the list of workers in the form.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at

    Hi Girish. Thanks for your reply. How will we add the workers and where will this form with the table be accessed from?

    Can you elaborate a bit on this or give me any references? I'm not sure what to look for.  

    Thanks!

    Vijay

  • GirishS Profile Picture
    27,843 Moderator on at

    You need to add that custom form menu item to the front end. So the users can add the workers from the front end without the need of backend developers.

    You need to decide in which menu you are going to add the custom form and tell the user about the navigation path.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at

    Ok, so let's say I am adding 3 users to the table. The rest of the query stays the same except that I am using the custom form to specify the workers, right? The query applies to a role, so the user I assign the role will be able to see all 3 users that are on the form. So in this case, I'd have to create a new form for each role. Am I getting this right?

  • GirishS Profile Picture
    27,843 Moderator on at

    Yes, it's right.

    1. Create Table with field HcmWorkerRecId - Relation with HcmWorker table.
    2. Create a form by adding the table created above as DataSource and create simple design.
    3. Add the custom table created on step 1 to the XDS query DataSource along with HcmWorker.

    So, it will filter the query with worker on the custom table and it will constraint the SalesTable with security policy.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at

    Ok I will try it. But is there any way to minimize the number of forms? Since we have around 10 roles, I have to create 10 forms.

  • GirishS Profile Picture
    27,843 Moderator on at

    In that case add Security role field to custom table also. So the user will select worker along with the roles. In that case only one form is needed.

    In the XDS query you will be adding role as a range to each query related to role.

    Thanks,

    Girish S.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    305,455 Super User 2026 Season 1 on at

    HI Vijay,

    I would suggest creating a MyConstruct table. This is a temporary table with setting TempDB and will be filled with values with an XDS() method on this table. There are other similar tables in the standard application, all starting with "My", e.g. "MyLegalEntities" and "MyDepartments".

    Create a new table and form where you can setup delegates for workers for sales orders. In the XDS() method, you can add the current user, but also loop the new table and add the workers for which the user is a delegate. You can then use this table and link it to the SalesTable in the query for the security policy.

    If you would be setup as a delegate for my vacation period, the MyConstruct table will get the next records:

    - Vijay (your own worker record)

    - André (you are setup as a delegate for me)

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 671

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 621 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 589 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans