Tag Archives: development
Find Your Element’s Project in Visual Studio for Finance and Operations Developers
In Finance and Operations development, it’s common for the same object to be referenced across multiple projects for different purposes. For example, one developer might have created the object in Project A, another could be using it with slight modifications in Project B, and yet another might be working on bug fixes for the same object in Project C. In such cases, the original logical grouping of the object—essentially the reason for creating a project—can become unclear. Unfortunately, Visual Studio does not provide a built-in method to identify all the projects an element belongs to. In this blog, we’ll explore how to determine the projects associated with a specific element. Steps 1. Go to the root of your projects folder in File Explorer. This will generally be the “C:\Users\<Username>\source\repos” folder. 2. Open a command prompt from this window by typing CMD in the address bar. 3. Type “dir /s /b *.rnrproj > projectslist.txt” this will generate a text file containing the addresses of all the project files in your selected folder. 4. Type “findstr /f:projectslist.txt /m Name_Of_Your_File”, this will return a list of all the projects which contain a file with the selected name. 5. You can also use regular expressions in FindStr to further narrow down the file you want. Conclusion Identifying which projects reference a specific file in Finance and Operations can be a challenging task, especially when dealing with large and complex solutions.By leveraging simple command-line tools like dir and findstr, developers can efficiently locate project dependencies without relying on Visual Studio’s limited search capabilities. This approach not only saves time but also provides greater flexibility through the use of regular expressions, allowing for more refined searches.Whether you’re debugging, modifying, or reorganizing your codebase, this method ensures you maintain better control and organization over your projects. If you need further assistance or have specific questions about your ERP setup, feel free to reach out for personalized guidance. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Develop Custom Workflow:Counting Journals workflow
In this blog, you will learn how to develop a custom workflow that is not present out of the box in D365 Finance. For this blog I’m creating a workflow for Counting Journal (Inventory management>>Journal Entries>>Item Counting>>Counting) because there is no such workflow for inventory management module. The followings are steps that are to be followed. Steps:- 1. Create a base Enum for Document Status 2. Create a table extension and add Enum to table 3. Add document status field to form extension 4. Create query 5. Create workflow category 6. Create a workflow type 7. Now add can submit workflow and updateworkflow methods to tables class extension 8. Update submitmanager class 9. Update EventHandler class 10. Workflow approval creation 11. Add an element to workflow Type 12. Now add workflow setup form to the inventory management module Now we are performing steps in detail 1. Create a base enum for Document Status Make sure you have created a solution, project and assign the model to the project. Now add new item and select Base Enum. And Add Base Enum and name it as CFS_InventoryCountingWorkflow 2. Create a table extension and add enum to table We are creating a workflow for inventory management so we need to create an extension of InventoryJournalTable and drag above created base enum to table which will create a new field of type Enum. 3. Add Document status field to form extension Now we need to create an extension of form InventJournalCount and add newly created table field to forms grid by dragging it from data source to form grid control and assign label as approval status. 4. Create query Now again add a new query to project and name it as CFS_InventoryCountingWorkflow and add the InventJournalTable and set properties as follows 5. Create workflow category Now we are going to add Workflow category to project and name it as CFS_InventJournalCounting and set the properties as follows 6. Create a workflow type After adding workflow category its time to add workflow type name it as CFS_InventoryJournalCounting and set its properties as follows this will create new elements such as classes and action menu items for submit and all actions. 7. Now add can submit workflow and updateworkflow methods to tables To add a method to the table we need to create a table class extension for that add a new class and name it as InventJournalTable_CFSExtension and need to add updateWorkflow and canSubmitWorkflow methods. You can use the following code [Extensionof(tableStr(InventJournalTable))] final class InventJournalTable_Extension { public boolean canSubmitToWorkflow(str _workflowType) { boolean ret = next cansubmitToWorkflow(_workflowType); ret = this.CFS_InventoryCountingWorkflow == CFS_InventoryCountingWorkflow::Draft; return ret; } public static void updateWorkflowStatus(RecId _documentRecId, CFS_InventoryCountingWorkflow _status) { ttsbegin; InventJournalTable document; update_recordset document setting CFS_InventoryCountingWorkflow = _status where document.RecId == _documentRecId; ttscommit; } } 8. Update submitmanager class Make sure you have the same name for submitting manager class or rename it as follows and following code to that public class CFS_InventoryJournalCountingSubmitManager { private InventJournalTable document; private WorkflowVersionTable versionTable; private WorkflowComment comment; private WorkflowWorkItemTable workItem; private SysUserId userId; private boolean isSubmission; private WorkflowTypeName workflowType; public static void main(Args args) { // TODO: Write code to execute once a work item is submitted. if (args.record().TableId != tableNum(InventJournalTable)) { throw error(‘Error attempting to submit document’); } InventJournalTable document = args.record(); FormRun caller = args.caller() as FormRun; boolean isSubmission = args.parmEnum(); MenuItemName menuItem = args.menuItemName(); CFS_InventoryJournalCountingSubmitManager manager = CFS_InventoryJournalCountingSubmitManager::construct(); manager.init(document, isSubmission, caller.getActiveWorkflowConfiguration(), caller.getActiveWorkflowWorkItem()); if (manager.openSubmitDialog(menuItem)) { manager.performSubmit(menuItem); } caller.updateWorkflowControls(); } /// <summary> /// Construct method /// </summary> /// <returns>new instance of submission manager</returns> public static CFS_InventoryJournalCountingSubmitManager construct() { return new CFS_InventoryJournalCountingSubmitManager(); } /// <summary> /// parameter method for document /// </summary> /// <param name = “_document”>new document value</param> /// <returns>current document</returns> public Inventjournaltable parmDocument(Inventjournaltable _document = document) { document = _document; return document; } /// <summary> /// parameter method for version /// </summary> /// <param name = “_versionTable”>new version table value</param> /// <returns>current version table</returns> public WorkflowVersionTable parmVersionTable(WorkflowVersionTable _versionTable = versionTable) { versionTable = _versionTable; return versionTable; } /// <summary> /// parameter method for comment /// </summary> /// <param name = “_comment”>new comment value</param> /// <returns>current comment value</returns> public WorkflowComment parmComment(WorkflowComment _comment = comment) { comment = _comment; return comment; } /// <summary> /// parameter method for work item /// </summary> /// <param name = “_workItem”>new work item value</param> /// <returns>current work item value</returns> public WorkflowWorkItemTable parmWorkItem(WorkflowWorkItemTable _workItem = workItem) { workItem = _workItem; return workItem; } /// <summary> /// parameter method for user /// </summary> /// <param name = “_userId”>new user value</param> /// <returns>current user value</returns> public SysUserId parmUserId(SysUserId _userId = userId) { userId = _userId; return userId; } /// <summary> /// parameter method for isSubmission flag /// </summary> /// <param name = “_isSubmission”>flag value</param> /// <returns>current flag value</returns> public boolean parmIsSubmission(boolean _isSubmission = isSubmission) { isSubmission = _isSubmission; return isSubmission; } /// <summary> /// parameter method for workflow type /// </summary> /// <param name = “_workflowType”>new workflow type value</param> /// <returns>current workflow type</returns> public WorkflowTypeName parmWorkflowType(WorkflowTypeName _workflowType = workflowType) { workflowType = _workflowType; return workflowType; } /// <summary> /// Opens the submit dialog and returns result /// </summary> /// <returns>true if dialog closed okay</returns> protected boolean openSubmitDialog(MenuItemName _menuItemName) { if (isSubmission) { return … Continue reading Develop Custom Workflow:Counting Journals workflow
Visual Studio Tip
Finance and operations departments in a company are quite crucial as they help the business to flourish and reach heights. Companies, therefore, should do everything from their end to better the processes in these departments. Using an ERP solution is one of the wisest and best ways to do this job. Dynamics 365 for finance and operations is one of the best enterprise resource planning solutions that you can find in the market. It is one of the best products that Microsoft has created. They offer some of the best features which you cannot find any other ERP software that you find in the market. But, if you want to enjoy the benefits that come from using this system, you should first learn how to use this software. Here is one more tip that will help you become efficient. Many of us use Visual Studio for development whether we are developing it Using physical machines or virtual machines. While making any changes to existing code or to save your changes we must have to run VS with administration permission. So every time you right-click on file shortcut and select Run as administrator. So I came up with an inbuilt option in Microsoft Windows operating system after which you don’t have to repeat the steps which are mentioned above. Steps are as follows:- Right-click on your Visual Studio shortcut and select properties. Select the ” Advanced” option. Tick on Check-Box for Run as Administrator and click on ok button. Click on the “Apply” button. And Then click on the “Ok” button. Now you are all set, Every time you open Visual Studio it will open with administrator permissions.