Dynamics 365 Archives - Page 24 of 81 - - Page 24

Category Archives: Dynamics 365

Purchase order approval through a Mobile device in Microsoft D365 Fianance and Operations

In this blog I am going to explain in brief about  the Purchase order approval mobile workspace. This workspace lets you view purchase orders and respond to them through actions. For example, you can approve or reject a purchase order. After a purchase order (PO) has been created, it might have to go through an approval process. After the vendor has agreed to the order, the PO is set to a status of Confirmed. POs that don’t use change management have a status of Approved as soon as they are created. A PO creates inventory transactions only when it reaches the Approved status. Once you’ve activated the Change management, approval workflow is introduced. As a system administrator, you must publish the Purchase order approval mobile work space To do that Click Settings> Mobile app. Select the mobile workspace to publish. Click Publish Now on your mobile go to Playstore and download Microsoft Dynamics 365 Unified Operations App Once you have downloaded the App and logged in you should see the Purchase order approval workspace on your Mobile App  

Share Story :

x++ code to import data from excel to D365 FnO

We can also import data through code in D365 FO. Data import through code in D365 works differently than Ax2012 since cloud services.  Import Class we are trying to import data from Excel to D365FO through the following code.   using System.IO; using OfficeOpenXml; using OfficeOpenXml.ExcelPackage; using OfficeOpenXml.ExcelRange;   class EmplAttendance { public void run() { this.updateDailyAttendance(); }   void updateDailyAttendance() { System.IO.Stream                     stream; ExcelSpreadsheetName            sheeet; FileUploadBuild                       fileUpload; DialogGroup                             dlgUploadGroup; FileUploadBuild                       fileUploadBuild; FormBuildControl                    formBuildControl; EmplAttendance_CFS              emplTimeAttendance, insertTimeAttendance, updateTimeAttendance; COMVariantType                     type; Dialog                      dialog =    new Dialog(“Daily Attendance Imported”);   dlgUploadGroup          = dialog.addGroup(“@SYS54759″); formBuildControl        = dialog.formBuildDesign().control(dlgUploadGroup.name()); fileUploadBuild           = formBuildControl.addControlEx(classstr(FileUpload), ‘Upload’); fileUploadBuild.style(FileUploadStyle::MinimalWithFilename); fileUploadBuild.fileTypesAccepted(‘.xlsx’);   str COMVariant2Str(COMVariant _cv) { switch (_cv.variantType()) { case COMVariantType::VT_BSTR: return _cv.bStr();   case COMVariantType::VT_EMPTY: return ”;   default: throw error(strfmt(“@SYS26908”, _cv.variantType())); } }   if (dialog.run() && dialog.closedOk()) { FileUpload fileUploadControl     = dialog.formRun().control(dialog.formRun().controlId(‘Upload’)); FileUploadTemporaryStorageResult fileUploadResult = fileUploadControl.getFileUploadResult();   if (fileUploadResult != null && fileUploadResult.getUploadStatus()) { stream = fileUploadResult.openResult();   using (ExcelPackage Package = new ExcelPackage(stream)) { int                         rowCount, i,columncount,j; Package.Load(stream); ExcelWorksheet   worksheet   = package.get_Workbook().get_Worksheets().get_Item(1); OfficeOpenXml.ExcelRange    range       = worksheet.Cells; rowCount           = (worksheet.Dimension.End.Row) – (worksheet.Dimension.Start.Row)  + 1; columncount      = (worksheet.Dimension.End.Column);     for (i = 2; i<= rowCount; i++) { str Emplid; TransDate                 WorkingDate; emplid                       = (range.get_Item(i, 1).value); WorkingDate            = str2Date((range.get_Item(i, 2).value),123);   select * from emplTimeAttendance where emplTimeAttendance.EmplId              = =  Emplid && emplTimeAttendance.WorkingDate       = =  WorkingDate;   if(emplTimeAttendance)     //if record already exists update it { emplTimeAttendance.selectForUpdate(true); emplTimeAttendance.Timein                          =   any2Str(range.get_Item(i, 3).value); emplTimeAttendance.Timeout                        =   any2Str(range.get_Item(i, 4).value); emplTimeAttendance.OT                                =  any2Real(range.get_Item(i, 5).value); ttsbegin; emplTimeAttendance.update(); ttscommit; } Else      //insert the new record { insertTimeAttendance.EmplId                         = (range.get_Item(i, 1).value); insertTimeAttendance.WorkingDate               = str2Date((range.get_Item(i, 2).value),123); insertTimeAttendance.Timein                         = any2Str(range.get_Item(i, 3).value); insertTimeAttendance.Timeout                       = any2Str(range.get_Item(i, 4).value); insertTimeAttendance.OT                                = any2Real(range.get_Item(i, 5).value); insertTimeAttendance.insert(); } } } } else { error(“Error here”); }   } }   public static void main (Args args) { EmplAttendance     emplDailyAttendanceImport;   emplDailyAttendanceImport = new EmplAttendance (); emplDailyAttendanceImport.run(); } }  

Share Story :

Customize Purchase order approval status

In the case of D365 Finance and Operations when you approve purchase requisition by default system creates Purchase order with approval status as “Approved” as follows     To change this default behavior of system such that once purchase requisition is approved the approval status of the purchase order as a draft you can use the following class class CFSPOStatus {     /// <summary>     ///     /// </summary>     /// <param name=”args”></param>     [PostHandlerFor(classStr(PurchAutoCreate_PurchReq), methodStr(PurchAutoCreate_PurchReq, endUpdate))]     public static void PurchAutoCreate_PurchReq_Post_endUpdate(XppPrePostArgs args)     {         //PurchTable  purchTable = args.getThis(‘purchTable’);         PurchAutoCreate_PurchReq purchReq = args.getThis() as PurchAutoCreate_PurchReq;         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;     } }and your final result looks like And after changing status you can apply your own purchase order workflow on it. For purchase order workflow you can refer to my blog

Share Story :

Steps to Configure Environments through Life Cycle Services (LCS)

Configuration of Environment through LCS. After we purchase licence, Login the LCS through Admin account. You can see the follow link to complete setup environment. Before configuring the environments there are some pre-requisites need to be performed. Declaration of project milestone. Click on setup milestone, Enter the end date for each milestone and save. 2. VSTS Setup. Before this we need to follow the below steps: Login in Azure DevOps. Create a project. 3. Create personal access token. Save this token. Click on “Setup Visual Studio Team Services” a.  Enter the site Enter the AzureDevOps url, which consists of https://organizationname.visualstudio.com/ and click on continue. Enter Personal access token generated above in Azure DevOps. b. Select the project Select the project from the list and click continue. c. Review and Save 3. Project configuration and project on-boarding. Click on “Complete project configuration”(This is one time setup) And click on “Project onboarding” Check all the 12 points by clicking on next and then finish the complete onboarding review page. And click on configure button of environment Enter the name of environment and select the region. Then you can see the status of environment in queued state. After 7-8 hours you can login to your environment.      

Share Story :

Nested Filters in PowerApps.

Introduction: In this blog, we will learn how to use Nested filters in PowerApps. Use Case: We have a Gallery(GalleryQuoteLineDetail) where we need to put filter which equals Quote Product selected in another Gallery. Once we get those Quote Products, we need to filter the Gallery(GalleryQuoteLineDetail) based on ‘Transaction Type’ Field,  which is a field on Quote Product. The ‘Transaction Type’ should be equal to “Project Contract”. Solution: Steps to be followed: 1. Below is the CDS Data Source, we want to filter. 2. To filter the Gallery Based on another Gallery, Use the below Formula: Items property of Gallery:      Set: GalleryQuoteLineDetail.Items: Filter( ‘Data Source’,Condition)      For eg: GalleryQuoteLineDetail.Items : Filter(‘Quote Line Detail’,’Quote Line’.’Quote Product’ =  GalleryQuoteLine.Selected.’Quote Product’)   3. To filter the Gallery Based on “Transaction Type”, Transaction Type is of Option Set Data Type, Use the below Formula: Items property of Gallery:      Set: GalleryQuoteLineDetail.Items : Filter( ‘Quote Line Detail’,  ‘Transaction Type’ in “Project Contract” ) 4. To Combine both the Filters in a single Formula, use the first filter as ‘Data Source’ of the second filter: Following is the formula:  Filter( Filter (‘Quote Line Detail’, ‘Quote Line’.’Quote Product’ =  GalleryQuoteLine.Selected.’Quote Product’ ), ‘Transaction Type’ in “Project Contract” )   Conclusion: Hope this Blog helps you to combine multiple Filters into single Filter.

Share Story :

Generic way of Attaching Documents on any Record of the Page in Microsoft Dynamics Business Central – Template Code

Problem Statement: In Microsoft Business Central, there is a way to attach attachments only on Documents or Master Table records. But, what if this requirement is for other tables such as Opportunities, custom tables, etc. Introduction: I have seen many developers afraid to touch the attachment-related customization as it seems complicated. Well, I have found a solution and here it goes. In this blog, I’m attempting to create a generic template for code that needs to have an attachment feature on any table that you like using AL Code. This means that you simply cannot copy-paste the same code for all the tables but a simple change in variable sub-type will ease your work significantly Pre-requisites: Microsoft Dynamics Business Central VS Code Al Language Extension Source Code: https://github.com/olisterr/Generic-Attachment-Template Demonstration: 1. How it works: Document Attachment is a table which stores a few things that help in tracking information related to the attachment Document Attachment Table Fields The main unique thing that works for all the different tables is the TableID, Line No and No. fields. Along with this, the document is attached through a stream inside a Media DataType. There are 2 important functions 1. SaveAttachment2 : This function takes a few parameters RecRef for origin Table ID, FileName to store the file name, Blob which will be imported a Stream in Document Reference ID Media type field, Recs.No which will store the unique record for which the attachment is attached. This function when the line has no attachment attached to it. This is done by checking if the field Document Reference ID has no value. SaveAttachment2   2. Export2: This function exports the attached BLOB to a file. This is done if the Document Reference ID field has any value. Export2 This is both functions are complimentary of each other and are trigger on FileName field DrillDown DrillDown to Attach OR Export   2. Things that you need to change: Either you are using the Generic Attachment Template code first time or mulitple times in the same project, you need to find //Change the Table Name Here—-OLISTER and //Change the Page Name Here—-OLISTER comment and replace your table name. Also, you will need to manage with the PageName and IDs. Read through README.TXT in the project. README.TXT   3. Custom Attachments for multiple tables: In the above case, I have created the code for the Opportunity Card page. I will repeat the same for Item Card Page. Prior to Items Card Page Make a copy of all the 3 Pages and change their names and Ids. After adding a new set of pages for different tables Change the Table Nos on the comment line //Change the Table Name Here—-OLISTER and //Change the Page Name Here—-OLISTER After changing Table Names After changing Page Names After changing Part Page Names 4. Output: Finally, I got this. Opportunities Attachment Items Attachment   Conclusion: Thus, we are successful in creating a generic code template for attachments. Hope this helps!

Share Story :

Displaying D365 CRM Plugin Messages in Canvas Power Apps using Power Automate

Posted On February 22, 2020 by Admin Posted in

Introduction  This blog demonstrates one of several ways to display Business Validation Message to be rendered as Errors in Canvas Apps when User Create or Update record in Canvas Power Apps.  Scenario  Developers need to show Validation Messages thrown by D365 CRM Plugin to be rendered as Errors in Canvas Power Apps where D365 records are created or updated by using Power Automate.  Steps  Below are steps needed to be followed to display Error Messages.  Create variables for Message & MessageType of type String and initialize default value as a successful scenario for record creation in D365 as below Set Variable VarMessageType should run after your CDS Action has failed Set Variables for the Error scenario with below settings MessageType – ‘2’  Message – message attribute of a body for action of CDS  Add action Respond to PowerApp or Flow with output as below Set Action Respond to a PowerApp to run after successful or skipped Handle the MessageType return in Save Action button in Power Apps. Note:   You can set only 1 Response to a PowerApp action in single Power Automate.  Conclusion : Hope above blog gives an option for Error handling in Power Apps for records created using Power Automate. 

Share Story :

[SOLVED] Root Web Page is not getting created in D365 Portals

Introduction In this blog, we will look into how to resolve the “Root Web Pages are not getting created in D365 Portal” issue. Whenever we create a new web page in a portal its root web page automatically gets created and this root page renders entity forms, entity list or web form on the portal. In one of our environments, root web pages were not getting created automatically. We followed the steps below to resolve this issue. Steps Navigate to Customizations -> Customize the system => Default solution will open Select SDK message processing steps Change the view to “All” Filter by primary object type begins with “web page” This would show 10 sdk message processing steps, select all and activate these steps. After this root web page will get created successfully.

Share Story :

Adding “Change Password” in Profile Navigation of D365 Portal.

Introduction This blog explains how we can add “Change Password” in the Profile navigation of the D365 Portal. Steps to be followed: Go to Weblink sets 🡪 Profile Navigation Open Profile Navigation record 3. Click on the “Links” tab. Add “+ New Web Link” 4. Add below details in the form Name: Change Password Web Link Set: Profile Navigation Publishing State: Published External URL: <portal url>/en-US/Account/Manage/ChangePassword Display Order: 2 5. Save the record. 6. Now you can see the “Change Password” option in the profile navigation of the portal. NOTE: if you don’t see the changes clear the cache of the portal and check again. – Click on “Change Password” and it will navigate you to the page below. – You can change your password from here.

Share Story :

Save standardized PDF documents from D365 Sales into Microsoft SharePoint Released in Wave 1 2020

Introduction : This Blog will explain about Saving PDF documents directly to SharePoint in a Single Click and this is available for entities listed below only Account Contact Opportunity Lead Quote Order Invoice   Steps to enable Entities for PDF generation: Note : Before starting make sure wave 1 2020 feature is enable in Sandbox. Go to Sales hub -> App settings -> and Convert to PDF.  2. Click on Manage -> Enable entities and save. PDF Creation: Once we have enabled entities,  “Create PDF” button will be enabled as shown below : 2. When you click on Document , option will be shown to save the document in SharePoint. If we want to save the Document , Click on Save. Else Document will be downloaded. 3. We can view the saved Document by browsing to Related>>Documents in Dynamic CRM. Also we can view the Documents in the SharePoint. Conclusion : This feature will be helpful for Sales Team to increase Productivity.

Share Story :

SEARCH BLOGS:

[gravityform id="36" ajax="true"]

FOLLOW CLOUDFRONTS BLOG :