This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Attaching existing vault file to current document

ejmoska - Friday, March 18, 2016 4:05 AM:

I have separate forms for each document class, on form populate i am calling a method which would attach a different file for each document class.

I am using this code:

inn = this.getInnovator();
qryItem1 = inn.newItem("Document", "get");  
qryItem1.setAttribute("where","[DOCUMENT].item_number like 'DOK00000149' "); //item_number is unique so might be only one result, no need to loop

qryItem1 = qryItem1.apply();
file = innovator.getItemById("File","D68843A4EA6744BB89FC11E6F3AA02BC"); //File item's id
file = file.apply();
file_name = file.getProperty("filename");
relItem1 = this.newItem("Document File","add");
qryItem1.addRelationship(relItem1); //add relationship
relItem1.setRelatedItem(file);  // related item
results = qryItem1.apply();
if (results.isError()) {
inn.newError(results.getErrorDetail());
}
return this;

i keep getting this error:

Event handler failed.

Event handler failed with message: Object doesn't support property or method 'getInnovator'

client side error

 

I know i am doing something wrong, just can't figure out what, any help very appreciated



ejmoska - Friday, March 18, 2016 9:03 AM:

Another solution would be to insert default value for "from_template" property on form populate event, but i not having any luck on figuring it out