If the form opens from other form menuitem not directly from form then we have to write this code in form init method after super()
if (!element.args().caller())
{
throw error("@SYS22539");
}
Un Select all coding: In click method of button:
void clicked()
{
DNGRSSalesPaymentSettelmentLines _DNGRSSalesPaymentSettelmentLines;
super();
_DNGRSSalesPaymentSettelmentLines =DNGRSSalesPaymentSettelmentLines_ds.getFirst();
while (_DNGRSSalesPaymentSettelmentLines)
{
if(_DNGRSSalesPaymentSettelmentLines.SelectPayment == NoYes::Yes)
{
_DNGRSSalesPaymentSettelmentLines.SelectPayment = NoYes::no;
}
_DNGRSSalesPaymentSettelmentLines.update();
_DNGRSSalesPaymentSettelmentLines = DNGRSSalesPaymentSettelmentLines_ds.getNext();
}
}
Select all coding: In click method of button:
void clicked()
{
DNGRSSalesPaymentSettelmentLines _DNGRSSalesPaymentSettelmentLines;
super();
_DNGRSSalesPaymentSettelmentLines =DNGRSSalesPaymentSettelmentLines_ds.getFirst();
while (_DNGRSSalesPaymentSettelmentLines)
{
if(_DNGRSSalesPaymentSettelmentLines.SelectPayment == NoYes::no)
{
_DNGRSSalesPaymentSettelmentLines.SelectPayment = NoYes::yes;
}
_DNGRSSalesPaymentSettelmentLines.update();
_DNGRSSalesPaymentSettelmentLines = DNGRSSalesPaymentSettelmentLines_ds.getNext();
}
}
Note : For invoice settlements we can use the CustVendSettle class:
CustVendSettle - updateOtherSettlementFieldsOnTrans
Existing and new customer creation:
class DNGRSCustomertEntitiesFromReservatio
{
}
static public void main(Args args, boolean _showForm = true)
{
smmEntityToCreate entityCreate;
NoYes conversionSuccessful;
MenuFunction menuFunction;
Args argsToPass = new Args();
smmBusRelTable smmBusRelTable;
DNGRSReservationTable dngRSReservationTable;
smmOpportunityTable smmOpportunityTableLoc;
CustTable Custtable;
;
if (!args || !args.dataset())
{
throw error("@SYS22996");
}
dngRSReservationTable = args.record();
smmOpportunityTableLoc = smmOpportunityTable::findbyReservationId(dngRSReservationTable.ReservationId);
if(!smmOpportunityTableLoc.RecId)
{
throw error("@DNG21273");
}
if (smmOpportunityTableLoc.RecId)
{
entityCreate = args.parmEnum();
// from Create Customer function button
if (entityCreate == smmEntityToCreate::Customer)
{
// Convert to customer
smmBusRelTable = smmBusRelTable::findByParty(smmOpportunityTableLoc.Party);
if (smmBusRelTable.canConvertToCustomer())
{
conversionSuccessful = smmBusRelTable::convert2Customer(smmBusRelTable, '', false);
}
if (conversionSuccessful)
{
Custtable = CustTable::findByPartyRecId(smmBusRelTable.Party);
info(strfmt("New Customer %1 is created",CustTable::findByPartyRecId(smmBusRelTable.Party).AccountNum),'',SysInfoAction_TableField::newBuffer(CustTable));
info(strfmt("%1 %2 ",dngRSReservationTable.ReservationId,dngRSReservationTable.ExistingCustomer));
dngRSReservationTable.ExistingCustomer = CustTable::findByPartyRecId(smmBusRelTable.Party).AccountNum;
// Open the Customer table form if configured to do so
//if (smmParameters::getBusRelOpenCustForm())
//{
//menuFunction = new MenuFunction(menuitemDisplayStr(CustTable), MenuItemType::Display);
//
//// Check access rights
//if (!menuFunction || !menuFunction.checkAccessRights())
//{
//// Access rights are not sufficient to use this function.
//throw error("@SYS81158");
//}
//
//argsToPass.record(smmBusRelTable);
//if(_showForm)
//{
//menuFunction.run(args);
//}
//}
}
}
}
}
Manually creation of numbersequence:
num = NumberSeq::newGetNum(DNGRSSalesParameter::numRefRESUnitPaymentSchedule());
Adding range in execute query:
()
public void executeQuery()
{
if(DNGRSUnitPaymentschedule.DNGRSChangeorderid == "")
this.query().dataSourceTable(tableNum(DNGRSUnitPaymentschedule)).addRange(fieldNum(DNGRSUnitPaymentschedule,DNGRSChangeorderid)).value(queryValue(DNGRSUnitPaymentschedule.DNGRSChangeorderid));
else
this.query().dataSourceTable(tableNum(DNGRSUnitPaymentschedule)).addRange(fieldNum(DNGRSUnitPaymentschedule,DNGRSChangeorderid)).value(SysQuery::valueEmptyString());
super();
}