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

Open LedgerJournalTransDaily form from a Custom form on Button Click

(2) ShareShare
ReportReport
Posted on by 34
Hi, I have below code written to open LedgerJournalTransDaily form from a Custom form on Button Click.

Custom table is ImpInboundData and it has a field JournalNum. On click of button "Open General Journal Lines", I want to open LedgerJournalTransDaily form based on JournalNum available in Custom table.
 
Intention is to Open the LedgerJournalTransDaily form directly from Custom Form to Validate journal lines and to proceed with Posting.
 
Below is the code on click of Button
public void clicked()
{
   Args args;
   LedgerJournalTable ledgerJournalTable;
   ImpInboundData impInboundData;
   LedgerJounralId ledgerJournalId;
	
   impInboundData = impInboundData_ds.cursor();
   ledgerJournalTable = LedgerJournalTable::find(impInboundData.JournalNum);
	
   if(ledgerJournalTable.RecId)
    {
	   args = new Args();
	   args.name(formStr(LedgerJournalTransDaily));
	   args.record(ledgerJournalTable);
	   new MenuFunction(menuItemDisplayStr(LedgerJournalTransDaily),MenuItemType::Display).run(args);
	}
	else
	{
	   warning("Journal Not Found");
	}
}
I am getting "Object Reference not set to an instance of an object. JournalFormTable was null" error in formInitPost method of LedgerJournalTransDaily form. This is when .run(args) is triggered. How can this be resolved.

Attached error screenshot.
 
Error.png
Categories:
I have the same question (0)
  • Subra Profile Picture
    582 on at
    I hope ledgerformtable buffer has been no filled, could you please get the value from the calling form (Args).
  • Suggested answer
    Deepak Agarwal Profile Picture
    8,912 on at
    This is not how it works. 
     
    Try this,
    1. Firstly I beleive if you set proper EDTs realtion on your custom table, you new form will filter automatically
    2. If first option doesnt work, try to use Args to fetch values from caller form/record. 
  • David Samuel Profile Picture
    34 on at
    @Deepak Agarwal First Option works.
    It redirects me to LedgerJournalTable form with filtered record based on JournalNum. User will have to click on lines to check and post.
    Thanks a lot.
     
  • Suggested answer
    Martin Dráb Profile Picture
    239,519 Most Valuable Professional on at
    I think you need to add journalForm() method to your form and return JournalFormTable object from there. JournalFormTrans.initJournalFormTable() will use it to populate journalFormTable variable.
     
    Look into LedgerJournalTable form to see how it's done there.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 660

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 655 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 557

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans