GRID => Properties
"Export Label" => "SalesReportMexico"
To get download file with custom naming.
GRID => Properties
"Export Label" => "SalesReportMexico"
To get download file with custom naming.
validateExistCommonRecord(
RefTableId _refTableId,
RefRecId _refRecId)
{
boolean ret = true;
if (!_refTableId || !_refRecId)
{
ret = CheckFailed(strFmt("Incorrect parameter for the function called ", funcName()));
}
if (ret)
{
Common record = new DictTable(_refTableId).makeRecord();
select firstonly RecId from record
where record.RecId == _refRecId;
if (!record.RecId)
{
ret = checkFailed("Record not found");
}
}
return ret;
}
Content copied from AI.
Azure
Function Apps provide a serverless, event-driven compute service that lets
you run code in languages like C#, Python, JavaScript, and Java without
managing infrastructure. They scale automatically, offering a cost-effective
"pay-per-use" model suitable for processing data, integrating
systems, and building APIs.
Key
Aspects:
Prerequisites:
Azure Functions => Trigger types (Most commonly used triggers)
//Get or adjust tax calculation using TAXDOCUMENT framework (Tax calculation service)
TaxRegulation taxRegulationDetail;
TmpTaxRegulation tmpTaxRegulationDetail;
SalesTotals salesTotals;
salesTotals = SalesTotals::construct(SalesTable::find(salesLineParentPOl.SalesId), SalesUpdate::All);
salesTotals.calc();
taxRegulationDetail = TaxRegulation::newTaxRegulation(salesTotals.tax());
tmpTaxRegulationDetail.setTmpData(taxRegulationDetail.tmpTaxRegulation()); // Get all current tax by order wise
//Get this buffer "tmpTaxRegulationDetail" to get all tax related data
//To adjust
TaxTable taxTable;
select firstonly tmpTaxRegulationDetail
where tmpTaxRegulationDetail.TaxCode
join taxTable
where taxTable.TaxCode == 'SAN_IPI';
if(tmpTaxRegulationDetail)
{
taxRegulationDetail.updateTaxRegulationAmount(tmpTaxRegulationDetail, (<Updated tax amount after adjustment>), true); // to adjust use this call to do
taxRegulationDetail.saveTaxRegulation(); //
}
--Vendor default primary address
Select vt.AccountNum, vt.Party, vt.RecId, lpd.RECID, dpl.LOCATION, lpd.ADDRESS from VENDTABLE vt
join DirPartyLocation dpl on dpl.Party = vt.Party
join LogisticsPostalAddress lpd on dpl.LOCATION = lpd.LOCATION
where vt.DataAreaId = 'usrt' and dpl.ISPRIMARY =1 and lpd.VALIDTO = '2154-12-31 23:59:59.000'
--Warehouse default primary address
Select it.InventLocationId, it.INVENTSITEID, it.RecId, lpd.RECID, lpd.ADDRESS
from INVENTLOCATION it
join InventLocationLogisticsLocation illl on illl.INVENTLOCATION = it.RECID
join LogisticsPostalAddress lpd on lpd.LOCATION = illl.LOCATION
where it.DataAreaId = 'usrt' --and dpl.ISPRIMARY =1
and illl.IsPostalAddress =1 and illl.IsPrimary =1 and lpd.VALIDTO = '2154-12-31 23:59:59.000'
WMS Mobile app flow
=> Adding Detour fields for Process guided framework custom implementation
Before fix:
Adding code fix to get thos requires field.
/// <summary>
/// WHS APP FLOW Detour fields implementation SAN_WHSMobileAppFlowPOLMovementLPCreation
/// Run Create Default setup from Mobile device steps
/// </summary>
[WHSWorkExecuteMode(WHSWorkExecuteMode::SAN_MovementLP)]
class SAN_WHSMobileAppFlowPOLMovementLPCreation extends WHSMobileAppFlow
{
protected void initValues()
{
// add available fields
this.addAvailableField(extendedTypeNum(InventSerialId));
this.addAvailableField(extendedTypeNum(WHSLicensePlateId));
this.addAvailableField(extendedTypeNum(ItemId));
}
}
Post fix:
Reference class: RetailSyncOrdersSchedulerTask
Error readable:
private str generateHumanReadableErrorDetail(System.Exception _exception, str _errorDetail = '')
{
str errorDetail, exceptionType, stackTrace, exceptionMessage;
errorDetail = _errorDetail;
// When the CLR error encounters it gets the inner exception message, call stack and stores in Database.
if (_exception && _exception.InnerException)
{
if (_exception.InnerException.InnerException && _exception.InnerException.StackTrace)
{
// Use inner exception if it is available as it is often more descriptive.
errorDetail = errorDetail ? errorDetail +
_exception.InnerException.InnerException.Message : _exception.InnerException.InnerException.Message +
_exception.InnerException.StackTrace.ToString();
}
else if (_exception.InnerException.StackTrace)
{
errorDetail = _exception.InnerException.Message + _exception.InnerException.StackTrace.ToString();
}
else
{
// When the exeption not returns a call stack, we get the call stack from the <c>Xsession<c> object.
errorDetail = _exception.InnerException.Message + con2str(xSession::xppCallStack());
}
}
return errorDetail;
}
Replaces the value of the specified dimension attribute from source to target =>
LedgerDimensionDefaultFacade::serviceReplaceAttributeValue(<source dimension>, <target dimension>, DimensionAttribute::findByName("<Dimension name>").RecId);
/// <summary>
/// To check if user can get access to the Parameter form
/// </summary>
class SAN_ParamFormsAccessCtrl
{
protected void new()
{
super();
}
static SAN_ParamFormsAccessCtrl construct()
{
return new SAN_ParamFormsAccessCtrl();
}
public boolean validateUserRoleAccess()
{
#characters
UserId userId = curUserId();
container tmpValues;
SecurityRole securityRole;
SecurityUserRole securityUserRole;
int idx;
boolean isValidated = false;
Str secRoleList;
//Created new custom parameter to have which roles alone should have EDIT access, apart from this any roles would have only READ access even System admin
secRoleList = SAN_IntegrationParameters::find().ParametersAccessSecurityRole;
if(secRoleList)
{
tmpValues = str2con(secRoleList, #semicolon);
for(idx=1; idx<=conLen(tmpValues); idx++)
{
securityRole.clear();
select firstonly securityRole
where securityRole.Name == conPeek(tmpValues, idx);
if(securityRole.RecId && !isValidated)
{
securityUserRole.clear();
select firstonly RecId from securityUserRole
where securityUserRole.User == userId
&& securityUserRole.SecurityRole == securityRole.RecId;
if (securityUserRole.RecId)
{
isValidated = true;
}
}
}
}
return isValidated;
}
public void disableFormDataSources(FormRun _callingForm)
{
FormBuildDataSource frmBuildDS;
int i;
for(i = 1; i<= _callingForm.form().dataSourceCount(); i++)
{
frmBuildDS = _callingForm.form().dataSource(i);
frmBuildDS.allowEdit(false);
}
}
public boolean checkRoleCtrlAccess(FormRun _callingForm)
{
boolean userHasAccess = this.validateUserRoleAccess();
if(!userHasAccess)
{
this.disableFormDataSources(_callingForm);
}
return userHasAccess;
}
}
[ExtensionOf(formStr(LedgerParameters))]
final class LedgerParametersFrm_SAN_Extension
{
public void init()
{
next init();
SAN_ParamFormsAccessCtrl paramFormsAccessCtrl;
paramFormsAccessCtrl = SAN_ParamFormsAccessCtrl::construct();
if(!paramFormsAccessCtrl.checkRoleCtrlAccess(this))
{
this.san_lockControls();
}
}
void san_lockControls()
{
FormBuildControl formBuildControl;
int i;
for (i=1;i<=this.form().design().controlCount(); i++)
{
formBuildControl = this.form().design().controlNum(i);
this.control(formBuildControl.id()).enabled(false);
}
}
}
GRID => Properties "Export Label" => "SalesReportMexico" To get download file with custom naming.