Tag Archives: Dynamics 365 Finance and Operations
Sales return order line registration in D365FO and AX 2012
Introduction: Sales return order line registration in X++ Details: Consider SalesReturnOrderRegisterLine is the table where records are with SalesLine referenced. If we are required to register serialized items than salesReturnOrderRegisterLine.inventSerialId will be considered and if item referred with batch then salesReturnOrderRegisterLine.inventBatchId will be considered. public static void inventoryRegistration(SalesId _salesId) { SalesReturnOrderRegisterLine salesReturnOrderRegisterLine; SalesLine salesLine; TmpInventTransWMS tmpInventTransWMS; InventTransWMS_Register inventTransWMS_Register; InventDim inventDim; InventTrans inventTrans; VendPackingSlipTrans vendPackingSlipTransLoc; InventTransOrigin inventTransOrigin; while select salesReturnOrderRegisterLine where salesReturnOrderRegisterLine.SalesId == _salesId { salesLine = SalesReturnOrderRegister::updateDispositionCode(salesReturnOrderRegisterLine.InventTransId); inventTransWMS_Register = InventTransWMS_Register::newStandard(tmpInventTransWMS); select firstonly inventTrans where inventTrans.StatusReceipt == StatusReceipt::Ordered exists join inventTransOrigin where inventTransOrigin.RecId == inventTrans.InventTransOrigin && inventTransOrigin.InventTransId == salesLine.InventTransId && inventTransOrigin.ReferenceId == _salesId; tmpInventTransWMS.clear(); tmpInventTransWMS.initFromInventTrans(inventTrans); tmpInventTransWMS.InventQty = salesReturnOrderRegisterLine.SalesQty; tmpInventTransWMS.LineNum = int642int(salesLine.LineNum); inventDim = salesLine.inventDim(); inventDim.inventSerialId = salesReturnOrderRegisterLine.inventSerialId; inventDim.inventBatchId = salesReturnOrderRegisterLine.inventBatchId; tmpInventTransWMS.InventDimId = InventDim::findOrCreate(inventDim).inventDimId; tmpInventTransWMS.ItemId = salesLine.ItemId; inventTransWMS_Register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, InventDim::find(tmpInventTransWMS.InventDimId)); if (!inventTransWMS_Register.updateInvent(salesLine)) { throw error(“Error during sales return order registration”); } } } Consider SalesReturnOrderRegister is the class which has below static methods public static SalesLine updateDispositionCode(InventTransId _inventTransId) { SalesLine salesLine = SalesLine::findInventTransId(_inventTransId, true); ReturnDispositionCode returnDispositionCode; SalesReturnOrderRegister::runPreReturnOrderRegisterLine(salesLine); salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; salesLine.update(); return salesLine; } public static void runPreReturnOrderRegisterLine(SalesLine _salesLine) { InventTransOriginId salesLineInventTransOriginId; InventTransOriginId reservationLineInventTransOriginId; SalesLine reservationLine; ReturnDispositionCode returnDispositionCode; if (_salesLine.ReturnStatus == ReturnStatusLine::Awaiting) { if (!_salesLine.ReturnAllowReservation && _salesLine.isStocked()) { SalesLine::changeReturnOrderType(_salesLine.InventTransId); _salesLine = SalesLine::findInventTransId(_salesLine.InventTransId, true); } select firstOnly returnDispositionCode where returnDispositionCode.DispositionAction == DispositionAction::Credit; _salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; _salesLine.update(); } else if (_salesLine.ReturnStatus == ReturnStatusLine::Registered) { select forupdate firstonly reservationLine where reservationLine.InventRefTransId == _salesLine.InventTransId; if (reservationLine || _salesLine.qtyMarked()) { if ((_salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReplaceScrap || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReturnToCust || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::Scrap)) { if (reservationLine.SalesQty == reservationLine.RemainSalesPhysical) { reservationLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(reservationLine.DataAreaId, reservationLine.InventTransId); salesLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(_salesLine.DataAreaId, _salesLine.InventTransId); InventTransOrigin::deleteMarking(salesLineInventTransOriginId, reservationLineInventTransOriginId, -_salesLine.QtyOrdered); reservationLine.delete(); } } else { throw error(“@SYS332911”); } } } } Thanks for reading and stay connected with us for more updates!!! Jagdish Solanki | Senior Technical Consultant | CloudFronts Business Empowering Solutions Team “Solving Complex Business Challenges with Microsoft Dynamics 365 & Power Platform”
Factbox of workflow history on purchase order in D365FO
Introduction: In this blog, we will see how to create factbox of workflow history of purchase order in Microsoft Dynamics 365 Finance and Operations Details: Well, Factbox is a very pretty cool feature available from the earlier version AX 2012. It is very easy to achieve in Dynamics 365 as well. Here we will see how easy it is and steps for that. As shown in the above image, we will be going to create factbox for the “Tracking details list” Steps: Create the solution in Visual Studio and project for that. We’ll be required four objects mainly that is one display MenuItem, Table, Form (on which to display factbox), another Form (factbox). Reference attached below: 1. Table For displaying workflow history, we need to create the extension of table WorkflowTrackingStatusTable and create the normal relation and its relevant properties as 2. Factbox Now we are required to create the factbox of workflow history. For that we will use the effortless technique, where we will duplicate the standard form “WorkflowStatus” and will name as CFSPurchTableWorkflowHistoryFactBox (give name as per your naming convention standards) After duplicating and renaming the form, we need to change the pattern as “custom” After applying the custom pattern, delete the NavigationList which is not required in factbox, and do visible false ActionPane and PanelTab After that create the new Grid and assign the data source to it in the property and put all the required fields to show in factbox 3. Display MenuItem We will attach the created factbox form to the display menu item and relevant label “Workflow history” 4. Base form Base form we call it as where we will attach the factbox. Here it is purchase form. Go to Parm section and create a new part and give it a relevant name and its properties Properties: Data source: Attached data source with which workflow history is connected Data Source Relation: WorkflowTable.RelationName Name: Part name That’s it. Build the project and go the frontend and check the output how it looks like. Conclusion: It results as (we can scroll left and right to see all the tracking details list) Hurray, How pretty it looks like! In the above example, we have seen how we can develop factbox in Microsoft Dynamics 365 Finance and Operations. Thanks for reading and stay connected with us for more updates!!! Jagdish Solanki | Senior Technical Consultant | CloudFronts Business Empowering Solutions Team “Solving Complex Business Challenges with Microsoft Dynamics 365 & Power Platform”
Email Parameters | SMTP Configurations for sending Test Mail from D365FO
Introduction: In this blog, we will see how to set up email parameters and SMTP configuration for sending test mail from Microsoft Dynamics 365 Finance and Operations. Details: Go to the Email Parameters by follow this path: System administration -> Setup -> Email -> Email Parameter. Another easiest way to find the email parameter in a quick manner, go to the search box and simply write email parameter as below shown screenshot Steps: 1. In the configuration tab, set up the SMTP as in shown below image Move SMTP in the right box named with ENABLED to enable 2. In SMTP settings tab, configure the below stuff: Outgoing mail server: smtp.office365.com SMTP port number: 587 Username: put the email id from which email should be sent Password: appropriate password of the email Specify if SSL is required: true 3. In Test mail tab: Email provider: SMTP Send to: Put the email to whom test mail should be sent In the final, click on the “Send test mail” and then sample mail will be sent to the respective email address. Conclusion: In the above blog, we have seen how to set up SMTP configuration to test “send email” functionality from the email parameter form. Thanks for reading !!!
How to delete workspace from TFS Visual Studio
Introduction: In this blog, we will see how we can delete any of the TFS workspace which is assigned to different user Even if tried to remove/delete the workspace from Visual Studio, We’re unable to map existing workspace to new user. In such scenario, It is necessary to delete the workspace explicitly while getting the error as below “The working folder ‘Workspace_Folder_Local_Path’ is already in use by the workspace : on computer Solution: 1. Open Developer Command Prompt for VS2015 from Start menu 2. For getting the list of workspaces associated with user, run below command tf workspaces /server:https://{TFS}.visualstudio.com/{CollectionName} /owner:”{Owner}” Explanation, in my case {TFS} is xxxx.visualstudio.com/defaultcollection and {Owner} as Jagdish Solanki, Eventually it will look something like this, tf workspaces /server:https://xxxx.visualstudio.com/{CollectionName} /owner:”Jagdish Solanki” Reference: 3. To delete the workspace, run below command tf workspace /server:https://{TFS}.visualstudio.com/defaultcollection /delete “{Workspace};{Owner}” It will looks something like this, tf workspace /server:https://xxxx.visualstudio.com/defaultcollection /delete “SCM-DEV-1;Jagdish Solanki” Once the above command is executed, system will prompt you if user has any pending change(s). Are you sure want to delete the workspace? (Yes/No). Enter yes Reference:
Change RFQ purchase order status as draft insted of default approved
When we create purchase order using RFQ its default approval status will be approved. To change that status to draft write following code where we will change its status to draft. create new class and add following code class CFSPOStatusRfq { [PostHandlerFor(classStr(PurchAutoCreate_RFQ), methodStr(PurchAutoCreate_RFQ, endUpdate))] public static void PurchAutoCreate_PurchReq_Post_endUpdate(XppPrePostArgs args) { //PurchTable purchTable = args.getThis(‘purchTable’); PurchAutoCreate_RFQ purchReq = args.getThis() as PurchAutoCreate_RFQ; PurchTable purchTable, purchTablenew; purchTable = purchReq.parmPurchTable(); ttsbegin; select forupdate purchTablenew where purchTableNew.PurchId == purchTable.PurchId; if(purchTablenew && purchTablenew.DocumentState == VersioningDocumentState::Approved) { purchTablenew.DocumentState = VersioningDocumentState::Draft; purchTablenew.update(); } ttscommit; } }
List of security roles for current user | D365FO
Introduction: In this blog, we will see how we can get a list of security roles assigned to a current user Solution: UserInfo userInfo; SecurityRole securityRole; SecurityUserRole securityUserRole; while select securityRole exists join securityUserRole where securityUserRole.SecurityRole == securityRole.RecId exists join userInfo where userInfo.id == securityUserRole.User && userInfo.id == curUserId() { info(securityRole.name); } Thanks for reading !!!
Duplicate address record entry through Data entity in Dynamics 365 Finance and Operations
Introduction:In this blog, we will see how to allow system for accepting duplicate addresses of customer, vendor or any other, through doing bit change in Data Entity Solution:For allowing duplicate entries we will create one field in LogisticsPostalAddress. Here field name is as IsCreateFromEntity. Field-IsCreateFromEntity will be used as flag, type of boolean / NoYesId (EDT). [ExtensionOf(tableStr(LogisticsPostalAddressBaseEntity))] final class LogisticsPostalAddressBaseEntityCFSJSTable_Extension { public static LogisticsLocationId resolveRemittanceAddressLocationId(LogisticsPostalAddressBaseEntity _postalAddressEntity, DirPartyNumber _partyNumber) { LogisticsLocationId locationId, locationIdCreateNew; locationId = next resolveRemittanceAddressLocationId(_postalAddressEntity, _partyNumber); if(_postalAddressEntity.IsCreateFromEntity) { locationId = locationIdCreateNew; } return locationId; } } Aforementioned code would replace the standard locationId variable with new locationIdCreateNew which will be null always. Once new variable locationIdCreateNew is replaced with standard code, system will generate the new locationId in the LogisticsLocation(Table) and create the same duplicate address along with state, city, country, zipcode and all other respective fields. Moreover, we will just need to pass YES value to the newly created field ISCreateFromEntity while creating the new address and run the execution. How easy it is!!! Thanks for reading !!!
Deploy SSRS reports through Windows Powershell in Dynamics 365 Finance and Operations
Introduction:In this blog, we will see how to deploy SSRS reports in Microsoft Dynamics 365 Finance and Operations Solution: For on-prem environment, we will open Windows PowerShell in administrator mode and run the below scrip step by step. cd C:\AOSService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\ .\DeployAllReportsToSsrs.ps1 For online Cloudhosted/Dev environment, we will run below mentioned script cd k:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\ .\DeployAllReportsToSSRS.ps1 -PackageInstallLocation “k:\AosService\PackagesLocalDirectory” It appears as When deploying reports are completed, It looks like Thanks for reading !!!
Item Master Data Mass uploading via Data Management in Dynamics 365 Finance and Operations
Item Master Data Mass uploading via Data Management In the world of data management, it has become essential that the business users are provided solution for mass data uploading. Where the data is managed by very less expert users who’re required to upload and download data in bulk at very less given time. Today I am going to show you the way to upload Item Master Data quickly and with no errors via Data Management in MS Dynamics Commerce and Retail. Note: Masters as Item group, tax codes, units, category, item model group etc should be pre-configured or created for this to work accurately otherwise this operation will fail with errors as the masters are not created/configured. For this operation to work first we need to identify the fields that are required to do two steps. First, Item Master Creation Secondly, Item Master release in released products. So now to identify the necessary “importable” fields first we will export the required fields in excel as below. Goto Workspaces> Data Management and in Data Management click Export Button. Upon Clicking “export” create project as data filled in below. Desired Project name in my case I have named it “product master fields” Generate Data package to be set as No. Now when project is created click on “add entity” Select entity as “Released product creation V2” or anything as “Released product creation” whichever is latest according to your version of D365. Select output as “EXCEL”. Use sample file and skip staging to be set as NO. Very important step to select fields to be set as “Importable Fields” And “add” the entity to the project. Now again click on “add Entity”, select the rest of the fields as mentioned in pt. II., and select “released products V2) in entity name and click on add. Now click on export button as below Now on export screen Click on “refresh” button until you see mark on thee screen, and then “download File” to obtain excel file. Note: click each project one by one to download table fields. After downloading file replace the data with required information that you want in your product master so that we can Import the Master data. (Note: You can hide fields that doesn’t require user to input any data but are required by AX this you will identify in released products format). Assuming that you have created your files for upload we will now continue with “Import” data, Goto Workspaces > Data Management and in Data Management click “Import” Button. Upon clicking “Import” create a project and add entity as below. Add group name, in my case added as “import Master Data” Now when project is created click on “add File” Select entity as “Released product creation V2” or anything as “Released product creation” whichever is latest according to your version of D365. Click the upload data file and select the appropriate file, in my case it is “Released product creation V2 – Format.xlsx” Select “Source data format” Click close. Now again click on “add File”, select the rest of the fields as mentioned in pt. VIII., and select “released products V2) in entity name and click on Close. After adding both the files, now its time to click on “import”, but first ensure that the sequence of the below files are as such 1st for Released Product Creation and 2nd for Released products. If this is not in sequence the above operation will fail. After Clicking on Import, you will have to click on refresh button until the come. Upon success you can see the validation message that the master data has been uploaded successfully and released the product for use. In my case I had uploaded a test product which got successfully uploaded to the system. Hope this helps!
RSAT (Regression Suite Automation Tool ) implementation and configuration for Finance and Operations
Purpose The Regression suite automation tool (RSAT) significantly reduces the time and cost of user acceptance testing. This tool enables functional power users to record business tasks using the Finance and Operations Task recorder and convert these recordings into a suite of automated tests without the need to write source code. Test libraries are stored and distributed in Lifecycle Services (LCS) using the Business Process Modeler (BPM) libraries. These libraries are also fully integrated with Azure DevOps Services (Azure DevOps) for test execution, reporting and investigation. Test parameters are decoupled from test steps and stored in Microsoft Excel files. Prerequisites Dynamics 365 for Finance and Operations test environment (Demo or tier 2 UAT environment Excel Azure DevOps: You will need an Azure DevOps Test Manager or Test Plans license. For example, if you have a Visual Studio Enterprise subscription, you already have a license to Test Plans. Pricing-https://azure.microsoft.com/en-us/pricing/details/devops/azure-devops-services/ For a demo environment, you don’t need to buy any license. Authentication Certificate: To enable secure authentication, RSAT requires a certificate to be installed on the RSAT client computer. The RSAT settings dialog box allows you to automatically create and install the authentication certificate. Installation Download Regression Suite Automation Tool.msi to your machine RSAT requires Selenium and web browser driver libraries. RSAT will prompt you if needed libraries are missing and will automatically install them for you. Configuration For RSAT Open RSAT application. Select the Settings button in the upper right to configure RSAT. And next steps will help you to find those required fields input. Go to project settings of Lcs for your projects. Go to Visual Studio Team Services. Here you need to mention the Azure DevOps project in the Azure DevOps site URL field. In order to do that, click on https://www.visualstudio.com Open Azure DevOps and create a new organization if there is not an existing one. Now create a new project as shown below Now you need to set up a security token by clicking on account info>security Once you create the token, save it as you will not be able to access it again when you want to use it. Once that is done, go back to the main page and create a new test plan. Name it as RSAT-TT (or you can use any name) Now right click on RSAT-TT and create a new suite you can name it ‘Demo’. Azure DevOps setup is done. In Azure DevOps site URL mention Organization name that you set up in Azure DevOps. And in Personal access token field paste the token that you had earlier saved. Click on continue to select the project and continue, Save. Now you need to deploy it to the environment Next, open the Regression Suite Automation Tool, Go to settings in Azure Dev Ops Url field copy it from the LCS Access token should be the security token you had copied. Click on Test connection so the Project name and Test plan will populate. Now run VM. You will find Hostname and SOAP Hostname by going to IIS and then right-clicking on AOSService>Edit bindings. Copy both the Hostname and in Hostname and SOAP Hostname fields paste these values Admin username should be the username you use to login to your environment. To generate Thumbprint click on New and save at any location and then copy the generated certificate to the VM Open the copied certificate and install it to the local machine at personal and Trusted Root Certification Authorities locations.Now Open the wif file in admin mode in notepad from the given location of VM In wif file find CN name=127.0.0.1 exists or not. If not, copy the selected portion and paste it below the same authority block. Now add modify those lines as follows: <authority name=”CN=127.0.0.1″> <keys> <add thumbprint=”F46D2F16C0FA0EEB5FD414AEC43962AF939BD89A”/> </keys> <validIssuers> <add name=”127.0.0.1″ /> </validIssuers> </authority> ( Note: Add thumbprint of installed Certificate in wif as shown) Final steps include Copy thumbprint from RSAT settings (which was generated when you click on New) and paste it in wif file in your VM Then Mention the company name And Working directory Set default browser as internet explorer Save as and ok Next, Go to LCS open business process modeler and create a new Library Name it as RSAT, go to edit and rename the process as required and you may add a child node to it by clicking on the Add process. Now go to Finance and operations, go to test recorder Create recording by clicking on create a recording and perform the operation and then click on the stop button. Name it as per your need then Save it to Lifecycle services or Save this to PC option. Click ok Now go back to LCS in the project library and click on the requirement, tab check it’s syncing Now Sync test cases and VSTS sync Next, go to Visual studio DevOps, test cases, click on Add existing Then click on the run query and click on Add test case Now go to regression suite automation and load the test and download test cases. select test and click on new and generate test execution parameter files Then click on edit option for the older version to edit values in excel For older version For newer version Now edit metadata for the test in excel file and save and close Now Run the test after this step, automatic session for the test is handled by selenium where the browser will perform steps as test cases Then run the test and after it’s completed successfully click on upload (Note the result as passed)