Skip to content

Instantly share code, notes, and snippets.

View d47447's full-sized avatar

Deepak Agarwal d47447

View GitHub Profile
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataSourceEventHandler(formDataSourceStr(ProjAdjustmentSplit, TmpProjAdjustmentSplit), FormDataSourceEventType::Initialized)]
public static void TmpProjAdjustmentSplit_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)
{
TmpProjAdjustmentSplit tmpProjAdjustmentSplit = sender.cursor();
FormDataSource tmpProjAdjustmentSplit_ds = sender.formRun().dataSource('TmpProjAdjustmentSplit');
@d47447
d47447 / DisplayOptionInitialize.txt
Created February 24, 2019 20:04
DisplayOptionInitialize method
[FormDataSourceEventHandler(formDataSourceStr(VendTable, VendTable), FormDataSourceEventType::DisplayOptionInitialize),
SuppressBPWarning('BPParameterNotUsed', 'Parameter required by the event interface.')]
public static void VendTable_OnDisplayOptionInitialize(FormDataSource sender, FormDataSourceEventArgs e)
{
VendTable vendTable;
FormDataSourceDisplayOptionInitializeEventArgs eventArgs = e;
vendTable = eventArgs.record();
//Set effected field(s). You can fields add as many as you want Comment below line if you want to apply color on entire line.
eventArgs.displayOption().affectedElementsByControl(sender.formRun().design(0).controlName(formControlStr(VendTable, VendTable_AccountNum)).id());
@d47447
d47447 / GetMultipleQueryRange
Last active February 24, 2019 20:31
Get query range from query object
//let's assume there are more than one data source on the query and each data source may
//have more than one ranges or ranges are unknown. In such case,
//you can use a for loop to get all data sources on query and ranges.
Query query = New Query();
QueryBuildDataSource qbds;
QbueryBuildRange qbr;
int totalDS, totalRanges;
query = queryStr(<AOT Query Name OR query object that you passed from Form A>) ;
@d47447
d47447 / ListPanel initialization
Created February 24, 2019 20:33
ListPanal control
SysListPanelRelationTableCallback listPanel; //Yes its out side of init method Winking smile
public void init()
{
listPanel = SysListPanelRelationTableCallback::newForm(element,
element.controlId(formControlStr(DpkVendorGroup, ListPanelGroup)), //1
"Selected Groups", //2
"Remaining groups",//3
0,//4
tablenum(DpkEmployeeVendGroup),//5
fieldnum(DpkEmployeeVendGroup, VendGroupId),//6
@d47447
d47447 / Table_OnValidatedField
Created February 24, 2019 20:36
Table event handler OnValidatedField
[DataEventHandler(tableStr(CustTable), DataEventType::ValidatedField)]
public static void CustTable_onValidatedField(Common sender, DataEventArgs e)
{
ValidateFieldEventArgs event = e as ValidateFieldEventArgs ;
CustTable custTable = sender as CustTable;
boolean result = event.parmValidateResult();
result = result && RegNumberValidator_BG::validate(custTable.AccountNum, custTable.RegistrationNumber_BG, CustVendACType::Cust);
event.parmValidateResult(result);
}
@d47447
d47447 / CreateLogisticsPostalAddress
Created February 24, 2019 20:43
Create logistic postal address, Create delivery address run time
Public static LogisticsPostalAddressRecId createAddress(tmpNewAddress _tmpNewAddress)
{
LogisticsPostalAddress deliveryAddress;
LogisticsPostalAddressEntity postalAddressEntity;
LogisticsPostalAddressView addressView;
DirPartyPostalAddressView partyAddressView;
// get location from current user setup
LogisticsLocation logisticsLocation = LogisticsLocation::find(HcmWorkerTitle::findByWorker(curUserId()).Location);
//Address type default to delivery
LogisticsLocationRole logisticsLocationRole = LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery);
@d47447
d47447 / FormLookupCode.txt
Created February 28, 2019 10:08
Lookup on form control
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds,qbds1;
QuerybuildRange QuerybuildRange,QuerybuildRange1,QuerybuildRange2;
QuerybuildLink QuerybuildLink;
SysTableLookup sysTableLookup;
;
sysTableLookup = SysTableLookup::newParameters(tablenum(UB_ResourceRequest1), this);
@d47447
d47447 / VendAccountMerge.txt
Created February 28, 2019 10:13
X++ code for merging two table records
static void VendAccountMerge(Args _args)
{
VendTable vendTable;
VendTable vendTableDelete;
PurchJournalAutoSummary jourSummary;
#define.vend('5001')
#define.vendDelete('5002')
;
@d47447
d47447 / AmountInWords.txt
Created February 28, 2019 10:17
X++ code for converting Amount in words
display Tempstr numberToRupees()
{
int numOfPennies = frac(TmpChequePrintout.AmountCur)*100 mod 100;
int test = real2int(round(TmpChequePrintout.AmountCur,0));
int paise;
int numOfTenths;
str 20 ones[19], tenths[9], hundreds, thousands, lakhs, crores, millions, billions;
str 40 textpaise;
int tmpnumofpennies;
int temp;
@d47447
d47447 / ItemImageUploadMethod
Last active March 1, 2019 09:49
X++ code for item image update
static void TheAxapta_ItemImageUpload(Args _args)
{
System.String[] fileNames;
DocuActionArchive docuActionArchive;
EcoResProductImageManagement productImageManagement;
EcoResProductImageThumbnail ecoResProductImageThumbnail;
DocuRef docuRef;
DocuValue docuValue, dv;
EcoResProductImage ecoResProductImage;