Page 1 of 1
Related Documents via browse and upload
Posted: 06 Mar 2016
by Jaydius
I enjoy the ease of use of the fd.updateDroppedDocuments function in Forms Designer. Im wondering if theres a way to incorporate the ability for a user to use the standard browse function to find and then upload a file, if they prefer the old method to dragging and dropping.
It would be great to have the option to click on a button to browse for chosen file(s) to upload, then for the form to pre-fill the values in the same way the current fd.updateDroppedDocuments function does.
Re: Related Documents via browse and upload
Posted: 07 Mar 2016
by Dmitry Kozlov
Hi,
You can pre-populate fields on the edit form of a document right after uploading by using the code below:
Code: Select all
fd.field('TargetField').value(window.top.fd.field('SourceField').value());
Replace 'TargetField' and 'SourceField' with the internal names of the appropriate field in the parent and child forms.
Re: Related Documents via browse and upload
Posted: 30 Jun 2016
by Jaydius
Ive been trying to get this working. Ive inserted the following into the Javascript panel in SPForm for the Edit Form in the document library:
fd.field('AWO').value(window.top.fd.field('ID').value());
But it doesnt seem to carry through to the edit form after uploading. As the AWO field is a lookup field (lists all Parent records) could this be causing the issue? Im using the Related Items control in the parent form, filtering documents that share the same 'AWO' value from the document library. Ive set the control to Editable, then using the 'Upload' button to upload a new associated document.
Once the file is uploaded it redirects to the edit form, but the code above doesnt seem to populate the AWO field.
Also, I dont know if this would be a factor, but the parent form is opening in a dialog, not full page.
Re: Related Documents via browse and upload
Posted: 30 Jun 2016
by Jaydius
After some more testing, using the following works to get the parent ID at least:
fd.field('AWO').value(fd.getSourceID());
It would be great to get more than just the ID from the parent form to populate the child form though. Any help would be much appreciated.
Re: Related Documents via browse and upload
Posted: 01 Jul 2016
by Dmitry Kozlov
Hi,
Try to open the parent form in the main window (not in a dialog).
Re: Related Documents via browse and upload
Posted: 01 Jul 2016
by Jaydius
The users of the system prefer the forms opening in dialog vs full window. Is there any way I can still pass values on to the child form after document upload? As I mentioned, I'm able to get the parent ID to pull through, just unsure how to get any other values.
Re: Related Documents via browse and upload
Posted: 04 Jul 2016
by Dmitry Kozlov
If a user opens both forms in dialogs, you can use the following code to retrieve field values from the first dialog:
var iframes = $('iframe.ms-dlgFrame', window.top.document);
var parentFD = iframes[0].contentWindow.fd;
alert(parentFD.field('Title').value);
Another option is getting field values via JSOM:
https://msdn.microsoft.com/en-us/librar ... e.14).aspx
Re: Related Documents via browse and upload
Posted: 04 Jul 2016
by Jaydius
Using fd.field('Childformfield').value(parentFD.field('Parentformfield').value()); works perfectly with your code. Thanks again for another problem solved. Much appreciated Dmitry!