Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9251841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:48:05+00:00 2026-06-18T10:48:05+00:00

I am trying to get the parent document of a new response document so

  • 0

I am trying to get the parent document of a new response document so I can duplicate the functionality of form inheritance in xpages. The following is my code and the error being returned:

Error while executing JavaScript action expression
Script interpreter error, line=3, col=60: 'parentDoc' is null
JavaScript code

   1: if (document2.isNewNote()) {
   2: var parentDoc:NotesDocument = database.getDocumentByID(document2.getParentId());
   3: getComponent("immediateParentSubject1").setValue(parentDoc.getItemValueString("Subject"));
   4: }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:48:06+00:00Added an answer on June 18, 2026 at 10:48 am

    I usually use a dataContext and getParentDocumentUNID() when I need a handle on the parent document for the variable “document”. You can use this for a new document (not saved yet):

    <xp:this.dataContexts>
        <xp:dataContext var="parentDoc">
            <xp:this.value><![CDATA[#{javascript:
                try {
                    if (document.isResponse()) {
                        return database.getDocumentByUNID(document.getDocument().getParentDocumentUNID());
                    } else {
                        return "";
                    }
                } catch(e) {
                    return "";
            }}]]></xp:this.value>
        </xp:dataContext>
    </xp:this.dataContexts>
    

    You can then use parentDoc in other controls and do parentDoc.getItemValueString("Subject") etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a nested form to submit via AJAX, but I can't
Basically I am trying to get the gallery of parent page, and I've been
I am trying to get the index of child of its parent. For example:-
Trying to get this expression to work, can someone look at it and tell
i'm trying to get this accordion to expand when printed. the code degrades gracefully
The following code snippet returns xml document public XmlDocument GetXMLFile(int ID) { List<UserInfoBE> data
I'm trying send XML document to a page .asp, and get the answer, but
Possible Duplicate: Update a Select Box on Parent Page from FancyBox2 I'm trying to
I'm trying to reference the parent object of an embedded document from within an
I'm trying to get the class of the parent element of the currently focussed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.