Preview:
 #DMF
        SharedServiceUnitFileID fileId;
        DMFDefinitionGroupName definitionGroupName = "MyUniqueDefinitionGroupName";

        try
        {
            str x = "#FieldGroupName_AllFields";


            EntityName      entityName;
            DMFEntity       dmfEntity;


            select firstonly dmfEntity  order by EntityName asc where dmfEntity.TargetEntity == dataEntityViewStr(SalesOrderV3Entity);

            entityName = dmfEntity.EntityName;

            Query                query = new Query(DMFUtil::getDefaultQueryForEntity(entityName, "ExportTest"));

            DMFEntityExporter exporter = new DMFEntityExporter();
            fileId = exporter.exportToFile(entityName,
                                definitionGroupName,
                                '', //Optional: ExecutionID
                                "XML-Attribute", //Optional::SourceName
                                x, //Optional field selection
                                query.pack(), //Optional: Filtered Query
                                curExt() //Optional: DataAReaId
                                );


            if (fileId != '')
            {
                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('MyFirstExport%1',fileExt);
                System.IO.Stream stream = File::UseFileFromURL(downloadUrl);
                File::SendFileToUser(stream, filename);

            }
            else
            {
                throw error("DMF execution failed and details were written to the execution log");
            }
        }
        catch
        {
            error("error occurred while exporting");
        }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter