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, ...
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
    239,165 Most Valuable Professional on at

    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

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 March 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 681

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 202 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans