Posts

Showing posts from February, 2025

Run report through code at runtime in D365fo x++

Run report through code at runtime in D365fo x++ internal final class DSSContractInfoutil extends SrsReportRunController { public static void Main(Args _args) { DSSContractInfoutil controller = new DSSContractInfoutil(); controller.setReportName(ssrsReportStr(DSALotWiseSalesReport, Design)); controller.parmArgs(_args); controller.parmShowDialog(false); controller.startOperation(); } public void setReportName(str _reportName) { this.parmReportName(_reportName); Object rdpContract = this.parmReportContract().parmRdpContract(); SrsReportRdpDataContractInfo rdpContractInfo = SrsReportRdpDataContractInfo::newParameterInfo(classId2Name(classIdGet(rdpContract)), rdpContract, DSSContractInfoutil::parmReportRun(_reportName)); Map dataContarct = rdpContractInfo.getMembers(); this.setParameterValues(rdpContract, dataContarct); } public void setParameterValues(Object _rdpContract, Ma...

Get a list of report designs by code in D365fo x++

Get a list of report designs by code  in D365fo x++ static void getDesignNameJob ( Args _args ) { List srsReportList ; ListEnumerator srsReportListEnumerator ; SRSReport srsReport ; List srsReportDesignsList ; ListEnumerator srsReportDesignsListEnumerator ; SRSReportDesign srsReportDesign ; Set reportsSet = new Set ( Types :: String ); srsFrameworkService service = new srsFrameworkService (); reportsSet . add ( 'SalesInvoice' ); srsReportList = service . getReportDetails ( reportsSet ); if ( srsReportList ) { srsReportListEnumerator = srsReportList . getEnumerator (); while ( srsReportListEnumerator . moveNext ()) { srsReport = srsReportListEnumerator . current (); if ( srsReport ) { srsReportDesignsList = srsReport . designs (); if ( srsReportDesignsList ) ...

Disable selected fields in DataSource in D365fo x++

Disable selected fields in DataSource in D365fo x++ public static void allowEditASetOfFields(FormDataSource _formDataSource, Set _allowEdit) { DictTable dictTable = new DictTable(_formDataSource.table()); _formDataSource.allowEdit(true); for(int i = 1; i <= dictTable.fieldCnt(); i++) { var fieldId = dictTable.fieldCnt2Id(i); if (!isSysId(fieldId)) //Exclude system fields { FormDataObject formDataObject = _formDataSource.object(fieldId); if (formDataObject) { formDataObject.allowEdit(_allowEdit.in(fieldId)); } } } }