Hi All
I am following the Link "https://community.dynamics.com/365/financeandoperations/b/365operationswithsukrut/posts/d365fo-use-of-fileupload-control-to-read-csv-file" to create code to upload CSV file and read information. My code is in below. My understanding is when code is running Dialog(), it will show me a dialog to upload my CSV file. However, when I run the code, it just pass thought the code without dialog. Then error show up in "getFormControl" - > "return _dialog.formRun().control(_dialog.formRun().controlId( _controlName));"
Do I miss anything or any steps are incorrect?
Thank you very much!
Best Regards,
JustZM
private str availableTypes = ".csv";
private const str OkButtonName = 'OkButton';
private const str FileUploadName = 'FileUpload';
DialogRunbase dialog;
public static void main(Args _args)
{
CS_BulkSOUpload _BulkSOUpload = new CS_BulkSOUpload();
_BulkSOUpload.CS_Run();
}
public void CS_Run()
{
dialog = this.dialog();
this.dialogPostRun(dialog);
this.processCSVFile();
this.uploadCompleted();
}
public Object dialog()
{
DialogGroup dialogGroup;
FormBuildControl formBuildControl;
FileUploadBuild dialogFileUpload;
Set enumSet = new Set(Types::Enum);
dialog = super();
#resAppl
;
dialogGroup = dialog.addGroup("File path");
formBuildControl = dialog.formBuildDesign().control(dialogGroup.name());
dialogFileUpload = formBuildControl.addControlEx(classstr(FileUpload), FileUploadName);
dialogFileUpload.style(FileUploadStyle::MinimalWithFilename);
dialogFileUpload.baseFileUploadStrategyClassName(classstr(FileUploadTemporaryStorageStrategy));
dialogFileUpload.fileTypesAccepted(availableTypes);
dialogFileUpload.fileNameLabel("@SYS308842");
return dialog;
}
