Skip to main content

Notifications

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

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

(0) ShareShare
ReportReport
Posted on by 54
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
    Rahul Dahiya 54 on at
    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
    Rahul Dahiya 54 on at
    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
    Martin Dráb 230,868 Most Valuable Professional on at
    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

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,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans