Skip to main content
Post a question

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id : KRm1CjQjSJCA2xepz17Z2E
Finance | Project Operations, Human Resources, ...
Unanswered

How to make an itemization date filter control non-editable in TrvExpensesForm

Like (0) ShareShare
ReportReport
Posted on 5 Sep 2023 06:15:07 by 64
Hi,
I have a requirement to make itemization date filter control non-editable (control name - TrvItemizationCalendarControl) on TrvExpenses form. 
I wrote code on form & datasources (TrvExpTrans_ItemizedLines & trvExptrans) as well in init method but still field is editable.
Also, currently when we click on a particular date on calender , based on transaction date records gets filtered in itemization tab but after making this calender non-editable, I want to take the transaction date directly from header & show the transactions directly there based on selected date.
Anyone have idea where to write code to achieve this.
 
 
[ExtensionOf(formDataSourceStr(TrvExpenses,TrvExpTrans))]final class SAPTrvExpenses_Extension{public void init()    {        FormControl trvExpCalender = this.formRun().design().controlName(formControlStr(TrvExpenses,TrvItemizationCalendarControl));        next init();        trvExpCalender.allowEdit(false);        }}
 
Thanks,
Rahul
  • Rahul Dahiya Profile Picture
    64 on 05 Sep 2023 at 11:33:03
    How to make an itemization date filter control non-editable in TrvExpensesForm
    Hi Martin,
    I just checked again, by setting enabled property to false. after this, if we are clicking on calender date then nothing is happening before that transaction for a particular date was filtered. But still that control is not greyed out, we are able to click on the dates but only day & date is changing where marked in below image. but I need this control to be greyed out.
     
     
    Thanks,
    Rahul
  • Rahul Dahiya Profile Picture
    64 on 05 Sep 2023 at 11:07:43
    How to make an itemization date filter control non-editable in TrvExpensesForm
    Hi Martin,
    I tried the way you suggested but still field is editable. Visible property is working but allowEdit or enabled is not working on this control.
    Also I tried taking extension of the form TrvExpenses & changed that control allowEdit property to no but still calender is editable.
     
    Thanks,
    Rahul
  • Martin Dráb Profile Picture
    231,760 Most Valuable Professional on 05 Sep 2023 at 06:31:27
    How to make an itemization date filter control non-editable in TrvExpensesForm
    First of all, let me re-post your code to make it easier to read:
    [ExtensionOf(formDataSourceStr(TrvExpenses, TrvExpTrans))]
    final class SAPTrvExpenses_Extension
    {
        public void init()
        {
            FormControl trvExpCalender = this.formRun().design().controlName(formControlStr(TrvExpenses, TrvItemizationCalendarControl));
            next init();
            trvExpCalender.allowEdit(false);
        }
    }
    Note that you can do it in a much easier way:
    [ExtensionOf(formStr(TrvExpenses))]
    final class SAPTrvExpenses_Extension
    {
        public void init()
        {
            next init();
            
            TrvItemizationCalendarControl.allowEdit(false);
        }
    }
    Check out if moving your code at the end of form initialization doesn't make a difference. If not, I don't know what's going on. An explanation would be a piece code setting AllowEdit back to true, but I didn't find any. Check out if you don't have such a customization.
     
    Note I didn't test the behaviour, therefore I don't know whether it works the same in my environment.

    Can you please test whether Itemization date filter controls respect AllowEdit property at all?

     
     

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,760 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans