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

batch class doesn't update data in current list x++

(0) ShareShare
ReportReport
Posted on by 163

class FixedAsset_Allocate extends RunBaseBatch

{
JournalId NewJournalId ;
str JournalDescription ;
DialogField dlgDescription;
DialogField DlgJournal ;
#DEFINE.CurrentVersion(1)
#LOCALMACRO.CurrentList
JournalDescription,
NewJournalId
#ENDMACRO
public container pack()
{

return [#currentVersion,#currentList];
}

public boolean unpack(container packedClass)
{
Version version = RunBase::getVersion(packedClass);

switch (version)
{
case #CurrentVersion:
[version, #CurrentList] = packedClass;
break;

default:
return false;
}

return true;
}

public Object dialog()
{
DialogRunbase dialog;

//Setup the dialog
dialog = super();
dialog.caption(" General Journal Description ");

dlgDescription = dialog.addField(extendedtypestr(LedgerJournalTransTxt), "Description" );

return dialog;
}

public boolean getFromDialog()
{
boolean ret;

JournalDescription = dlgDescription.value();

ret = super();

return ret;
}

public void run()
{

//some logic

}

public boolean validate(Object calledFrom = null)
{
boolean ret;

ret = super(calledFrom);

return ret;
}

public static FixedAsset_Allocate construct()
{
return new FixedAsset_Allocate();
}

public static ClassDescription description()
{
return "Allocate to project ";
}

public static void main(Args args)
{
FixedAsset_Allocate AllocateProject = new FixedAsset_Allocate();
//AllocateProject.parmInBatch(false);

if (! args || ! args.record())
{
throw error(strFmt("@SYS29104", classStr(FixedAsset_Allocate)));
}

FormRun callerForm = args.caller();

if (callerForm)
{
LedgerJournalTrans LedgerJournalTrans = args.record();

JournalId JournalId = LedgerJournalTrans.JournalNum ;

AllocateProject.parmLedgerJournal(JournalId);

if (AllocateProject.prompt())
{
AllocateProject.runOperation();

}

}
}

protected boolean canRunInNewSession()
{
return true;
}

public boolean allowSaveLast()
{
return true;
}

public boolean canGoBatch()
{
return true;
}

public JournalId parmLedgerJournal(JournalId _JournalId = NewJournalId )
{
NewJournalId = _JournalId ;
return NewJournalId;
}

What I want to do is when click on button (allocate) open dialog has description field and create new general journal .

it works well when I try first time . after that args saw the previous values not the new values

when I removed prompt from main method it worked but when I called it and make dialog it didn't update data in args and see previous values 

how can I fix it ? 

I have the same question (0)
  • Martin Dráb Profile Picture
    236,124 Most Valuable Professional on at
    RE: batch class doesn't update data in current list x++

    Can you please add line indentation your code? It's very difficult to read. Don't forget using Insert > Code (in the rich-formatting view).

    I don't understand your description of the problem. The only place where you use main() and you get the value from outside as a method parameter, therefore what you'll get there doesn't depend on this code at all. It depends on code calling main() method of your class.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,140

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 706 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans