Posts

Hold all batch jobs

  To hold all batch jobs. Create a new Job  Add below code to job and execute. All the batch jobs with status waiting will be changed to hold.     BatchJob job;         ttsBegin;     while select forUpdate job where job.Status == BatchStatus::Waiting     {         job.Status = BatchStatus::Hold;         job.update();             }     ttsCommit;

Form as field look up in another form

A new field is added and that should show a already created form as its lookup. Create a new form with datasources and design. In design properties give window type-content page, style- lookup public void lookup() {    SysTableLookup          sysTableLookup ;     Query                   query           = new Query();     QueryBuildDataSource    queryBuildDataSource;     QueryBuildRange         queryBuildRange;     DimensionValue  value;     Args args;     FormRun formRun;     ;     args = new Args();     args.name("HcmWorkerEligibleLookup");     args.record(PurchReqTable);     args.parmEnum(NoYes::Yes); //     args.caller(this); //     formRun = classFactory.formRunClass(args);     formRun.init();     formRun.run();     formRun.detach();     this.performFormLookup(formRun); } In the created form init method give public void init() {     super(); this.selectmode(formname_field from datasource to be shown in the lookup eg: this.selectMode

Forms to store last filter values

Use SysEPCustomFilter class to save the last filter values on forms or listpages Use projprojectslistpageInteraction class to see more about the functionality

SQL: view database restore history

SELECT [rs].[destination_database_name], [rs].[restore_date], [bs].[backup_start_date], [bs].[backup_finish_date], [bs].[database_name] as [source_database_name], [bmf].[physical_device_name] as [backup_file_used_for_restore] FROM msdb..restorehistory rs INNER JOIN msdb..backupset bs ON [rs].[backup_set_id] = [bs].[backup_set_id] INNER JOIN msdb..backupmediafamily bmf ON [bs].[media_set_id] = [bmf].[media_set_id] ORDER BY [rs].[restore_date] DESC

Project list page - to filter and show data as per last selection

public Query applyFilter(Query _query, boolean _saveFilterValues = false) {     //QueryBuildDataSource parentProjTableDataSource, parentProjTableDataSource2;     int s;     //CtrlBottomProjLevels.allowEdit(false);     s = customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels));     if (customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Top)     {         SysQuery::findOrCreateRange(_query.dataSourceTable(tableNum(ProjTable)), fieldNum(ProjTable, ParentId)).value(SysQuery::valueEmptyString());         //ProjTable_ds.executeQuery();         //ProjTable_ds.query().dataSourceTable(tableNum(ProjTable)).clearRange(fieldNum(ProjTable, ParentId));     }     else if(customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Phase)     {         parentProjTableDataSource = _query.dataSourceTable(tableNum(ProjTable)).addDataSource(tableNum(ProjTable));/

Collection list page in sales ledger

If collections list page form in sales ledger/commom/collections does not show data. Make sure and run customer ageing snapshot in sales ledger/periodic

CLR Error - AX 2012

When you have visual studio projects added to AX. Errors may occur at different times when generating CIL. Error - Object synchronization method was called from an unsynchronized block of code. restart AOS  Run full CIL Error  - assembly containing type is not referenced Check the assembly .dll file is in the server/vsassemblies folder. Check if you can access the assembly in a x++ job and you are able to call the methods. Add the AOS account to the assembly in above folder.