Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

How un editable "Add lines" button in SalesLine

(0) ShareShare
ReportReport
Posted on by 100

Hello Experts,

For un editable "Add line" button in SalesLine we use  --> SalesLine.allowCreate(false) .
What we use for making un editable "Add lines" button .

  • HARISH MEHRA Profile Picture
    HARISH MEHRA 100 on at
    RE: How un editable "Add lines" button in SalesLine

    Hi Mohit,

    Yes this worked for me.

    Thanks Mohit & Girish

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How un editable "Add lines" button in SalesLine

    Try creating extension class for SalesTableInteraction class, create CoC on enableLineRetailActions method and write below code.  

    protected void enableLineRetailActions()
    {
        next enableLineRetailActions();
    
        if (salesLine.PickingInProgress_CAP == NoYes::Yes)
        {
            #SetEnabled(formcontrolstr(SalesTable, retailAddItemMenuItem), False)
        }
    }

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How un editable "Add lines" button in SalesLine

    Right click that method and do find reference and see where it is used, especially in SalesTable form.

    Also try adding the logic on onActivated event handler and check.

    Thanks,

    Girish S.

  • HARISH MEHRA Profile Picture
    HARISH MEHRA 100 on at
    RE: How un editable "Add lines" button in SalesLine

    Hi ,

    I think here it is enabling.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How un editable "Add lines" button in SalesLine

    Add breakpoint on editSales method in SalesTable form and check if its called after active method. Also, find 'RetailAddItemMenuItem' in SalesTable form and add breakpoints to debug. Standard code will definitely be setting value to True after activated method sets it to False.

    Also add breakpoint on enableLineRetailActions method in SalesTableInteraction class.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How un editable "Add lines" button in SalesLine

    It seems that somewhere the button is enabled again in the standard code.

    See whether there is any standard code available for enabling disabling of the button.

    Thanks,

    Girish S.

  • HARISH MEHRA Profile Picture
    HARISH MEHRA 100 on at
    RE: How un editable "Add lines" button in SalesLine

    Yes,

    I debugged the code it is showing enable false for both buttons.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How un editable "Add lines" button in SalesLine

    Have you debugged the code.?

    See what is the value of salesLine buffer/

    Thanks,

    Girish S.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How un editable "Add lines" button in SalesLine

    Have you debugged the code? Check if RetailAddItemMenuItem is initialized correctly.

    Also If you want to enable/disable buttons based on data in SalesLine then Active method is correct.

  • HARISH MEHRA Profile Picture
    HARISH MEHRA 100 on at
    RE: How un editable "Add lines" button in SalesLine

    Hi ,

    Written the code provided but same result.

    Add product is editable.

    NOTE- Also written the code  on SalesLine form Datasource OnInitialized

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans