Clik here to view.

Is your organization considering a new ERP solution in 2017? Are you located in the New England area?
If so, we invite you to join us on April 10th from 1pm – 5pm EST for our executive lunch and learn at the Microsoft Technology Center in Burlington – Digital Transformation for Growth: A First Look at Microsoft Dynamics 365 and Rapid365.
Space is limited – so reserve your spot today!
During this event you will:
Register now to reserve your spot! Or, contact Nick Sarno for more information.
The post Boston Roadshow: First Look at Microsoft Dynamics 365 and Rapid365 appeared first on Merit Solutions.
Image may be NSFW.This blog will explain how to create files and folders on SharePoint Online programmatically, using AX7 code (Dynamics 365 for Operations).
To save file, SharePointDocumentStorageProvider class should be used:
System.UriBuilder builder = new System.UriBuilder(SITE); str host = builder.Host; str extId = xUserInfo::getExternalId(); SharePointDocumentStorageProvider storageProvider = new SharePointDocumentStorageProvider(host, SITE, FOLDER_PATH, extId); //Create MemoryStream object that will hold data to upload System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); //Populate memoryStream with your file’s contents. //In the end set the position of the stream to 0 memoryStream.Position = 0; //Method SaveFile is used to create the file on SharePoint online storageProvider.SaveFile(newGuid(), NAME_OF_FILE, MIME_TYPE, memoryStream);
To create folders on SharePoint, we need access token. It can be obtained in the following way:
System.UriBuilder builder = new System.UriBuilder(SITE_ADDRESS); str host = builder.Host; str extId = xUserInfo::getExternalId(); ISharePointProxy proxy = SharePointHelper::CreateProxy(host, '/', extId); str token = proxy.AccessToken;
Access token should be passed to the following C# method:
public static ClientContext GetClientContextWithAccessToken(string targetUrl, string accessToken) { Uri targetUri = new Uri(targetUrl); ClientContext clientContext = new ClientContext(targetUrl); clientContext.AuthenticationMode = ClientAuthenticationMode.Anonymous; clientContext.FormDigestHandlingEnabled = false; clientContext.ExecutingWebRequest += delegate (object oSender, WebRequestEventArgs webRequestEventArgs) { webRequestEventArgs.WebRequestExecutor.RequestHeaders["Authorization"] ="Bearer " + accessToken; }; return clientContext; }
Method is taken from:
http://www.herlitz.nu/2012/12/30/sharepoint-2013-tokenhelper-cs-source-code/
We don’t need the whole class, just this method.
Library to use (C#): Microsoft.SharePoint.Client
The post SharePoint Online Integration with Dynamics 365 for Operation (D365FO) Upload File / Create Folder appeared first on Merit Solutions.
Image may be NSFW.A few years back, I wrote a similar blog post on developing reports in AX2012. Well, here we are now looking at reports in Dynamics 365 for Operations (AX7), and again I thought I would share my experiences. I started by … Continue reading →
The post Experiences Developing SSRS Reports in Dynamics 365 for Operations appeared first on K3 Technical Blog.
Image may be NSFW.Recently I was tasked with an upgrade of a functionality we have on AX2012 to Dynamics365, which includes running the report from the code and attaching it to the caller record. As you are probably aware of, this was very easy to accomplish in the earlier Microsoft Dynamics AX versions, where you could simply run the report to a file, save it locally and attach it to the record using the DocuActionArchive class.
Things are a bit more complicated when it comes to D365 in cloud. You are no longer able to save the file locally (for example using System.IO.Path::GetTempPath() + fileName) as storage is now moved to Azure and files are stored as a Blob. You may have also noticed that most of the classes that work with files now use stream objects with their content type instead.
In order to attach the report to a record I needed to provide a MemoryStream object which would represent my report. As I found no existing code that could provide me with the memory stream output of the report I created my own method to do this. Below is given a code (runnable class – job) to perform rendering of a report to a memory stream.
class RunReportToStream { public static void main(Args _args) { DocuRef addedRecord; ProdTable prodTable = ProdTable::find('P000173'); Filename fileName = "AbcTest.pdf"; YourReportController controller = new YourReportController(); YourReportContract contract = new YourReportContract(); SRSPrintDestinationSettings settings; Array arrayFiles; System.Byte[] reportBytes = new System.Byte[0](); SRSProxy srsProxy; SRSReportRunService srsReportRunService = new SrsReportRunService(); Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[] parameterValueArray; Map reportParametersMap; SRSReportExecutionInfo executionInfo = new SRSReportExecutionInfo(); ; _args = new Args(); _args.record(prodTable); // Provide all the parameters to a contract contract.parmProdId('P000173'); contract.parmNumberOfLabels(1); // Provide details to controller and add contract controller.parmArgs(_args); controller.parmReportName(ssrsReportStr(YourReportName, DesignName)); controller.parmShowDialog(false); controller.parmLoadFromSysLastValue(false); controller.parmReportContract().parmRdpContract(contract); // Provide printer settings settings = controller.parmReportContract().parmPrintSettings(); settings.printMediumType(SRSPrintMediumType::File); settings.fileName(fileName); settings.fileFormat(SRSReportFileFormat::PDF); // Below is a part of code responsible for rendering the report controller.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration()); controller.parmReportContract().parmReportExecutionInfo(executionInfo); srsReportRunService.getReportDataContract(controller.parmreportcontract().parmReportName()); srsReportRunService.preRunReport(controller.parmreportcontract()); reportParametersMap = srsReportRunService.createParamMapFromContract(controller.parmReportContract()); parameterValueArray = SrsReportRunUtil::getParameterValueArray(reportParametersMap); srsProxy = SRSProxy::constructWithConfiguration(controller.parmReportContract().parmReportServerConfig()); // Actual rendering to byte array reportBytes = srsproxy.renderReportToByteArray(controller.parmreportcontract().parmreportpath(), parameterValueArray, settings.fileFormat(), settings.deviceinfo()); if (reportBytes) { // Converting byte array to memory stream System.IO.MemoryStream stream = new System.IO.MemoryStream(reportBytes); // Upload file to temp storage and direct the browser to the file URL File::SendFileToUser(stream, settings.parmFileName()); stream.Position = 0; str fileContentType = System.Web.MimeMapping::GetMimeMapping(fileName); // Attach the file to a record using stream object addedRecord = DocumentManagement::attachFile(prodTable.TableId,prodTable.RecId,prodTable.DataAreaId, 'File', stream, fileName, fileContentType,"PDF file attached"); } // You can also convert the report Bytes into an xpp BinData object if needed container binData; Binary binaryData; System.IO.MemoryStream mstream = new System.IO.MemoryStream(reportBytes); binaryData = Binary::constructFromMemoryStream(mstream); if(binaryData) { binData = binaryData.getContainer(); } } }
With the output found in the code above like reportBytes, stream and binData you can do many things, like sending the report to a certain SharePoint location from code, sending the report as an email attachment from code, attaching the report to a record as a document attachment from code and I am sure that you will find many other usages.
I hope that you will find this text helpful.
The post Render report to memory stream D365 (aka AX7) appeared first on Merit Solutions.
Image may be NSFW.Hi all,
Just started to developer into AX7. Hating and loving it. I`m keeping this subject to another post though.
For the moment, let’s talk about DAX Development Util repository.
The folder directory has been updated to hold also content for our fellow consultants.
There are 2 new folders:
Obviously, you are more then welcome to contribute!
Just send a pull request or a message at anderson@joyle.com.br.
[]’s
Anderson Joyle