Without editing item getting unsaved changes warning

Hello,

When I open an item of the Custom item type from the search grid and attempt to close it without editing the item, Aras displays an unsaved changes warning.



On that custom item, a file is attached as a relationship. We create a file using the following code:

let newFileItem = top.aras.newItem("File", FileElement);
let itmResult = top.aras.applyItemWithFilesCheck(newFileItem, '', '', '');
let fileId = itmResult.getAttribute("id");

After creating the file, we add a relationship between the custom ItemType and the file:

Item fileUpload = dal.NewItem("Custom_File", "add");
fileUpload.setProperty("source_id", custom_id);
fileUpload.setProperty("related_id", fileId);
fileUpload = fileUpload.Apply();

Is this the correct approach for attaching files to a Custom ItemType?
how to tackle this issue?

Regards,

Suhas

Parents Reply Children
  • Don´t use top.aras.saveItemEx but aras.saveItemEx! As mentioned before, don´t use the top references anymore if you don´t use Innovator 10. Aras it self try to remove them whenever possible.

    But I think in your case saveItemEx is maybe not the best solution. I typically use this one, when the item is already in edit mode. It´s a perfect function to edit something, while the user is editing anyway. 

    If you want to use it for some kind of "background" edit action, you will need to unlock manually. 

    Have you checked the linked filepicker post? Ignore the title of the thread. But the whole post contains a couple of variants for file upload for Innovator 11/12 and 14. Scroll down and look at the sample code from Gopi and Chris.