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

Passing JournalNum automatically to custom form in Trade Agreement Journal Lines

(4) ShareShare
ReportReport
Posted on by 13

Hello Community,

I have a requirement where the user enters data in a custom form and selects one of two actions — Insert or Update. Based on this action, the items related to a particular price group must be grouped and filled into the Trade Agreement Journal lines.

Here is what I have implemented so far:

  • Created a custom form and a temporary table to collect details from the user.
  • Added a menu item button in the standard PriceDiscAdm form to open my custom form.
  • Created a relation between the standard table (PriceDiscAdmTrans) and my custom table.
Currently, I am able to pass the JournalNum by asking the user to input it manually in the custom form. However, this is not the correct approach. What I need is:
  • When a sales price journal is selected in PriceDiscAdmTable and the Lines button is clicked (which opens PriceDiscAdm),
  • Then, from PriceDiscAdm, when the user clicks my custom button, the selected JournalNum should be passed automatically to my custom form.
  • Using this JournalNum, the lines should be inserted/updated in the PriceDiscAdmTrans table and displayed on the form.
I tried using init() and Args.parm() on the custom form, but couldn’t get the JournalNum passed correctly.
 
Can you please guide me with the correct way to pass the JournalNum from PriceDiscAdmTable → PriceDiscAdmTrans → custom form, so that the user doesn’t have to enter it manually?
 
Thanks in advance!

 
Categories:
I have the same question (2)
  • PG-18081310-0 Profile Picture
    13 on at
    Passing JournalNum automatically to custom form in Trade Agreement Journal Lines

    Hello Community,

    Thank you for your valuable responses.

    I was able to resolve the issue by retrieving the JournalNum from PriceDiscAdmTable with the following query:

    select firstOnly priceDiscAdmTable
    where priceDiscAdmTable.JournalNum == line.JournalNum;

    This worked as expected. Since PriceDiscAdmTrans (line) records are always linked to a PriceDiscAdmTable (header) through the JournalNum field, querying the header with the same JournalNum allowed me to get the required data.

    Hopefully, this helps anyone else who runs into a similar situation.


     
  • R Shetty Profile Picture
    66 on at
    Passing JournalNum automatically to custom form in Trade Agreement Journal Lines
    Hi,

    Did you try initvalue() method in DS?
    SourceTable ltable; 
    
    public void initvalue()
    {
       super();
       
       if (element.args().record().tableId == tableNum(customTable))
       {
    	   ltable = element.args().record();
    	   customTable.field1 = ltable.field1;
       }
    }
     
  • Sohaib Cheema Profile Picture
    47,610 User Group Leader on at
    Passing JournalNum automatically to custom form in Trade Agreement Journal Lines
    Your custom table has relationship with the PriceDiscAdmTrans. 
    You can pass the reference/buffer/record of PriceDiscAdmTrans while you open your custom form. It already knows it if caller menu item has Data Source property mentioned on. You do not need to code then.
    However if you are calling the second form by code(avoiding the menu item), you can pass the record using args.
     
     
     
  • Martin Dráb Profile Picture
    235,804 Most Valuable Professional on at
    Passing JournalNum automatically to custom form in Trade Agreement Journal Lines
    Please give us a better description of your problem then mere "couldn’t get the JournalNum passed correctly". First of all, are you getting the expected record in this.args().record()? If not, you have a problem in how you pass the record, e.g. you have a wrong value in Data Source property or you're trying to call the form by code and you did it wrong. If you have the record, what is the problem with JournalNum?
     
    Moved from Integration, Dataverse, and general topics forum to Finance | Project Operations, Human Resources, AX, GP, SL forum.
     
     

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans