0

I am trying to get the journal number (Red box) from the invoice journal. I have a button inside the Lines (blue box), however in order for it to work I need the Journal Number (red box) when I clicked the Lines (blue box).

enter image description here

m1gs
  • 197
  • 2
  • 17

1 Answers1

1

Your Line form already have variable journalNum

enter image description here

So on your Lines form create parm method like this

public LedgerJournalId parmJournalNum(LedgerJournalId _journalNum = journalNum) 
{ 
    journalNum = _journalNum; 

    return journalNum; 
}

And then in main method of your batch class you can get journal number using the following code

if (classIdGet(args.caller()) == classNum(SysSetupFormRun)) 
{ 
    if (formHasMethod(args.caller(), identifierStr(parmJournalNum))) 
    { 
        journalNum = args.caller().parmJournalNum(); 
    } 
}
Aliaksandr Maksimau
  • 2,251
  • 12
  • 21
  • Hi sir what is that "element"? – m1gs Apr 10 '17 at 09:00
  • In forms `element` refers to the current FormRun object. Please check the link https://community.dynamics.com/ax/b/dynamicsaxinsightbyanas/archive/2014/05/08/ax-2012-this-vs-element-when-to-use-what – Aliaksandr Maksimau Apr 10 '17 at 09:05
  • where should I place this code sir? my code is a batch job. Should I place this is the "run" method? – m1gs Apr 10 '17 at 09:06
  • Please explain what are you trying to do. It is not clear how *Lines* button related to batch job. – Aliaksandr Maksimau Apr 10 '17 at 09:12
  • In my batch job, I need to obtain the Journal Number (from the journal form) because I have created a button inside the lines form. What I want to happen is when I click Lines I would be able to pass the journal number value to the button i created inside the lines form. – m1gs Apr 10 '17 at 09:14
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/141340/discussion-between-aliaksandr-maksimau-and-michael-z). – Aliaksandr Maksimau Apr 10 '17 at 09:28