Working with fields from last saved document

I’m developing a Domino application for web access and I need to do the following:1. I have a form A, which I fill in with information and submit for saving with “@Command([FileSave]); @Command([FileCloseWindow])”.

  1. Once the form A has been submitted, I need my application to automatically generate some text to display to the user, using fields from the form A that has just been submitted.

I tried putting field names in the $$Return field in the form A, but that didn’t work.

Big thanks to anyone who can tell me how to do it.

I know I can put more fields in form A and make them hidden when in edit mode, and set their values to be computed from other fields, but what about if I want a form B to be immediately opened after form A is submitted and I want form B to have some fields pre-filled with values computed using fields from form A? How do I pass form A’s field values to form B? Or how do I make form B automatically know which document is the newly saved one?

Subject: Passing variables to another form using URL.

Here is some older documentation which works fine in R6.

How do you pass variables to another form in the URL? (Notes R4.6)

Field values can be passed to another form in the URL by using the ampersand (&) followed by the value you wish to pass. For example:

/Abc.nsf/+Formname+?OpenForm&Somevalue

To demonstrate, follow the steps to set up an example for R4.6 (R4.5 is below):

(1) Create a form and call it QS1,

(2) add a field named “somevalue” (text, editable),

(3) create an action hotspot, i.e., CLICK HERE TO SUBMIT FORM, using the following formula:

URL :="/yourdatabasename.nsf/"+"QS2"+"?OpenForm&"+somevalue;

@URLOpen

Note: QS2 will be created in a future step (#6),

(4) OPTIONAL…hide the submit button by using the following:

"["<!--button//-->"]" (you will need to hide text), and

(5) save form.

(6) Create another form called QS2,

(7) add a field named Query_String (text, computed for display, hide always),

Note: Use Query_String in the formula window as well.

(8) add another field named “somevalue” (text, computed for display) using the following formula:

@Subset(@Explode(Query_String;"&");-1)

(9) save form and test.

How do you pass variables to another form in the URL? (Notes R4.5)

Modify steps above by doing the following:

(1) Make a copy of QS1 and give it a new name “QS145,”

(2) action hotspot is the same except use “hide when editing,”

(3) do not hide submit button,

(4) create a $$Return field and use the following formula:

"[/"+@Subset(@DbName;-1)+"/ViewName/"+@Text(@DocumentUniqueID)+"]"

where ViewName is the name of your view.

Note:The view must be set up properly, review Tech Note #158546 - “How to Return a Web User to the Same Document that is Submitted.”

(5) save form and test.

You will see an extra step when running R4.5 as opposed to R4.6. Version 4.5 passes the value only from the READ mode and not the edit mode as R4.6.

This is one means to pass a value, others include inheritance, and using other values in the $$Return.

Subject: RE: Passing variables to another form using URL.

Great!I just tried your solution for Notes 4.6. It works perfectly. Thanks a lot. :slight_smile:

If other folks happen to be reading this though, I want to add something. In order to ensure correct interpretation of the passed values, I think it is best to use @URLEncode on all passed values, like this (in comparison to Michael’s steps (3) and (8) for the Notes 4.6 example):

(3) URL :=“/yourdatabasename.nsf/”+“QS2”+“?OpenForm&”+@URLEncode(“UTF-8”;somevalue); @URLOpen(URL);

(8) @URLDecode(“Domino”;@Subset(@Explode(Query_String;“&”);-1))

Thanks again, Michael. :slight_smile:

Subject: Working with fields from last saved document.

Hi,

if you are a little bit familiar with java, you could do the following:

  1. use the WebQuerySaveEvent on your form for doc A to call a java agent

  2. create the needed java agent like the following example:

import lotus.domino.*;

import java.io.PrintWriter;

public class JavaAgent extends AgentBase {

public void NotesMain( ) {



	try {

		Session session = getSession( );

		AgentContext agentContext = session.getAgentContext( );



		// Access the current database 

		Database dbCur = agentContext.getCurrentDatabase( );

		

		// Access the current document 

		Document docCur = agentContext.getDocumentContext( );

		

		// get a PrintWriter to do your desired output

		 PrintWriter pw = getAgentOutput();

   		 pw.println("Test...");

		

		// fill in your code...

		

	} catch(Exception e) {

		e.printStackTrace();

	}

}

}

good luck!

ciao

Heiko