Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to set Form Field based on previous field in Form

(0) ShareShare
ReportReport
Posted on by 505

Dear All,

How to get Project Name and Customer Name both coming from ProjTable Datasource I added to ProjOnAccTrans Form. ProjID coming from ProjonAccTrans. There is a outerjoin link between these tables.

Case:

When create new record , while enter projid , project and Customer name should be shown.

IO know I have to write cod ein modified method of ProjonAccTrans DS. But what ?

Please se ebelow pic 

1223456.jpg

*This post is locked for comments

  • Safeer PS Profile Picture
    Safeer PS 505 on at
    RE: How to set Form Field based on previous field in Form

    nope. currently i added display methods in form to show project name .But i need searchable form field.   "project Name " field  was not added to projonAcctrans Table.

    My question is How can write code like:

    1. add a control " proj Name" in form.

    2. in modified method of Proj ID control add code like :

    ProjName form control =   projTable.name (this.projid);

    in form level

  • Rohin Profile Picture
    Rohin 4,624 on at
    RE: How to set Form Field based on previous field in Form

    Can you be more clear ? have you added projectName in ProjAccOnTrans table or its unbound form control on your form? you have to tell us more information i.e. either both form controls are bound or unbound to datasource etc..

  • Safeer PS Profile Picture
    Safeer PS 505 on at
    RE: How to set Form Field based on previous field in Form

    One Proj Name field not there in PrjonAcc Trans Table and other I can easily write display method but I need to show field as searchable and no editable.

  • Suggested answer
    Rohin Profile Picture
    Rohin 4,624 on at
    RE: How to set Form Field based on previous field in Form
    for example like this:
    Public void  getValues()
    {
    ProjTable   projTable;
    ProjOnAccTrans   projOnAccTrans;
    ;
    projTable = projTable::find(projOnAccTarns.ProjId);
     
    projOnAccTrans.ProjectName = projTable.Name;
    }
    
    and call this method in your form Control modified() method after super().
  • Suggested answer
    Rohin Profile Picture
    Rohin 4,624 on at
    RE: How to set Form Field based on previous field in Form

    You can do this by following:

    1. Write a method on form in which you can make relation between your table and projTable and initialize fields from ProjTable.

    2. call this method in you form control Modified() after super().

  • Safeer PS Profile Picture
    Safeer PS 505 on at
    RE: How to set Form Field based on previous field in Form

    any comments..

  • Safeer PS Profile Picture
    Safeer PS 505 on at
    RE: How to set Form Field based on previous field in Form

    I want to write code in modified methof of projid form control where i will fetch value of projid and get name of proj and put it in Proj Name form control . Does ay one know how to code this on form level and not on Data source level or Table level.

  • Suggested answer
    Rohin Profile Picture
    Rohin 4,624 on at
    RE: How to set Form Field based on previous field in Form

    I would say you need to write code in ProjOnAccTrans table method "initFromProjtable()" . It populates the fields on projOnAccTrans table from ProjTable by ProjId automatically.

    for example, like this:

    this.ProjectName == projTable.Name; // for getting project name

    Note: I am assuming you have already added ProjectName field to ProjOnAccTrans table.

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans