SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to create a task with a pre-filled title, as well as set some other properties. I found this documentation that says I can pass arguments when i call


This is what I have so far:

<script type="text/javascript">
    var modalDialog;
    function ShowActionItemDialog(title, questionId) {
        var options = {
            url: '/Lists/Tasks/NewForm.aspx',
            title: questionId + ': ' + title,
            questionId: questionId,
            allowMaximize: false,
            showClose: false,
            width: 800,
            args: {
                title: title,
                questionId: questionId
            height: 600
        modalDialog = SP.UI.ModalDialog.showModalDialog(options);

I have not been able to find any documentation for what args are supported. I would accept either an answer showing me how to find this information, or providing a better alternative for passing this information to the dialog. I need to invoke the dialog when a radio button is clicked, so I believe I need to do this with javascript.

Thank you!

Edit: The code from the link in the accepted answer works, but you'll need to make sure the client OM js is completely loaded

I added this code to NewForm.aspx in Sharepoint Designer:

<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(procAuditArgs, "sp.js");

function procAuditArgs(){
    var args = SP.UI.ModalDialog.get_childDialog().get_args();
share|improve this question
up vote 8 down vote accepted

This link might help you out:

So according to this, you will have to do:

var args = SP.UI.ModalDialog.get_childDialog().get_args();

on the NewForm.aspx page to access the values passed on that page.

share|improve this answer
Thanks! I edited my NewForm.aspx in SharePoint Designer. This part wasn't in the link, but I had to add some code to wait for the Client OM to fully load: See edit to the original post. – samspot Mar 19 '12 at 19:19

I believe SP.UI.ModalDialog.get_childDialog().get_args() works within the page opened in dialog only when this page is SharePoint-based, i.e. the page includes the all necessary SP js-files. So, I prefer using window.frameElement.dialogArgs to get access to the passed parameters. It works on whatever page you open in dialog. Some additional details are in my brief blog post here - How to pass parameters into a Modal Dialog Window and then access them.

share|improve this answer
A word of notice from the moderator :-) When you include links to your own blog in your answers, please remembe to mention that it is your blog so that there is no confusion. Also read the faq especially about declaration and self promotion. Fix this and you are all good, thanx ;) – Anders Rask Aug 27 '12 at 9:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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