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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to Extend InventJournalCheckPost class

(1) ShareShare
ReportReport
Posted on by 1,883
Dear All,
 
I'm trying to put some logic before transfer journal posting. I'm unable find proper way to use newPostJournal(). Could you please check below and advice right way to from below code.
 
[ExtensionOf(classStr(InventJournalCheckPost))]
final class InventJournalCheckPost_EAway_Extension
{
    public static JournalCheckPost newPostJournal(InventJournalTable _inventJournalTable)
    {
         next newPostJournal(_inventJournalTable) ;
   }
}
I have the same question (0)
  • Martin Dráb Profile Picture
    237,679 Most Valuable Professional on at
    How to Extend InventJournalCheckPost class
    You already know how to create an extension of newPostJournal(), but it seems that you have some problem with it that you forgot to mention.
     
    I also doubt it's the right place for you logic, but I can't really comment on it unless you describe your business requirements.
  • André Arnaud de Calavon Profile Picture
    300,721 Super User 2025 Season 2 on at
    How to Extend InventJournalCheckPost class
    Hi Faqruddin,
     
    Please tell us from a functional point of view what you want to achieve.
  • Faqruddin Profile Picture
    1,883 on at
    How to Extend InventJournalCheckPost class
    Hi,
     
    I have Custom field RequstID in InventJournalTable. If this field exists with the value than I need to allow user to post Transfer Journal else I need to stop it. But I'm not sure how can I wrap it with newPostJournal().
     
    Thanks
     
     
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    How to Extend InventJournalCheckPost class
    Then in that case you can check the method where some validation code is present in the same.class. Like let's say some standard validation like validate(), checkjournal() method. These may or may be available in that class but similar code can be present. If you were not able to see any validation related then simply write the custom validation in run method.
  • Faqruddin Profile Picture
    1,883 on at
    How to Extend InventJournalCheckPost class
    Hello Bharani,
     
    There is no run() exists in the InventJournalCheckPost class. Please you can simulate any scenario and let us know how can we achieve this.
     
    Thanks.
  • Suggested answer
    Martin Dráb Profile Picture
    237,679 Most Valuable Professional on at
    How to Extend InventJournalCheckPost class
    I think you should extend checkJournal() method of the right descendant of JournalCheckPost class.
  • Faqruddin Profile Picture
    1,883 on at
    How to Extend InventJournalCheckPost class
    checkJournal() method  for validating the journal. I don't want to validate instead if user click on post button I need to trigger below logic. I move my code to postJournal() method of JournalCheckPost class and below custom logic is not executing. Please advice. Correct me If my execution is wrong.
    [ExtensionOf(classStr(JournalCheckPost))]
    final class JournalCheckPost_VanAway_Extension
    {
        protected void postJournal(JournalTransList _journalTransList)
        {
            int switchValue = 0;
            str 50 journalNum;
            NoYes vanaway;
            Dialog dialog;
            dialogGroup dialogGroup;
            dialogField dialogField;
            DAWLoadRequest _dawLoadRequest;
            InventJournalTable journalTable;
            JournalCheckPost inventJournalCheckPost;
         
            dialog = new Dialog("Load Request OTP");
    
            dialogGroup = dialog.addGroup("Please Enter OTP");
    
            dialogField = dialog.addField(extendedTypeStr(OTP));
    
            
              journalNum  = _journalTransList.journalTableData().journalTable().JournalId;
            vanaway = InventJournalTable::find(journalNum).VanAway;
            select *from _dawLoadRequest   where _dawLoadRequest.JournalNum == journalNum;
    
            info(strFmt("JournNum %1", journalNum));
    
            if(_dawLoadRequest.JournalNum)
            {
    
                if(vanaway == NoYes::Yes )
                {
                    if (dialog.run())
    
                    {
                        if(_dawLoadRequest.ActivationCode == dialogField.value())
                        {
      
                            switchValue = 1;
                            
                        }
                        switch (switchValue)
                        {
                            case 1:
                                journalTable = InventJournalTable::find(journalNum);
                                inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost(JournalCheckpostType::Post,journalTable);
                                inventJournalCheckPost.run();
                                break;
    
                            default:
    
                                break;
                        }                
                                
                    }
    
                  
                }
               
    
            }
            
    
            next postJournal(_journalTransList);
        }
    
     
    }
     
     
     
     
     
     
     
     
     
     
     

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans