Skip to main content

Notifications

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 ? 

  • Martin Dráb Profile Picture
    234,023 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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Product updates

Dynamics 365 release plans