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();

2 Answers 2


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.

  • 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
    Commented Mar 19, 2012 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.

  • 3
    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 ;) Commented Aug 27, 2012 at 9:15

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.