Creation of a new Role Center and assigning it to a user as a profile in Microsoft Dynamics Nav 2017
Introduction: This article focuses on how to create a Role center page and assign the role to a user as a user profile. The requirement was such that the user needs a Role center for the HR where the HR can view the Active, Inactive and Terminated employees and can also view the List of employees, Leave application list etc. Pre-requisites: Microsoft Dynamics NAV 2017 Steps: 1. Create a query with Data Source as Employee Table, create a filter field Status, here status is a option field which has three options -Active, Inative and Terminated.Create a column field and set Method type as Totals and Method as Count. 2. Create a table with name e.g. HR Cue table. Here set the fields FieldClass to Flowfield and CalcFormula to Count. 3. Create a global function CountOrders and define the query in the variables. Here in the function, depending on the field number selected, it calls the query and sets the status to it. 4. To display Cues on the Role centre, we need to create a Page with Group subtype as CueGroup. 5. Use CueSetup codeunit for setting up cues and create an action Setup Cues. Create a local function CalculateCueFieldValues which checks if the field is active then it calls the global function CountOrders of HR Cue Page. 6. Create a Control Action as New Employee and set RunPageMode to Create and Run Object to Page Employee card. On running the cue Page 7. Create a new page for the Role Center with container subtype RoleCenterArea. 8. In Action Container subtype create HomeItems and add Action List. 9. In the Windows client, create a new Profile HR 10. Browse to the User personalization in the search bar in windows client , select the user HR and assign the HR Profile to it. 11. Log in to the Windows client/Web client.
Share Story :
To restrict an action button to a particular user in NAV 2017
Introduction: This article focuses on how to restrict other users and allow only a particular user to user a specified action button in a Page in NAV 2017. The requirement was such that the page Purchase quote is to be signed off by the CEO and then Purchase order is created. Here, an action button is created called Sign off, where on click of the button, the boolean field called Sign off which is an un-editable field is enabled. Only the CEO should have the access to Sign off the Purchase Quote. The other users should be restricted from signing off the Purchase Quote Pre-requisites: Microsoft Dynamics NAV 2017 Steps: 1. In the NAV Development Environment, create a Boolean field. e.g CEO in the User Setup table. 2. Add this field to the User setup page and enable this field for the CEO user. 3. Create a button Sign off in the purchase quote. Create a new codeunit and subscribe it to the action button Sign off. 4. Create a global variable User Setup in the codeunit and refer the below code. 5. In the Windows client/Web Client, browse to Purchase Quote from the search bar. 6. Edit any Purchase Quote and click on Sign off. Here if the User is not the CEO, in the above image the user is OETIADMIN ,a message is displayed ‘Only the CEO can Sign off this purchase document’ 7. If the User is the authorize user to sign off in this case the CEO then the message is displayed as Purchase Quote is signed off.
Share Story :
Send Email with attachment to the vendor as a response in Purchase order workflow in NAV 2017
Introduction: In this article, a workflow response is created in the standard purchase order workflow. This response sends an email to the vendor after release of the purchase order i.e when the send approval request of the purchase order is approved by the authorized approver, the status of the purchase order changes to Released afterwhich an email is sent with attachment in a .pdf format to the vendor. Pre-requisites 1.Microsoft Dynamics NAV 2017 Steps: 1. Configure smtp mail setup in the front end where you need to enter the sender’s email id and password. 2. Now to create a workflow response we need to create a global function in a new codeunit. Navigate to View tab select C/AL Globals or (Ctrl+G). click on the functions tab and under the Name type the function name, by default the function is a local function. 3. To make it a global function, select the function ‘SendEmailCode’ and click on view tab then click on properties. Set the Local to No, this will make the function global. Now click on the function then click on Locals button placed on the right side. Click on the return value tab and set return type as code and length as 128. This function calls another function ‘SendEmail’ 4. Create another global function with another name in this article I’ve used ‘SendEmail’. Set parameter to the record ‘Purchase Header’ and enable it as a variable. 5. In the below code, we first fetch the vendor email id and set it to a variable VendEmail. We use the FileManagement codeunit and set the ServerTempFileName as a ‘pdf’ file. We then save the report as pdf file. We then use SMTPMail codeunit, The SMTPMAIL.CreateMessage sets the sender’s email id and recepients email id, subject of the email SMTP.AddAttachment function attaches the purchase order in a .pdf format. In SMTPMail.AppendBody function we can specify the body of the email. SMTP.Send functions sends the email. 6. Now the response created of sending email to the vendors need to be added to the workflow response library. Create a global function, in the properties of the function click on the event field and select subscriber. In the Event Publisher object select the Workflow Response Handling codeunit (codeunit no. 1521) In the Event Function field select OnAddworkflowResponseToLibrary. Select the function and click on the Locals button and in the variables tab, create a variable for codeunit Workflow Response Handling. In the below code, we add the response to workflow library with name SendEmailVendor. This name is a text constant 7. Now to execute the response we need to create a global function. Create a global function, in the properties of the function click on the event field and select subscriber. In the Event Publisher object select the Workflow Response Handling codeunit (codeunit no. 1521) In the Event Function field select OnExecuteWorkflowResponse. In the Locals for this function, in the variable tab create a variable for the record ‘workflow response’. 8. In the Dynamics NAV front end , navigate to workflows from the search bar. In the purchase order approval workflow, add the response ‘Send Email To Vendor’ then enable the workflow. 9. Navigate to Purchase order from the search bar and click on Send approval request button on the menu bar. 10. The email is sent to the vendor.
Share Story :
Import a .csv file for Bank Reconciliation in Dynamics NAV 2017
Introduction: This article gives a step by step process to import a .csv file in Dynamics NAV 2017 for Bank Reconciliation. Pre-requisites: Microsoft Dynamics NAV 2017 Microsoft Excel Steps: 1. Browse to Data Exchange Definition page, and click on new to create a new data exchange setup. This setup enables us to import a specified bank statements file. 2. In the new ‘Data Exchange Definition’ enter the code and name. File type – Variable Text Type – Bank Statement Import Reading/Writing Xml Port – 1220 Ext Data Handling Codeunit – 1240 And in the Line definition enter the code, name and the column count 3. Enter the column definition and associate appropriate data types. The columns are from the bank statement file which we need to map to Microsoft dynamics NAV. Go to Column definitions for Data Exchange Definition, and make sure Data Format has an uppercase M. 4. Now click on the ‘Field Mapping’ button in the Line definition tab. 5. The Data exchange Mapping window opens, click on new and enter the details Table Id: 274 Mapping codeunit:1248 And give a Name to the Mapping. In the Field Mapping tab, select the column number and map it with the appropriate field Id. 6. Now in the search bar of the NAV Windows client, browse to Bank Export-Import setup and click on new and enter the details, fill the entries for code, name Direction – Import Processing Codeunit Id – 1270 In the Data Exchange Definition code, select the drop down to the Data exchange definition created and click on OK. 7. Browse to ‘Bank account’ from the NAV Windows Client and select the bank where you want to import the bank statement. Click on Edit. In the Bank Statement Import format of the Transfer tab, select the bank import set up created. 8. Browse to the Bank account Reconciliation page and click on new, select the bank account where the Bank statement Import Format is assigned. 9. Click on the Import Bank Statement button under the Home tab. 10. Select the CSV file of the bank statement. 11. The Bank statement will be imported and you can view the changes in the Bank statement Lines tab.