web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

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

(0) ShareShare
ReportReport
Posted on by 70
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
I have the same question (0)
  • Martin Dráb Profile Picture
    237,793 Most Valuable Professional on at
    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?

     
     
  • Rahul Dahiya Profile Picture
    70 on at
    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
  • Rahul Dahiya Profile Picture
    70 on at
    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 663 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 540 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 348 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans