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

Announcements

No record found.

News and Announcements icon
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,909
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) ;
   }
}
  • Martin Dráb Profile Picture
    240,833 Most Valuable Professional on at
    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
    307,271 Super User 2026 Season 2 on at
    Hi Faqruddin,
     
    Please tell us from a functional point of view what you want to achieve.
  • Faqruddin Profile Picture
    1,909 on at
    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
    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,909 on at
    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
    240,833 Most Valuable Professional on at
    I think you should extend checkJournal() method of the right descendant of JournalCheckPost class.
  • Faqruddin Profile Picture
    1,909 on at
    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 495 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 432 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 366

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans