gktcs12
6 years agoIdeator I
Uploading Files
Hi
I was trying to create a file and add to document item type using an AML query but getting File Item cannot be added
<AML> <Item type="Document" action="add"> <item_number>TEST</item_nu...
Hi,
First you have to create file in Aras and then attach that to Document using File Id.
Create file :
Item file = inn.newItem("File", "add");
file.attachPhysicalFile("C:\\Backup\\1\\1.txt");
file.setProperty("filename", "1.txt");
file = file.apply();
string fileId = file.getID();
Then add file to relationship of Document :
<AML>
<Item type="Document" action="add">
<item_number>TEST</item_number>
<name>Hi</name>
<Relationships>
<Item type="Document File" action="add">
<related_id>fileId</related_id>
</Item>
</Relationships>
</Item>
</AML>
Thanks
Hi
Thanks for the reply. I'm aware of this approach using the IOM. But, I wanna do both in AML in one query.
Thank You
Same issue I have. I think there is some change in ARAS behaviour of file handling. I have ARAS 12 and simple file upload with Document or without document is failing when I try AML way. Same thing works fine using API.
Hi Jayrajvh,
were you able to find a solution for this one? I right now also tried to upload files with pure AML. I remember that it worked in the past without problems.
Hello Angela,
Unfortunately for now I have switched to API as it was possible in my context. AML used to work previously but for some reason not any more.