Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Disable header/lines from

(1) ShareShare
ReportReport
Posted on by 739
Hi All,
 
I need to add a checkbox to the counting journal. When this checkbox is selected, both the headers and lines of the form records should become uneditable. I'm open to suggestions for implementing this feature, whether through the Chain of Command (COC) or any other solution.
 
Thanks
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,613 Super User 2024 Season 1 on at
    Disable header/lines from
    However, the current approach faces challenges due to specific methods in the Counting Journal form, such as "InitBlock," which maintain the form's enablement unless specific restrictions like "block by user" or "block by system" are applied.
     
    When you say the above, then you can use the same method and write a coc post next. Let's say if in this init block total disablement is maintained from standard, then post next you can use custom code for modifying it again.
  • Hisham Alsayed Profile Picture
    Hisham Alsayed 739 on at
    Disable header/lines from
    Hi Bharani,
     
       Thanks for your reply, could you please provide more insights or detailed suggestions.
     
    Kind Regards,
    H
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,613 Super User 2024 Season 1 on at
    Disable header/lines from
    In that case, is it not possible to write coc post next of this init block and use your custom fields only?
  • Suggested answer
    Hisham Alsayed Profile Picture
    Hisham Alsayed 739 on at
    Disable header/lines from

    Hi everyone,

    Thank you for your responses. I'd like to provide further clarification on the requirement, as the suggested solutions may not be applicable in the current scenario.

    The requirement entails adding a checkbox in the header form of the Counting journal to disable both the header and details sections. This disabling should occur when updates are made from an external system through integration, rather than by end users.

    I have implemented my current code in the Active DataSource method using the Chain of Command (COC) approach.

     
    [ExtensionOf(formDatasourceStr(InventJournalCount, InventJournalTable))]
    final class VEL_InventJournalCount_DS_Active_Extension
    {
    if(inventJournalTable.VEL_WriteInProgress == NoYes::Yes)
            {   this.allowEdit(false);
                InventJournalTrans_ds.allowEdit(false);
                InventDim_ds.allowEdit(false); 
    }
    else
    {
                this.allowEdit(true); 
                InventJournalTrans_ds.allowEdit(true);
                InventDim_ds.allowEdit(true); 
    }
     
    }
     
     

    However, the current approach faces challenges due to specific methods in the Counting Journal form, such as "InitBlock," which maintain the form's enablement unless specific restrictions like "block by user" or "block by system" are applied.

    Considering this, I am contemplating updating the "block by system" field in the database to restrict the DataSources for this form. However, this approach deviates from system standardization, especially if the form remains enabled when the customized checkbox is checked.

    Therefore, I am considering an alternative solution: preserving the value of "block by system" in another field until the process is completed. Subsequently, I will uncheck the customized checkbox to restore the "block by system" to its original value before the update.

    This approach aims to ensure adherence to system standards while effectively managing the form's enablement based on the requirements.

    Please let me know if you have any other suggestions.

     
    Kind Regards,
    H
  • Suggested answer
    Deepak Agarwal Profile Picture
    Deepak Agarwal 148 on at
    Disable header/lines from
    You need to share more details on business requirements, adding a check box won't solve this as that checkbox will also be controlled by this customization. I wouls rather suggest to explore user roles to achieve this. 
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,408 Super User 2024 Season 2 on at
    Disable header/lines from
    Hi Hisham,
     
    You can add the checkbox to form using Extension but does this checkbox will be bound to data source? 
    You can add your code on the modified method of the check box and if you want to check the checkbox value when you open the form you should put your code on the init method of the form also.
     
     
    Thanks,
    Waed Ayyad
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    Disable header/lines from
    Hi,
    Can you explain your specific use case, or what purpose do you need to use the checkbox? If all users can click the checkbox, it is not reasonable to click the checkbox to disable the record, because the checkbox does not have the ability to restrict behavior for each user. Or is it only the administrator who has permission to click on this checkbox to restrict the behavior of some/all users?
    Best regards,
    Kevin
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,391 Super User 2024 Season 2 on at
    Disable header/lines from
    Hi Hisham,
     
    Can you explain more about the business requirements? Why do you need a checkbox and what do you need to achieve? What is the exact purpose? Will this checkbox be a field part of a table? Is the checkbox editable by all users?
    It is quite easy to just add a checkbox and influence the properties of the data sources. In case one person should be set e.g. a flag per journal to report it as ready where other users shouldn't be able to undo this flag, then you would need to implement it in a different way.
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,349 Super User 2024 Season 2 on at
    Disable header/lines from
    Hi Hisham,

    On the modified method of the this tickBox, if this box is true, then disable everything.
    Also on the init method of the form, you should add the same logic, so that it works when you first open the form if the flag is already true.

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,818 Super User 2024 Season 2 on at
    Disable header/lines from
    Hi @Hisham
     
    you can add a COC method to the form so that you can apply the business logic :
     
    e.g
     
    public void init()
    {
        Param  param = Param::find();
        next init();
    
        yourdatasource_ds.AllowEdit(param.CheckBox);
    }
     Best regards,
    Mohamed Amine Mahmoudi

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans