I encountered an issue with file uploading in the code below. I tried to fix it, but I still encountered an error.
I am using Power Automate to create a flow for storing files, but I believe the issue might be caused by my code.
If(
IsBlank(TextInput_ProjectName.Text) || IsBlank(TextInput_CostCenter.Text) || Dropdown_BUCode.Selected.Value = "--- โปรดเลือก ---",
Notify(
"กรุณากรอกข้อมูลที่จำเป็น",
NotificationType.Error
),
Set(
recRecord,
Patch(
tb_Data_Request_List,
Defaults(tb_Data_Request_List),
{
Title: TextInput_ProjectName.Text,
'Project Conditions': TextInput_Conditions.Text,
'BU Code': Dropdown_BUCode.Selected,
Language: Dropdown_Language.Selected,
'Campaign Type': Dropdown_CampaignType.Selected,
Sender: Dropdown_Sender.Selected,
'Target Audience': Concat(
Combobox_TargetAudience.SelectedItems,
Value,
", "
),
'Project Start': DatePicker_ProjectStart.SelectedDate,
'Project End': DatePicker_ProjectEnd.SelectedDate,
'Owners of SMS': TextInput_Owners.Text,
'Send Date': DatePicker_SendDate.SelectedDate,
'Send Time': Dropdown_SendTime.Selected,
'Cost Center': TextInput_CostCenter.Text,
'Qty Lead EN': Value(TextInput_QtyLeadEN.Text),
'Word for English': TextInput_WordSMSEn.Text,
'Qty Lead TH': Value(TextInput_QtyLeadTH.Text),
'Word for Thai': TextInput_WordSMSTh.Text
}
)
);
Set(recID, recRecord.ID);
ForAll(
DataCardValue51_1.Attachments,
VVICDataRequestSaveAttachmentFile.Run(
recID,
{
file: {
contentBytes: Value,
name: Name
}
}
)
);
// รีเซ็ตค่าของทุก Control
Reset(TextInput_ProjectName);
Reset(TextInput_Conditions);
Reset(Dropdown_BUCode);
Reset(Dropdown_Language);
Reset(Dropdown_CampaignType);
Reset(Dropdown_Sender);
Reset(Combobox_TargetAudience);
Reset(DatePicker_ProjectStart);
Reset(DatePicker_ProjectEnd);
Reset(TextInput_Owners);
Reset(DatePicker_SendDate);
Reset(Dropdown_SendTime);
Reset(TextInput_CostCenter);
Reset(TextInput_QtyLeadEN);
Reset(TextInput_WordSMSEn);
Reset(TextInput_QtyLeadTH);
Reset(TextInput_WordSMSTh);
Notify(
"Request Submitted Successfully!",
NotificationType.Success
);
Navigate('Home Screen')
)