I have a button that opens the upload dialog from a page using the below approach:

function openUploadNewDocumentDialog(passingID)
    var dialogOptions = SP.UI.$create_DialogOptions();
    dialogOptions.url = "/mySite/sales/tracking/_layouts/Upload.aspx?List={GUID}&IsDlg=1";
    dialogOptions.width = 700;
    dialogOptions.height = 310;
    dialogOptions.title = "Submit Document";
    dialogOptions.dialogReturnValueCallback = Function.createDelegate(null, CloseThisDocCallBack);

function CloseThisDocCallBack(result, returnValue)
    if (result == SP.UI.DialogResult.OK) 
    // here is where i have current logic for last id

So what i have above is basically calling the dialog to upload the document that I mean to associate with a parent ID, or I have data in lists that represent a package and the ID of that list item is the master ID I want to associate multiple things with (documents amount them). So on a submission form there is a button that allows users to upload via above, and after edit form opens, they enter metadata, there is the callback which i catch and then do the following: call another function which uses SPServices SPGetLastItemId then update the record with the master ID WHERE I use that last item ID......so this is the only way I have found to make this half way work in this manner.

My question is, I would much rather pass the ID through the upload dialog and save right then and there. I have that master ID when they call the dialog upload, so is there a way i could include this in the query string or something to get the value through the upload form to the edit form or library? There is a field in the library called parentID?

Additionally, just for reference, the extent of dev for me is SharePoint Designer SBS Env. Any help with this would be greatly appreciated!

EDIT: I know how to use the above in order to call the upload to dialog, and that will automatically get the edit form dialog after user has uploaded doc. I would like to pass a var somehow into the edit form so that it can be saved with the documents metadata by the user right then and there. if i put it in a query string, it doesn't seem that it gets to the edit form (if i like write something to try and grab it then), and if I add function to the callback, that is after the edit form dialog is closed?? thanks for helping a beginner as I am sure I am not understanding this completely.

  • @Arsalan Adam Khatri ...hi. thanks for the response, but i am not sure exactly what you mean. could you provide a bit more info please? beginner. thanks
    – Justin
    Dec 4, 2012 at 15:31
  • so i know how and where to get the url of the edit form, and i know how to call and use that in js/jquery, perhaps i was unclear....editing my question.
    – Justin
    Dec 4, 2012 at 15:43
  • Quite clear now.. what is the type of parentID field in document library ? Dec 4, 2012 at 15:49
  • So you must have a textbox for the parentID field in edit form right? Hide it through css, grab the id of this textbox and set it using javascript... Dec 4, 2012 at 15:58
  • I have the id text box on the edit form, but I want to fill that text box coming from the upload dialog (right after user has uploaded a new document). I use the above script to call the upload dialog in the first place, but I need to get that id value from the above script into that text box on the edit form.
    – Justin
    Dec 4, 2012 at 16:05

1 Answer 1


I was able to get this to work, so if anyone is interested:

1) Added the value of ID to url passed to Upload.aspx in query string. I think it basically has its own success callback that by default passes events and args?

2) create my own edit form and set as default

3) already have the column for masterID so I simply unhide the content type to get it back on the edit form.

4) added javascript to new edit form's document ready to grap the window's url

5) split values by &,= and load into array, so that I could parse and grab the value I was looking for with keyword match

6) set the values from array to field on the form ( and there it was, i could see it)

7) this time I hide the field on the form by adding jquery to the form in CEWP to hide that particular field (find the tr, reference three parents and hide() ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.