D365 Finance and Operations Archives - Page 18 of 24 - - Page 18

Category Archives: D365 Finance and Operations

Create Item Requirement from Item Forecast using X++ in D365 Operations

Introduction: In this blog article, we will see how we can create Item Requirement on insertion of Item Forecast using code. Steps: Create Extension Class for ForecastSales Table that is Item Forecast and using CoC for post insert() method we will initialize Item Requirement. We will call a new class which is created in Step 2. public void insert() {     next insert();     SalesType salesType = SalesType::ItemReq;     CFSCreateItemReqFrmItemForecast createItemReq = new CFSCreateItemReqFrmItemForecast();     createItemReq.initParameters(this);     createItemReq.copyToSalesLine(SalesType); } Create a new class that will initialize values and insert record in Item Requirement form. class CFSCreateItemReqFrmItemForecast { ForecastSales forecastSales; }  In the new class create a method initParameter. This method will initialize ForecastSales object. void initParameters(ForecastSales _forecastSales) { forecastSales = _forecastSales; }  Create another method ‘copytoSalesLine’. It will validate the record and call other methods to copy values to SalesLine Table. public void copyToSalesLine(SalesType _salesType) { ProjTable projTable = ProjTable::find(forecastSales.ProjId); if (_salesType == SalesType::ItemReq) { if (!ProjStatusType::construct(projTable).validateWriteItemRequirement()) { throw error(“@SYS18447”); } } else { if (!ProjStatusType::construct(projTable).validateWriteSalesLine()) { throw error(“@SYS18447”); } } SalesLine salesLine = this.initializeSalesLine(_salesType, forecastSales, projTable); salesLine.createLine(false, // Validation false, // Init from SalesTable true, // Init from InventTable true, // Calc invent Qty false, // Search markup – copied from salesQuotationline false, // Search price – copied from salesQuotationline false, // Check reservation true); // Skip creditlimit check this.updateSalesLine(salesLine, forecastSales); salesLine.update(); } Create a new method ‘initializeSalesLine’. It is called from copyToSalesLine(). protected SalesLine initializeSalesLine(SalesType _salesType, ForecastSales _forecastSales, ProjTable _projTable) { SalesLine salesLine; salesLine.SalesType = _salesType; salesLine.initValue(); salesLine.setInventDimId(_forecastSales.InventDimId); salesLine.ItemId = _forecastSales.ItemId; salesLine.SalesQty = _forecastSales.SalesQty; salesLine.SalesUnit = _forecastSales.SalesUnitId; salesLine.ProjId = _forecastSales.ProjId; salesLine.ActivityNumber = _forecastSales.ActivityNumber; salesLine.CurrencyCode = _forecastSales.Currency; salesLine.initFromProjTable(_projTable, false); return salesLine; } Create a new method updateSalesLine(). It is called from copyToSalesLine() method. protected void updateSalesLine(SalesLine _salesLine, ForecastSales _forecastSales) {     _salesLine.DefaultDimension =       _salesLine.copyDimension(_forecastSales.DefaultDimension);     _salesLine.ProjLinePropertyId = _forecastSales.ProjLinePropertyId;     _salesLine.TaxGroup = _forecastSales.TaxGroupId;     _salesLine.TaxItemGroup = _forecastSales.TaxItemGroupId;     _salesLine.ProjCategoryId = _forecastSales.ProjCategoryId;     _salesLine.CostPrice = _forecastSales.CostPrice;     _salesLine.SalesPrice = _forecastSales.SalesPrice;     _salesLine.LinePercent = _forecastSales.DiscPercent;     _salesLine.LineDisc = _forecastSales.DiscAmount;     _salesLine.LineAmount = 0;     _salesLine.LineAmount = _salesLine.calcLineAmount();     SalesLineType_ItemReq::setSalesLineReceiptDate(_salesLine); }

Share Story :

Post Ledger Journal using X++ in D365 Operations

Introduction: In this blog article, we will see how we can post the journal by using code. How to do? Create a new method and write below code. In this code you declare object of Class ‘LedgerJournalCheckPost’. This class will use journal buffer and post it. public void postJournal(LedgerJournalTable ledgerJournalTable) { LedgerJournalCheckPost jourPost; jourPost = LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes); jourPost.runOperation(); }

Share Story :

Posting Restriction for Journals- Dynamics 365 Finance & Operations

Posting restriction feature allow to determine whether specific user or user groups can post only journals that they create. You can use Journal names for posting restriction setup. Navigate to  General ledger > Journal Setup  > Journal names. Select Journal names for which you want to apply Posting restriction. Click on Posting restrictions button To set up posting restrictions by user group, select By user group.Select the check box next to the user group name. To set up posting restrictions by user, select By user. Select the check box next to the user name. Click OK to apply the restrictions and close the form.

Share Story :

Vendor Invoice Journal-Dynamics 365 Finance and Operations

Introduction: Vendor invoice journal helpful to post purchase invoices that are not associated with purchase orders. Examples of this type of invoice include expenses for supplies or services. Steps: Go to Accounts Payable > Invoices > Invoice journals Click on new button, select name of the journal and enter a description in description field. In the Date field, enter the posting date that will update General Ledger. Select Vendor account Specify invoice number in Invoice field. Enter Description in the field description In the Credit field, enter a number. In the Offset account field, enter the account number or click the drop down button to open the lookup Click on Validate to check the data are correct. Click on post to Post the Invoice

Share Story :

Create Fixed Asset Journal using X++

In this blog article, we will see how we can create Fixed Asset Journal using X++. Write below code to create Journal Header in LedgerJournalTable Table and Lines record in LedgerJournalTrans and LedgerJournalTrans_Asset Tables. public void createFixedAssetJournal()     {                LedgerJournalTable ledgerJournalTable;         LedgerJournalTrans ledgerJournalTrans;         LedgerJournalTrans_Asset ledgerJournalTrans_Asset;         Assettable assetTable;         ledgerJournalTable.initValue();         ledgerJournalTable.JournalNum   = JournalTableData::newTable(ledgerJournalTable).nextJournalId();         ledgerJournalTable.Posted       = NoYes::No;         ledgerJournalTable.JournalName  = ‘ACQUI’;         ledgerJournalTable.JournalType  = LedgerJournalType::Assets;         ledgerJournalTable.initFromLedgerJournalName(ledgerJournalTable.JournalName);         ledgerJournalTable.insert();          ledgerjournalTrans.initValue();         ledgerJournalTrans.CurrencyCode      = Ledger::accountingCurrency(CompanyInfo::find().RecId);         ledgerJournalTrans.AccountType       = LedgerJournalACType::FixedAssets;         ledgerJournalTrans.TransactionType   = LedgerTransType::FixedAssets;         ledgerJournalTrans.Approved          = NoYes::Yes;         ledgerJournalTrans.Approver          = HcmWorker::userId2Worker(curuserid());             ledgerJournalTrans.LineNum                              = LedgerJournalTrans::lastLineNum(ledgerJournalTrans.JournalNum) + 1;         ledgerJournalTrans.TransDate                            = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());         ledgerJournalTrans.LedgerDimension                      = LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber(AssetTable.AssetId,LedgerJournalACType::FixedAssets);                   ledgerJournalTrans.accountName();                ledgerJournalTrans.AmountCurDebit                       = ’45’;         ledgerJournalTrans.OffsetAccountType                    = LedgerJournalACType::Ledger;         ledgerJournalTrans.OffsetLedgerDimension                = ledgerJournalTrans.getOffsetLedgerDimensionForLedgerType(AssetLedgerAccounts::assetOffsetLedgerDimension(AssetTable.AssetId, AssetTable.assetBookCurrent().BookId, AssetTransType::Acquisition),curExt());         ledgerJournalTrans.insert();         ledgerJournalTrans_Asset.initValue();         ledgerJournalTrans_Asset.RefRecId                       = ledgerJournalTrans.RecId;         ledgerJournalTrans_Asset.AssetId                        = assetTable.assetId;         ledgerJournalTrans_Asset.TransType                      = AssetTransTypeJournal::Acquisition;         ledgerJournalTrans_Asset.BookId                         = AssetTable.assetBookCurrent().BookId;         ledgerJournalTrans_asset.insert();         ttsbegin;         LedgerJournalTable.selectForUpdate(true);         LedgerJournalTable.numOfLines = LedgerJournalTable.numOfLines();         LedgerJournalTable.update();         ttscommit; }

