Security Question: Sales Orders

headley27headley27 Member Posts: 188
How do I give a user the rights to turn a Sales Quote into a Sales Order by clicking the 'Make Order' button on the Sales Quote Form, but not allow that same user to insert a new Sales Order using the Sales Order Form? The user will still require modify and delete rights to a Sales Order.

Do I take away insert rights on the Sales Order Form and give a specific set of rights to a codeunit (or codeunits)?

Please advise.

Thank you.

Answers

  • headley27headley27 Member Posts: 188
    Perhaps I am confused.

    The user has these rights:

    Object Type: Codeunit
    Object ID: 86
    Object Name: Sales-Quote to Order
    Read Permission: Yes
    Insert Permission: Yes
    Modify Permission: Yes
    Delete Permission: Yes
    Execute Permission: Yes
    Security Filter: None

    ObjectType: Table Data
    Object ID: 36
    Object Name: Sales Header
    Read Permission: Yes
    Insert Permission: Indirect
    Modify Permission: Yes
    Delete Permission: Yes
    Execute Permission: Yes
    Security Filter: None

    ObjectType: Table Data
    Object ID: 37
    Object Name: Sales Line
    Read Permission: Yes
    Insert Permission: Yes
    Modify Permission: Yes
    Delete Permission: Yes
    Execute Permission: Yes
    Security Filter: None

    This message is displayed when I try to manually create a Sales Order which is correct: You do not have permission to write in the Sales Header table.

    I get the same error when clicking the 'Make Order' button on the Sales Quote Form. This is causing the issue for me.

    What am I doing wrong?

    Thanks again.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    BlackTiger wrote:
    1. Assign special permissions to codeunit 86 ("Sales-Quote to Order") to allow full access to Sales Header/Lines tables
    2. Set to "Indirect" right to insert lines into "Sales Line" tables from user permissions.

    You won't be able to apply #2 since the Sales Quote uses the Sales Header and Sales Line table.

    The other way is to modify the OnInsert trigger, but you will need a developer license to do this.
  • headley27headley27 Member Posts: 188
    The other way is to modify the OnInsert trigger, but you will need a developer license to do this.

    Thank you deadlizard, I was losing my mind on this one.

    I have a developer license. How would I achieve this?
  • ara3nara3n Member Posts: 9,257
    To Achieve this. You need to add a new field to user Setup called "Block sales order insert";


    on sales line table on insert trigger add the following code.


    if "Document type" = "Document type"::Order then
    if Usersetup.get(USERID) and Usersetup."Block Sales order Insert" then
    error('You are not allowed to insert sales order lines');[/code]
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • headley27headley27 Member Posts: 188
    Riiiiiiiiiiight.

    That makes sense.

    I'll create a role with no permissions called "Block sales order insert" and if the user has that role I'll run the code.

    Excellent and Thank You All !!
Sign In or Register to comment.