Good Day Mam/Sir,
I have a button. I need to get the name of my button then pass it to static void main in class.
Please see below my codes:
Thanks in advance :)
---------------------------------------------------------Start code of Button: Clicked-------------------------------------------------------------------------------------------
void clicked()
{
PurchFormLetter purchFormLetter;
purchFormLetter.parmBtnID(this.name());
super();
}
---------------------------------------------------------End code of Button: Clicked-------------------------------------------------------------------------------------------
---------------------------------------------------------Start code of parmBtnID-------------------------------------------------------------------------------------------
String30 parmBtnID(String30 _btnID = btnID)
{
btnID = _btnID;
return btnID;
}
---------------------------------------------------------End code of parmBtnID-------------------------------------------------------------------------------------------
---------------------------------------------------------Start code of static client void main-------------------------------------------------------------------------------------------
static client void main(Args args)
{
Common record;
int parmEnum;
Object callerForm;
IdentifierName callerFormName;
MenuItemNameAction callerMenuItem;
boolean isProforma;
FormDataSource recordDataSource;
container dataSourceRecordsPacked;
container cachedArgs;
PurchTable purchTable;
boolean recordExists;
Counter numberOfRecords;
str className, methodName;
SysOperationExecutionMode mode;
container packedPurchFormletter;
FormletterOutputContract outputContract;
PurchFormLetter purchFormLetter;
VendPurchOrderJour vendPurchOrderJourOld,vendPurchOrderJourNew;
String30 myID;
if (!args)
{
throw error("@SYS25407");
}
[className, methodName, mode] = FormLetterServiceController::parseServiceInfo(args);
record = args.record();
parmEnum = args.parmEnum();
callerForm = args.caller();
callerMenuItem = args.menuItemName();
if (callerForm)
{
callerFormName = args.caller().name();
}
else if(args.menuItemName() == identifierStr(EPVendInvoice) || args.menuItemName() == identifierStr(EPVendInvoiceVendAdvance))
{
callerFormName = args.name();
}
isProforma = FormLetterServiceController::isMenuItemProforma(args.menuItemName());
if (record && record.dataSource())
{
recordDataSource = record.dataSource();
dataSourceRecordsPacked = FormLetter::getFormRecord(recordDataSource);
}
cachedArgs = [#CachedArgsList];
packedPurchFormletter = PurchFormLetter::mainOnServer(cachedArgs, record, callerForm, dataSourceRecordsPacked);
if (packedPurchFormletter != conNull())
{
purchFormLetter = PurchFormLetter::construct(parmEnum, className, methodName, mode, callerMenuItem);
purchFormLetter.unpack(packedPurchFormletter);
purchFormLetter.init();
purchFormLetter.prePromptModifyData();
if (!purchFormLetter.shouldSkipPrompt() && purchFormLetter.prompt())
{
purchFormLetter.run();
outputContract = purchFormLetter.getOutputContract();
numberOfRecords = outputContract.parmNumberOfOrdersPosted();
}
}
if (numberOfRecords
// <GEERU>
|| (purchFormLetter && purchFormLetter.doRefreshCallerDataSource())
// </GEERU>
)
{
if (callerForm && formHasMethod(callerForm,identifierStr(interCompanyRefreshCache)))
{
callerForm.interCompanyRefreshCache();
}
if (recordDataSource)
{
if (record is PurchTable)
{
purchTable = record as PurchTable;
recordExists = PurchTable::exist(purchTable.PurchId);
}
else
if (record is PurchParmTable)
{
recordExists = false;
}
// <GEERU>
else
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoRU]) &&
record is VendPackingSlipJour)
{
recordExists = VendPackingSlipJour::findRecId(record.RecId).RecId;
}
else if (record is EGAISWaybillJour_RU)
{
recordExists = EGAISWaybillJour_RU::findRecId(record.RecId).RecId;
}
// </GEERU>
// <GEEPL>
else if (record is PlSADTable)
{
recordExists = PlSADTable::findRecId(record.RecId).RecId;
}
// </GEEPL>
FormLetter::reFreshCallerDataSource(recordDataSource,
recordExists,
(numberOfRecords > 1));
myID=purchFormLetter.parmBtnID();
info(strfmt("my BTN name is: ",myID));
/*
//-------------------------------------Start of Old VendPurchOrderJour------------------------------------------------------------
select firstOnly vendPurchOrderJourOld order by vendPurchOrderJourOld.RecId asc
where vendPurchOrderJourOld.PurchId == purchTable.PurchId ;
//-------------------------------------End of Old VendPurchOrderJour------------------------------------------------------------
if(vendPurchOrderJourOld.PurchId)
{
ttsBegin;
select forupdate vendPurchOrderJourNew order by vendPurchOrderJourNew.RecId desc
where vendPurchOrderJourNew.PurchId == purchTable.PurchId ;
vendPurchOrderJourNew.PurchaseOrderIdOld = vendPurchOrderJourNew.PurchaseOrderId;
vendPurchOrderJourNew.PurchaseOrderId=vendPurchOrderJourOld.PurchaseOrderId;
vendPurchOrderJourNew.update();
ttsCommit;
}
*/
}
}
}
---------------------------------------------------------End code of static client void main-------------------------------------------------------------------------------------------
*This post is locked for comments