Share Story :

Create Fixed Asset using X++

In this blog article, we will see how we can create a Fixed Asset using code based on AssetGroupID. Add below code in class to create a Fixed Asset, public void createFixedAsset(AssetGroupId assetGroupId) {         AssetTable assetTable;         NumberSeq numberSeq;         assetTable.initValue();         assetTable.assetGroup = AssetGroupId;         //Initialize Number Seq for Asset Id         numberSeq = assetTable.initAssetNumberSeq(assetTable.Assetgroup);         AssetTable.AssetId = NumberSeq.num();           //Initialize other fields based on Asset Group assetTable.initFromAssetGroupId(assetTable.Assetgroup);         //Initialize name and Name Alias fron Item Id         assetTable.Name = InventTable::find(‘ITM1104’).itemName();         assetTable.NameAlias = assetTable.Name;         //Validate and Insert Fixed Asset. On insertion asset book is also created         assetTable.validateWrite();         assetTable.insert();     }

Share Story :

Features of Business Central October Release

Introduction: In this blog I’ll be demonstrating few features of Business Central October Release[RC3]. Pre-requisite: Microsoft Dynamics 365 Business Central October Release[RC3]. Demonstration: 1.Refreshed User Experience Improved Card Page Layout. Improved List Page Categorized Actions. Changed position of New,Edit, Delete as well as Previous andNext buttons. 2. Improved Productivity Advanced filtering with multiple column filtering: Limit Totals: Row-based column copy past: Actual Data: Data in Excel Keyboard shortcuts: The October release, also consists the shortcut F8 that copies the value of the cell above. Thus, you can fill the new rows by moving across cells and selecting F8 on the cells where you want to copy the values from cell above. List of Keyboard Shortcuts : https://docs.microsoft.com/en-us/dynamics365/business-central/keyboard-shortcuts 3. Improved Search The search option has also been enhanced and categorized where previous search results were only related to pages and reports. In the upcoming release with the improvement in logic, the search results will also include the actions on the current page and the documentation along with the reports and pages. From the search itself you can check and perform the tasks that you want (for example: Create a contact for customer) Enter the contact details for the customer and click on OK 4. Permission Sets are Editable In Business Central October Release, the Permission Sets are Editable. New Permission Sets can be created as well as Permission Sets can be modified and also indented as well. Click on More Options to get the details. Changing the Permisison Sets in Business Central: Added an execute permission: Conclusion: These are few features of the Business Central. In the next blog I’ll demonstrate about the AL Language extension improvements.

Share Story :

Item cross reference Dynamics 365 Business Central

Introduction: Item Cross reference is useful to quickly identify the items that were ordered by a customer or that you are purchasing from a vendor on the basis of item numbers other than your company. You can use Item Cross reference on Purchase Order, Sales Order, Purchase Quote and Sales Quote Steps: Following are steps to setup Item cross reference. Open the Item list Click on edit button to Open Item Card. In Navigate tab click on Cross References button. Select Vendor, Customer or Bar Code in the Cross-Reference field. In the Cross-Reference Type No. field, select Vendor No, Customer No. or Bar Code Enter Vendor, Customer Item No. or Bar code no in the Cross-Reference No. field. Enter Unit of Measure Enter description for the Item. This description will be automatically copied in Purchase or Sales order line when you enter cross reference in Sales or Purchase order line Create a new Purchase Order/ Sales order. By default, the Cross-Reference No. field is not shown in the Order Line. Use Personalization and add it. In Cross-Reference No. field to select a cross reference no. System will automatically fill the Item No. and other information in the order line.

Share Story :

Fetch FormControl and value of different type in Event Handler of D365 Operations

Introduction: In this blog article, we will see how we can fetch Form Control and its value which is of different datatype in EventHandler in D365 Operations Scenario: I am working on Global Address Book functionality for checking Duplicate values for PartyID (String), Tax Id (CheckBox) and Tax Id Type (ComboBox). I am using Event Handler of form method to enable a button based on value of above three fields. Steps: Create Event Handler with below code: [PostHandlerFor(formStr(DirPartyCheckDuplicate), formMethodStr(DirPartyCheckDuplicate, enableSearch))] public static void DirPartyCheckDuplicate_Post_enableSearch(XppPrePostArgs args) { FormRun formRun = args.getThis() as FormRun; FormCheckBoxControl TaxId = formRun.design(0).controlName(“TaxId”) as FormCheckBoxControl; FormStringControl PartyNumber = formRun.design(0).controlName(“DirPartyTable_PartyNumber”) as FormStringControl; FormComboBoxControl TaxIdType = formRun.design(0).controlName(“TaxIdType”) as FormComboBoxControl; FormControl searchBtn = formRun.design(0).controlName(“searchBtn”); if(TaxId.value() || PartyNumber.valueStr() || TaxIdType.valueStr()) { searchBtn.enabled(true); } else { searchBtn.enabled(false); } }

Share Story :

Stocked Product in Item Model Group: Dynamics 365 for Finance & Operations

Introduction: If Stocked product checkbox is selected, then inventory transaction will be generated, and product inventory will be tracked. If this checkbox is not selected(Mainly for service items), then Inventory transaction will be not generated, and product inventory will be not tracked. Scenario 1: If Stoked Product Checkbox is not selected Posted purchase invoice for product for which stock product checkbox was unchecked. Inventory transaction has not been generated. This setting mainly uses for service type of products. Scenario 2: If Stoked Product Checkbox is selected Posted purchase invoice for product for which stock product checkbox was checked. Inventory transaction has been generated. This setting mainly uses for those products for which you want to track the inventory. Conclusion: This functionality is helpful to take decision for the product for which you want to track the inventory, or you want to book directly as an expense for service item without tracking inventory.

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange