Top Level relationships

Use a Top Level relationship to link to another object in your organization two levels away. How would you know that you need to use a Top Level relationship? The simple answer is that the object you want to link to isn't available another way, and your starting object contains a lookup to one of the standard objects available for Top Level relationships.

For example, let's say you want to base a DocGen Package on a custom object in your org. In output documents, you want data from another custom object that is unrelated to the first. If both objects reference one of the standard objects available for Top Level relationships, you could use a Top Level relationship.

No matter what the exact scenario, for Top Level relationships to work, you must pass the Id of the object your Top Level relationship is based upon to the app. One way you can do this is by editing the button used to generate documents so that it includes a button parameter. When the user generates documents, the button retrieves the Id using the button parameter and passes the Id to the app.

Create a Top Level relationship

You can add Top Level relationships to a DocGen Package with the DocGen Package Wizard or the Relationships related list on the DocGen Package.

Add a button parameter to the button used to generate documents with a Top Level relationship

You must pass the Id of the object your Top Level relationship is based upon to the app at document generation. One way you can do this is by editing the button used to generate documents so that it includes a button parameter. When the user generates documents, the button retrieves the Id using the button parameter and passes the Id to the app.

To add a button parameter to a button for a Top Level relationship

  1. From the Force.com app menu, select Nintex DocGen, and then click DocGen Admin.

    Tip: You can also select this from Lightning with the App Launcher.

  2. On DocGen Admin, click Create Advanced Buttons.

  3. In DocGen Package Starting Object, select the starting object in the Top Level relationship.

    For example, to create a button for a custom object, select Other and then from Object Name select the custom object.

  4. Add or change any other options, then click Create Button. For more information about button wizard options, see Button Wizard field reference.

    The New Button or Link Window opens, with code for your button.

  5. Append the button parameter for the object you used in the Top Level relationship to the end of the line of code.

    &Button_parameter _Id=

    For example, if you used the Account object as the Top Level relationship object, then you would type

    &AccountId=

  6. From Insert Field, select the merge field that matches the button parameter.

    For example, with a Top Level relationship based on the Account object, you would select Account Id as the merge field in Insert Field.

  7. Save the button and add it to the page layout. Use this button to generate documents with the Top Level relationship.

    For more information about adding buttons to page layouts, see Add a button to page layouts on standard or custom objects.

Use the Top Level relationship

Once you add the Top Level relationship to your DocGen Package and edited the button to pass the Id (or come up with some other scheme to pass the Id), you can generate documents.

To test the Top Level relationship

  1. From the Force.com app menu, select Nintex DocGen, and then click DocGen Packages.

    Tip: You can also select this from Lightning with the App Launcher.

  2. In the Field Tagger for the DocGen Package with the Top Level relationship, select the object you based the Top Level relationship on as the Main Object.

  3. Use the tags to create or update your template.

  4. Load the template into the DocGen Package.

  5. From the starting object of the DocGen Package with Top Level relationship, use the button you edited (or whatever scheme you have in place to pass the Id) to generate documents.

    Tip:  You must pass the Id or you won't get any data in your output document.

  6. Select the DocGen Package that contains the Top Level relationship, and click Run.