Hello everyone,
I'm trying to change the file name of an attachment in an attachment control. So far, I've followed a solution from this thread.
I used this script in the OnAddFile of the Attachment DataCardValue control. Then used colAttachments in the Items property of the same control and colAttachments in the Update property of the Attachment datacard control. However, something weird seems to be happening...
1. On adding the attachment file with colAttachments in the Items property and Update property, the file does not attach.
2. If I remove colAttachments from either Items property or Update property, I'm able to attach the file but it shows the original file name. While the file is attached, if I change either the Items property or Update property, so that both properties have colAttachments, then the file name changes to the new name.
ClearCollect(
colAttachments,
{
AbsoluteUri: " ",
DisplayName: " ",
Id: " ",
Name: " ",
Value: " "
}
);
Collect(
colAttachments,
DataCardValue16.Attachments
);
RemoveIf(
colAttachments,
Id = " "
);
UpdateIf(
colAttachments,
Len(First(colAttachments).Name) >= 1,
{
Name: Replace(
First(colAttachments).Name,
1,
(Len(First(colAttachments).Name) - 4),
"invoice" & Text(
Now(),
"[$-en-US]yyyy-mm-dd-hh-mm-ss"
)
),
DisplayName: Replace(
First(colAttachments).Name,
1,
(Len(First(colAttachments).Name) - 4),
"invoice" & Text(
Now(),
"[$-en-US]yyyy-mm-dd-hh-mm-ss"
)
)
}
)
Is there any way I can resolve this problem?


Report
All responses (
Answers (