Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Displaying multiple Sa...
Finance forum
Suggested answer

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

Posted on by 74

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!

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,532 Super User 2024 Season 2 on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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)

  • GirishS Profile Picture
    GirishS 27,828 Moderator on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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.

  • VJ VM Profile Picture
    VJ VM 74 on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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
    GirishS 27,828 Moderator on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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
    VJ VM 74 on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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
    GirishS 27,828 Moderator on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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
    VJ VM 74 on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,828 Moderator on at
    RE: Displaying multiple SalesTaker's Sales orders for one Salesman - XDS Policy

    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.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans