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, ...
Answered

Invent journal create form modified method ovveride

(0) ShareShare
ReportReport
Posted on by 2

pastedimage1683283108281v1.png

on Invent journal create form when name of move journal is changed description changes accordingly to name. here 

pastedimage1683283243448v2.png

here i have customized this site fields , now it should also be changed according to movement journal name as description is changing above.

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Sachin mittal,

    On the InventJournalCreate form - On the name field modified method add code to get the site name based on the selection of name and assign it to site field.

    Thanks,

    Girish S.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, As Girish mentioned, you can create CoC of use modified event of 'Name' control and based on the relation with Site field you can populate it. Let us know if you need assistance during implementing it (after you tried writing the code).

  • Sachin Mittal Profile Picture
    2 on at

    this is standard code

    pastedimage1683286953339v1.png

    [ExtensionOf(FormControlStr( InventJournalCreate,InventJournalTable_JournalNameId ))]
    final class InventJournalCreate_Extension
    {
        public boolean modified()
        {
         var res =  next modified();
           
            InventJournalName journalName;
            InventJournalTable inventJournalTable;
            journalName = InventJournalName::find(inventJournalTable.JournalNameId);
    
            inventJournalTable.InventSiteId = journalName.OABSiteId;
            return res;
        }
    
    }

    this code is not working

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, Try replacing Line#10 with below code

    journalName = InventJournalName::find(InventJournalTable_JournalNameId.ValueStr());

    Also inventJournalTable buffer will be empty,  so add below line at line# 9

    inventJournalTable = this.formrun().datasource(IdentifierStr(InventJournalTable)).cursor();

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at

    You have declared the buffer InventJournalTable and you don't have any select statement added.

    [ExtensionOf(FormControlStr( InventJournalCreate,InventJournalTable_JournalNameId ))]
    final class InventJournalCreate_Extension
    {
        public boolean modified()
        {
            var res =  next modified();
            FormRun fRun;
            InventJournalName journalName;
            InventJournalTable inventJournalTable;
            frun = this.FormRun();
            FormDataSource fds = frun.datasource(formDataSourcestr(InvnetJournalCreate, InvnetJOurnalTable));
            inventJournalTable = fds.cursor();
            journalName = InventJournalName::find(inventJournalTable.JournalNameId);
    
            inventJournalTable.InventSiteId = journalName.OABSiteId;
            return res;
        }
    
    }

    Thanks,

    Girish S.

  • Sachin Mittal Profile Picture
    2 on at

    thankyou it worked , i want to know if this same functionality can work on extension of tablestr  InventJournalName ??

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Yes, it will work the same way. In table modifiedField method, you can create case of JournalNameId and get value of form control JournalNameId in this.JournalNameId. Below code will work on CoC for modifiedField table method

    journalName = InventJournalName::find(this.JournalNameId);
    this.InventSiteId = journalName.OABSiteId;

  • GirishS Profile Picture
    27,827 Moderator on at

    On table level you can write coc for the modifiedField method and add the logic there.

    Thanks,

    Girish S.

  • Sachin Mittal Profile Picture
    2 on at

    can you help with specific code ?? it would be very great

  • GirishS Profile Picture
    27,827 Moderator on at

    I don't think getting code here and implement it directly will not let you learn new things.

    Try it yourself as suggestion given by Mohit and me and let us know for any issues.

    We have no problem in giving you the code, but you have to learn writing code yourself.

    There is lots of blog available for your scenario - Based on the blogs try to write code and if you face any issue let us know.

    Thanks,

    Girish S.

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 692 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 364 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans