Posts

Create computed column in view or data entity with Sql statement

Image
    public static server str getHasBreakupDetails()     {         str expression;                  expression = '(select count(bl.RecId) from EMSChargebackBreakupLines bl join EMSChargebackBreakupHeader bh on bl.BreakupHeaderRecId = bh.RecId and bh.ChargebackRecId = ' +             SysComputedColumn::returnField(tableStr(SAKChargebacksInquiryView),identifierStr(SAKChargebacks),fieldStr(SAKChargebacks,RecId)) + ')'; // If condition & literal with numbers          return SysComputedColumn::if(             SysComputedColumn::equalExpression(             expression,             SysComputedColumn::comparisonLiteral(0)), SysComputedColumn::returnLiteral(0), SysComputedColumn::returnLiteral(1));     } Other examples public static server str getCBNum(Tabl...

Composite data entity datasources insert

Image
  Examples: InventInventoryAdjustmentJournalEntryV2Entity InventInventoryAdjustmentJournalEntryCDSEntity Align the datasources in following way Primary datasource make it line one , So that system automatically inserts the line data and just before inserts the line data we insert the header data public class MCOInventTransferOrdersEntity extends common {        /// <summary>     ///     /// </summary>     public void postLoad()     {         super();         this.ProductName = InventTable::find(this.ItemId).itemDescriptionOrName();     }     /// <summary>     /// Executes logic for optimizing staging data before copy to target.     /// </summary>     /// <param name="_dmfDefinitionGroupExecution">     /// The definition group that should be processed.     /// </param>   ...

Run time add form controls (dynamic) - active financial dimensions dialog form

 [Form] public class HIGUpdateFinDimFromSalesHeaderToLines extends FormRun {     CustInvoiceTable custInvoiceTable;     List finLi,selectedFinLi;     FormBuildDesign        formBuildDesign;     void closeOk()     {         if(!custInvoiceTable.DefaultDimension)         {             throw Error("Dimensions not found on header");         }         else if( custInvoiceTable.InvoiceId)         {             throw Error("Changes cannot be made for invoiced orders");         }         else         {             DimensionAttribute      dimensionAttribute;             DimensionAttributeValue dimensionAttributeValue;     ...

Consume odata/web api d365fo and parsing json content

// Two types of content type url will have usually , //1. normal URL encocoding(means adding parameters in url link)   //2. multiform-data(values needs to specify on webforms to accesss data ) //Check RetailCommonWebAPI and do find references how they are consuming odata API    class ALMMenaiHRMSIntegrationService {     str accessToken,responseJsONData;     RecordInsertList recIns;     public void  getAuthToken()     {         RetailCommonWebAPI  webApi;         str                 rawResponse;         RetailWebResponse   response;         URL loginURL;         str contentType;         Map docFields = new Map(Types::String, Types::Class);         webApi = RetailCommonWebAPI::construct();         loginU...

Get voucher transactions,settlement , and other details from customer , invocie other posted transactions via GJentry and subledger entry

   //From here the code is common for all posted transactions if Project invoice one then we need to join with projinvoicejour instead of vendinvoicejour like this way GeneralJournalAccountEntry accEntry; SubledgerVoucherGeneralJournalEntry subGjEntry ;  LedgerDimensionPreviewTmp   ledgerDimensionPreviewTmpLocal; while select maxof(GeneralJournalEntry) from  subGjEntry                         where subGjEntry.AccountingDate == vendInvoiceJour.InvoiceDate                         &&     subGjEntry.Voucher ==  vendInvoiceJour.LedgerVoucher                          join sum(TransactionCurrencyAmount),LedgerDimension,maxof(Text),maxof(IsCredit) from   accEntry group by accEntry.LedgerDimension               ...

Caller form refresh task refresh #task

    FormDataSource fds;     FormRun fr;         #Task  fr  =element.args().caller();     if (fr != null)    {        fds = fr.dataSource();        PurchTableDlv = fds.getFirst(1);         ttsbegin;         PurchTableDlv.selectForUpdate(true);         PurchTableDlv.update();         PurchTableDlv = fds.getNext();         ttscommit;         fr.task(#TaskRefresh);     }     element.closeOk();                    

Find credit note original sales order on sales order invoice report

 [ExtensionOf(classStr(SalesInvoiceDP))] final class HIGSalesInvoiceDP_Extension {     protected void populateSalesInvoiceHeaderFooterTmp(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)     {         CustInvoiceTrans custInvoiceTrans,custInvoiceTransOrig;         SalesLine salesLine;         InventTransOrigin  transOrigin,transOriginOrig;         InventTrans inventTrans;         next   populateSalesInvoiceHeaderFooterTmp(_custInvoiceJour,_companyInfo);         salesInvoiceHeaderFooterTmp.BuyerAddress = _custInvoiceJour.deliveryAddress();         salesInvoiceHeaderFooterTmp.BuyerName = _custInvoiceJour.DeliveryName;         salesInvoiceHeaderFooterTmp.CompanyAddress = strReplace(salesInvoiceHeaderFooterTmp.CompanyAddress,"\n",",");         salesInvoiceHeaderFo...