Tag Archives: D365
Populate Signature In Word Template using Cloud flows
Let see how we can populate signature from CRM to Word Template using Cloud flows First we need to understand how to create word template with Content Controls – Create Word Template with Content Controls In Word Document, Select Developer Tab Under the Developer Tab, Insert picture control After Inserting a picture control, Click on Properties -> Name the Title and Tag according to your requirement. In my case I have named title and Tag as Signature. Now we have created a Word Document with content controls. Upload this document in your SharePoint 2. Populate Signature Field using Cloud flows Signature field in CRM is pen control and when we run a flow, we get the field as below Split the above field by “,” Use below expression – split(triggerOutputs()?[‘body/cf_signature’],’,’) Output of above expression – Initialize a variable of type Object and set the Object as shown below- Content is output of split,To get the output of split expression, use below outputs(‘Compose_2’)[1] Syntax – outputs(<stepname>)[position of array] And save the object in a Compose Populate a Microsoft Word Template Add action “Populate a Microsoft word template” in flow Create File in SharePoint File Content of Create file step is the output of Populated Word Template Input – Output –
D365FO – HTTP Error 503. The service is unavailable
Introduction: In this blog, we will see how to resolve HTTP Error 503 – The service is unavailable in Microsoft Dynamics 365 Finance and Operations Details: For resolving these kinds of errors, we have 2 solutions as of now. One is to do from the front end that is LCS and the second is to do from the back-end that is from Visual Studio From LCS: Reset the IIS from the LCS. Steps: 1. Go to LCS, login 2. Select the respective project, full details 3. Go to Maintain -> Restart service 4. Select IIS and confirm it 5. Wait till the service is being restarted From Visual Studio: From the back-end, open the VM and follow the below steps: 1. Login to VM 2. Open the Visual Studio 3. Go to Dynamics 365 tab 4. Click on Restart IIS Express That’s it. Build the project and go to the frontend and check the output how it looks like. 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”
D365 Finance and Operations – Database Synchronization using PowerShell
Introduction: In this blog, we will see how we can synchronize the database through PowerShell in Microsoft Dynamics 365 Finance and Operations Steps: K:\AOSService\webroot\bin\Microsoft.Dynamics.AX.Deployment.Setup.exe -bindir “K:\AosService\PackagesLocalDirectory” metadatadir “K:\AosService\PackagesLocalDirectory” -sqluser “axdbadmin” -sqlserver “.” -sqldatabase “AxDB” -setupmode “sync” -syncmode “fullall” -isazuresql “false” -sqlpwd “*” -logfilename “H:\MSSQL_LOGS\AxDB_log.log” Example: K:\AOSService\webroot\bin\Microsoft.Dynamics.AX.Deployment.Setup.exe -bindir “K:\AosService\PackagesLocalDirectory” metadatadir “K:\AosService\PackagesLocalDirectory” -sqluser “axdbadmin” -sqlserver “.” -sqldatabase “AxDB” -setupmode “sync” -syncmode “fullall” -isazuresql “false” -sqlpwd “AOSWebSite@123” -logfilename “H:\MSSQL_LOGS\AxDB_log.log” 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”
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”
Rest API GET call in JSON format in Dynamics 365 Finance and Operations
Introduction: In this blog, we will see how to get response from Rest Api through GET call Solution: Consisting of basic authentication, we will pass username and password in byteStr and for the endpoint we will put it in url in below code. class CFSJSTestRestAPI { public static void main(Args _args) { int find; str url,aosUri,activeDirectoryTenant; str activeDirectoryClientAppId; str activeDirectoryClientAppSecret; str postData,activeDirectoryResource; str aadClientAppSecret,oAuthHeader; str returnValue,jsonString,jsondszstr; System.Net.HttpWebRequest request; System.Net.HttpWebResponse response; System.Byte[] byteArray; System.IO.Stream dataStream; System.IO.StreamReader streamRead; System.IO.StreamWriter streamWrite; System.Net.ServicePoint servicePoint; System.Net.ServicePointManager servicePointmgr; System.Net.HttpVersion version; CLRObject clrObj; Newtonsoft.Json.JsonReader reader; System.Text.Encoding utf8; Counter countCounter; Object obj; Map data; System.Byte[] byteArraynew; System.Net.WebHeaderCollection headers = new System.Net.WebHeaderCollection(); new InteropPermission(InteropKind::ClrInterop).assert(); str byteStr = strfmt(‘%1:%2’, “USERNAME”, “PASSWORD”); headers = new System.Net.WebHeaderCollection(); url = “http://dummy.restapiexample.com/api/v1/employees”; clrObj = System.Net.WebRequest::Create(url); request = clrObj; request.set_Method(“GET”); request.set_KeepAlive(true); request.set_ContentType(“application/json”); utf8 = System.Text.Encoding::get_UTF8(); byteArraynew = utf8.GetBytes(byteStr); byteStr = System.Convert::ToBase64String(byteArraynew); headers.Add(“Authorization”, ‘Basic ‘ + byteStr); request.set_Headers(headers); servicePoint = request.get_ServicePoint(); System.Net.ServicePointManager::set_Expect100Continue(false); System.Net.ServicePointManager::set_SecurityProtocol(System.Net.SecurityProtocolType::Tls12); response = request.GetResponse(); dataStream = response.GetResponseStream(); streamRead = new System.IO.StreamReader(dataStream); jsonString = streamRead.ReadToEnd(); info(strFmt(“RESPONSE: %1”,jsonString)); dataStream.Close(); response.Close(); } } Thanks for reading !!!
Table Browser Extension for Google Chrome | D365
Now table browser becomes much easier for Microsoft Dynamics 365 Finance and Operations. Here you go with Google Chrome Extension – Table browser caller for D365FO. It’s very easy to install and use it. After installing the extension to the browser, it appears on the top bar and looks like While clicking on the extension, You can find the tab named with config where you need to put the URL of the respective environment and save it. Once config is setup, you need to go to the main tab that is Table Browser Caller as shown in above figure where you would setup mainly: Search for table name: name of the table Company Id: name of the legal entity After that, you need to find the table in the search box and just press the Enter key. And you will be redirected to the table in the new tab. In addition, Table browser has also few other features like Browse all table lists Browse all data entities 1. For getting the list of tables you need to click on Table list: Result as, 2. For getting the list of data entities you need to click on Data entities: Result as,
Create security role in D365 Finance and operation
In D365 Finance and Operations when you need to provide and restrict users from a certain operation you can make use of security roles. You can create security roles from Finance and operations environment itself or from its development tool i.e Visual Studio. In this blog, we are going to create a security role in Visual Studio as follows. Create privilege First of all we need to create privilege as follows now we need to add new entry point and set object type in our case display menu item from properties Now add object name(display menu item name) as follows create role Now we need to create role where above created privilege will be needed create new security role as follows now we need to add new privilege in role as shown And from properties select privilege which we have created in previous step Create Duty Now we have to create new duty and assign previously created privilege in its properties as shown Now we can see security role in FnO environment select any user from system administration>>users and click on assign role as follows and now search for priviously created role and click on Ok button now your security role is assigned to user with our role will be able to see the object like form, report etc except user with system administrator.
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(); } }
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
Overview of Modern POS with Retail Store Scale Unit (RSSU)
Retail Store Scale Unit allows retailers to sell products within store locations that have internet connectivity issues, where it fails to connect with headquarters (HQ). Retail Store Scale Unit support both Modern POS and Cloud POS within the store. MPOS with Retail Store Scale Unit allows users to perform cross-terminal scenarios across multiple POS devices, like Suspend Shift Close Shift Blind Close Shift Manage Shift Inventory Lookup Stock Count Print X-Report Print Z-Report whereas Cloud-based MPOS offline fails to perform these operations. MPOS with Retail Store Scale Unit fails to perform real-time operations such as Issue/pay Gift Cards Issue Loyalty Card Picking and Receiving Pay by Customer Account Credit Card transactions Order Fulfillment View/Create Time clock entries unless there is internet connectivity to HQ or a payment provider. If most of your transactions involve real-time transactions, then your Store Scale Unit will always need internet connectivity to enable the connection to HQ or payment provider.