DateTime Handlings in AX 2012 / D365
static void AlfTimeAdd(Args _args)
{
TransDateTime d = DateTimeUtil::getSystemDateTime();
TransDate d3 = today();
TransDateTime d1,d2;
;
print d;
print d3;
d1 = DateTimeUtil::addHours(d,4); // To add 4 hours from current time
print d1;
d2 = Datetimeutil::newDateTime(d3,7.5*60*60); // I need today 7.30 Am
print d2;
print DateTimeUtil::addHours(d,4);
print DateTimeUtil::addDays(d,4);
print DateTimeUtil::addMinutes(d,4);
print DateTimeUtil::addMonths(d,4);
print DateTimeUtil::addYears(d,4);
pause;
}
X++ Code to handle workflow event hander for current record
Hi
public void changeRequested(WorkflowElementEventArgs _workflowElementEventArgs)
{
ttsbegin;
DpayWorkerReqTable::findRecId(_workflowElementEventArgs.parmWorkflowContext()
.parmRecId(), true));
DpayWorkerReqTable.Status = DpayWorkflowStatus::NotSubmitted;
DpayWorkerReqTable.update();
ttscommit;
}
ERROR : Update is not allowed without specifying ValidTimeStateUpdateMode in AX 2012 / D365
Hi,
Add tableName.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
inside the tts.
static void Job511(Args _args)
{
EmplContract emplContract;
utcdatetime minDateTime = DateTimeUtil::minValue() , maxDateTime = DateTimeUtil::maxValue();
ttsBegin;
While select forUpdate
* from emplContract
where emplContract.AnnualLeave == “”
{
emplContract.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
emplContract.AnnualLeave = “اجازة السنوية”;
emplContract.update();
}
Delete RunbookID from AXUpdateInstaller.exe List in VM
Hi,
Please go to the path C:LogsInstallationRecordsRunbooks
Delete whichever RunBooks to be removed from the server.
Regards,
ValidTimeState in child table relation in AX 2012 / D365
Hi,
while select validTimeState(AsOnToday) * from hcmEmployment join hcmWorker
where hcmWorker.RecId == hcmEmployment .Worker &&
hcmWorker.PersonnelNumber == “1269”
{
print hcmEmployment .ValidFrom;
}
pause;
}
Regards
The method typeId has not been declared.
Hi,
In AX 2012 R2 onwards typeId() is replaced with extendedTypeStr();
Regards
User ID to user name or Worker Name in AX 2012 / D365
Hi,
Worker = HcmWorker::find(DirPersonUser::findUserWorkerReference(UserId));
or
public display Name userName()
{
DirPartyName partyName;
partyName = DirPersonUser::userId2Name(this.UserId);
if (!partyName)
partyName = (select firstonly Name from userInfo where userInfo.Id == this.UserId).Name;
if (!partyName)
partyName = this.UserId;
return partyName;
}
Regards
Assembly containing type Microsoft.Dynamics.AX.Framework
.Tools.DMF.ServiceProxy.DmfEntity
Proxy is not referenced
Hi,
Error: “Assembly containing type Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.DmfEntityProxy is not referenced”
It clearly says that no reference found.
Solution:
DMF is not installed.
Regards,
Sum, Avg, Count, Max, Min functionalities in Query class in AX 2012 / D365
Hi, Regards,
Relation between HcmPositionDetail, HcmPositionWorkerAssignment, HcmWorker for query class in AX 2012 / D365
Hi, Query query = new Query(); QueryRun queryRun; QueryBuildDataSource qbdsHcmWorker, qbdsHcmPosition, qbdsHcmPositionDetail, qbdsHcmPositionWorkerAssign; QueryBuildRange qbrWorker,qbrdDept; HcmPositionDetail hcmPositionDetail; HcmWorker hcmWorker; ; qbdsHcmWorker = query.addDataSource(tableNum(HcmWorker)); qbdsHcmWorker.addRange(fieldnum(HcmWorker,PersonnelNumber)).value(‘1020’); qbdsHcmPositionWorkerAssign = qbdsHcmWorker.addDataSource(tableNum(HcmPositionWorkerAssignment)); qbdsHcmPositionWorkerAssign.relations(false); […]
Sum() in Query class in AX 2012 / D365
Hi, To perform sum() function in Query Class. qbdsOverTimeTrans.addSelectionField( fieldnum( DAPOvertimeTransactions, Amount), SelectionField::Sum); Regards,
QueryBuildRange class to filter with never date in AX 2012 or D365
Hi, qbdsHcmPositionDetail.addRange(fieldnum(HcmPositionDetail,ValidTo)).value(date2str(dateMax(), 321, DateDay::Digits2, DateSeparator::Hyphen, DateMonth::Digits2, DateSeparator::Hyphen, DateYear::Digits4));This is used for Valid Time State Tables particularly. Regards,
Greater than or euqal to / Less than or equal to (=) in Query class in AX 2012 or D365
Hi, Greater than or equal to:queryBuildDataSource.addRange(fieldNum(HcmPositionWorkerAssignment,ValidTo)); queryBuildRange.value(SysQuery::range(today(), dateMax())); or queryBuildDataSource.addRange(fieldNum(HcmPositionWorkerAssignment,ValidTo)); queryBuildRange.value((queryRange(today(), dateMax())); Less than or equal to: queryBuildDataSource.addRange(fieldNum(HcmPositionWorkerAssignment,ValidTo)); queryBuildRange.value(SysQuery::range( dateNull(), today())); or queryBuildDataSource.addRange(fieldNum(HcmPositionWorkerAssignment,ValidTo)); queryBuildRange.value((queryRange(dateNull(), today())); Regards,
Convert Ledger dimension from ProjectID to LedgerJournalTable in AX 2012
Hi, //for default account: print DimensionStorage::getDefaultAccount(54154515402);//mainAccount .RecId); DimensionStorage::accountNum2LedgerDimension(ProjId, LedgerJournalACType::Project); Regards,
Time null in AX 2012 / D365
Hi, There is no timeNull() unline dateNull() in Ax 2012, where as there is an work around to handle this as timeMin() or TimeMax(). DateTimeUtil::time(dateTimeUtil::minTime()); // prints 12:00 AMDateTimeUtil::time(dateTimeUtil::maxTime()); // prints 11:59 PM Regards,
Convert particular (Project) dimension type to LedgerDim in AX 2012 / D365
Hi, print DimensionStorage::accountNum2LedgerDimension(ProjId, LedgerJournalACType::Project); Regards,
Getting current user languague in SSRS in AX 2012
Hi, =iif(Parameters!AX_RenderingCulture.Value = “ar”,FALSE,TRUE) Note: No needs to validate using controller class or passing the values in DP class for this. In my case, I needs to change the order ofcolumn of the table in SSRS without reference to arabic from right to left and rest left to right. So I added visibity based on […]
Get the current user worker Information
Hi, this.ChangedBy = HcmWorker::find(DirPersonuser::findUserWorkerReference(curUserId())).RecId; Regards,
Add *.dll to the GAC – Global assembly cache for Windows Server 2012 or later – Using Developer CMD Prompt for Visual Studio.
Hi, Installing the assemble in to global cache What is GAC The Global Assembly Cache is a machine-wide store used to hold assemblies that are intended to be shared by several applications on the machine. Each computer where the common language runtime (CLR) is installed has a global assembly cache. […]
Add *.dll to the GAC – Global assembly cache for Windows Server 2012 or later – Using CMD prompt
Hi, Installing the assemble in to global cache What is GAC The Global Assembly Cache is a machine-wide store used to hold assemblies that are intended to be shared by several applications on the machine. Each computer where the common language runtime (CLR) is installed has a global assembly cache. […]