Go to System administration >> Setup >> Email >> System email templates
Create New template
Go to System administration >> Setup >> Email >> System email templates
Create New template
Export data entity through X++ in D365 FO.
public final class ExportEntity { public static void main(Args _args) { #dmf Query query; DMFEntityName entityName = "Batch groups"; SharedServiceUnitFileID fileId; // Update query // query = new Query(DMFUtil::getDefaultQueryForEntity(entityName)); query = new query(dmfutil::getDefaultQueryForEntityV3(entityname)); querybuilddatasource qbds = query.datasourcetable(tablenum(BatchGroupEntity)); sysquery::findorcreaterange(qbds, fieldnum(BatchGroupEntity, ServerId)).value("Batch:DEMO"); // Export file DMFDefinitionGroupName definitionGroupName = 'BatchGroupEntityExport'; try { DMFEntityExporter exporter = new DMFEntityExporter(); //There are optional parameters also added fileId = exporter.exportToFile( entityName, //Entity label definitionGroupName, //Definition group '', //ExecutionId group 'CSV', // or 'XML-Element',//Source format to export in #FieldGroupName_AllFields,//Specify the field group fields to include in export. query.pack(), //Query criteria to export records curExt(),// null, //List of XSLT files true, //showErrorMessages false); //showSuccessMessages if (fileId != '') { //Get Azure blob url from guid str downloadUrl = DMFDataPopulation::getAzureBlobReadUrl(str2Guid(fileId)); System.Uri uri = new System.Uri(downloadUrl); str fileExt; if (uri != null) { fileExt = System.IO.Path::GetExtension(uri.LocalPath); } Filename filename = strFmt('CustomerPaymentData%1',fileExt); System.IO.Stream stream = File::UseFileFromURL(downloadUrl); //Send the file to user File::SendFileToUser(stream, filename); // Below code will delete the export group. //DMFDefinitionGroup::find(definitionGroupName, true).delete(); } else { throw error("The file was not generated succefully. See execution log"); } } catch { throw error("DMF execution failed"); } } }
Encryption And Decryption Using A Symmetric Key(AES) using x++.
I received a requirement to generate an XML file with encrypted data using a symmetric key. The recipients on the other side will decrypt the text using the same symmetric key. To test this, I used a dummy value such as 'RRR'.
To achieve this, I wrote the code in C# and added the resulting DLL to my project references.
C# Code:
using System; using System.IO; using System.Security.Cryptography; using System.Text; namespace EncryptionDecryptionUsingSymmetricKey { public class AesOperation { public static string EncryptString(string key, string plainText) { byte[] iv = new byte[16]; byte[] array; using (Aes aes = Aes.Create()) { aes.Key = Encoding.UTF8.GetBytes(key); aes.IV = iv; ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, aes.IV); using (MemoryStream memoryStream = new MemoryStream()) { using (CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, encryptor, CryptoStreamMode.Write)) { using (StreamWriter streamWriter = new StreamWriter((Stream)cryptoStream)) { streamWriter.Write(plainText); } array = memoryStream.ToArray(); } } } return Convert.ToBase64String(array);// It will convert bytes to string } public static string DecryptString(string key, string cipherText) { byte[] iv = new byte[16]; byte[] buffer = Convert.FromBase64String(cipherText); // It will convert string to bytes
using (Aes aes = Aes.Create()) { aes.Key = Encoding.UTF8.GetBytes(key); aes.IV = iv; ICryptoTransform decryptor = aes.CreateDecryptor(aes.Key, aes.IV); using (MemoryStream memoryStream = new MemoryStream(buffer)) { using (CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, decryptor, CryptoStreamMode.Read)) { using (StreamReader streamReader = new StreamReader((Stream)cryptoStream)) { return streamReader.ReadToEnd(); } } } } } } }
X++ Code:
b14ca5898a4e4133bbce2ea2315a1916
Using EncryptionDecryptionUsingSymmetricKey; internal final class TestRunnableClass1 { public static void main(Args _args) { str key = "b65ff7654brt8799fghj4ed7892b6798"; str text = 'RRR'; str encryptedString = AesOperation::EncryptString(key, text); info(encryptedString); str decryptedString = AesOperation::DecryptString(key, encryptedString); info(decryptedString); } }
References Ref1 Ref2
First You need to insure that Multi Select for Button is True
You are getting 'The remote certificate is invalid according to the validation procedure.'
Error show with all reports and tired Rotate SSL Certificate but not complete.
Navigate to Lifecycle Services.
In the Shared Asset library, click the Model
Download the Renew WinRM certificate folder
RDP to the environment
Extract the zip file to a local folder
Open mmc.exe and add Certificate snap-in (Computer)
Open Personal\Certificates and locate the certificate with your VMs name which should have the expiration date passed
Browse to the RenewWinRMCertificate folder that was previously created from extracting the zip file
Select File > Open Windows PowerShell with elevated privileges (Run as Administrator)
Run .\VirtualMachine-RegenerateWinRMCertificate.ps1 from the folder
Refresh the Certificates console and confirm the Certificate has been created and the expiration date is now valid. (Optional: Delete expired certificate to avoid confusion)
Restart the Environment from LCS (Stop \ Start)
In LCS select Maintain > Rotate secrets
Select 'Rotate the SSL certificates'