سؤال

I have a custom control with a field where the user will enter a document ID (not a note ID or UNID, just a unique number). This data source is named document1. When they exit the field, I perform a lookup and display either the document with that ID or a new document in an extlib Dialog control (data source bundleDoc). When bundleDoc is saved, I want to update a log field on document1 to indicate that a bundle document was added.

I can save bundleDoc and close (hide) the dialog but the code in my Save & Close button in the dialog can't "see" document1. I can't refer to it using document1.getItemValueString or by getComponent. The getItemValueString returns and empty string and getComponent throws an error because the return value is null.

I would have posted an image to help visually but I don't have enough reputation yet. :( What am I missing? Shouldn't I be able to get to document1 from the dialog control since it is on the same XPage?

UPDATE: Two fields on the dialog form have computed default values that use getComponent to get their values from document1. So, at least when the dialog is loaded, it can see document1. Also, bundleDoc is not defined as a data source for the dialog control. I will try that tomorrow to see if it makes a difference.

UPDATE 2: Still not enough reputation to post a picture, but here is some code. This is one custom control that contains a dialog control. document1 is defined as the data source for the custom control and bundleDoc is defined as the data source for the panel in the dialog control that contains the table of fields for the bundle document.

The BundleID field in the dialog control has a computed default value using this:

if (bundleDoc.isNewNote()) {
    getComponent("inputBundleID").getValue();
} else {
    bundleDoc.getItemValueString("BundleID");
}

The formula for StorageLocationID is similar except that the component is inputStorageTrayID.

This is the code in the Save & Close button:

bundleDoc.save();
var newArr = new Array(document1.getItemValue("WorkLog"));
newArr.push("Added bundle " + document1.getItemValueString("BundleID") + " - " + session.getCommonUserName());
document1.setValue("WorkLog",newArr);
document1.save();
getComponent("dialog1").hide();

The error happens on the document1.save line but it does not get the BundleID from document1 (I set a sessionScope variable to the value of newArr and it showed 'Added bundle - Anonymous'.

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top