« XPages in Pictures - 07 - Session Scope Variables | Main| Getting the value of a Radio Button in Xpages. »

XPages in Pictures - 08 - Return to Company

Category XPages
This is the 8th Post in the “XPages in Pictures” series.

Ok.  Now it’s time to tell the xContact page to return to the parent company when you save a contact.

Open up the xContact Page.  Click on the save button and remove the Simple Action “Save Data Sources”.  This action allows us to save all the datasources that are bound to the page and gives us a parameter on which page to open next.  We’re going to instead use 2 simple actions.  The first to simple save the data and another one to open our return page.

Add a new action that uses the category of “Document”.  The Action is “Save Document”.  

A picture named M2

This is a simple save action.  There is no return page built in.  Click ok to add this to your list of Actions.  It will be indented under “Simple Actions Root”.

Now add another simple action.  Go back to the “Basic” category and choose “Open Page” for the Action.  The name of the page is “xCompany”.  The Target document is “Edit Document” and the document ID is where you’re going to reference your sessionScoped variable.

The Document ID box is expecting a specific document id.  You can’t type your code directly in the box.  You need to compute the ID.  Click on the diamond next to the Document ID box and choose “Compute Value”

When in the script edit enter the following code:

sessionScope.get("companyCode")

Click Ok.  The Action box should look like this:
A picture named M3


Click ok to add the Action, and you now have an Actions Group.
A picture named M4

This is the equivalent to having a “Save and Close” action in the Notes client.  The document will be saved, and the browser will open the xCompany page, in Edit mode, finding the company document that matched the UNID variable that’s stored in the scoped variable.

Save your page.  Go into a company, create a contact and save it.  You should now be returning to the correct company after the save!

Comments

Gravatar Image1 - Hi David. Thank you. I have just read your whole series on XPages and it has been very helpful. I am wondering if you have any further articles planned for the series and what theymight cover please?

Gravatar Image2 - Thanks for help! This is just what I was looking for!

Gravatar Image3 - Thanks for your help.

Gravatar Image4 - Nice, simple and easy. Everyone can also do it. :)

Gravatar Image5 - Im still lost on this one... grr

Gravatar Image6 - Nice and clean.Thanks

Gravatar Image7 - Thanks for your help. Everything is very detailed and clear!

Gravatar Image8 - Thanks for sharing...

Gravatar Image9 - I've found really worthy post and useful info. Keep on going! And thanks for being with us!Emoticon

Gravatar Image10 - I am very happy to discover your post as it will become number 1 in my collection of favorite blogs to visit.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Powered By:

Domino BlogSphere
Version 3.0.2