How to create dialog box in D365
class Class1 extends RunBase
{
DialogField fieldAccount;
DialogFIeld fieldName;
CustTable custTable;
CustAccount custAccount;
CustName custName;
public container pack()
{
return conNull();
}
public boolean unpack(container _packedClass)
{
return true;
}
Object Dialog()
{
Dialog dialog;
dialog = super();
// Set a title fordialog
dialog.caption( 'Simple Dialog');
// Add a new field to Dialog
fieldAccount =dialog.addField
(extendedTypeStr(CustAccount), 'Customer account' );
return dialog;
}
public boolean getFromDialog()
{
// Retrieve values from Dialog
custAccount =fieldAccount.value();
return super();
}
public void run()
{
//Set Dialog field value to find CustTable
custTable = CustTable::find(custAccount);
if (custTable)
{
// Shows retrieved information
CustCustomerV3Entity cust;
while select * from cust where cust.CustomerAccount== custTable.AccountNum
{
info( strFmt('%1 -- %2' ,cust.PrimaryContactPhone, cust.FullPrimaryAddress));
}
}
else
{
error( 'Customer Account not found!');
}
}
public static void main(Args _args)
{
Class1 custDialog = new Class1();
if(custDialog.prompt())
{
custDialog.run();
}
}
}
Comments
Post a Comment