0

I am using dynamic content control in extlib. one good feature of this control is that it connects the data source automatically from the documentId in url, like this:

"...#content=doc&action=openDocument&documentId=C0282D5F7AF66787C1257ACF0028FD3A"

if the unid exist in the application it connects the data source to it. (unless the ignoreRequestParameters is set)

my problem is that I am using my own soft delete feature, where I set a field on a document and if some users deletes it it will be exclude from views based on this field.

But the dyn content control do not care about if the document is in a view, it will connect to the data source if the doc exist in the application

so I need to find a way to not load the data source and redirect the user to another place if the document is soft deleted. possible?

Please note: The unid is displayed behind an url hash so it is not accessible using SSJS.

//Thomas

Thomas Adrian
  • 3,543
  • 6
  • 32
  • 62

2 Answers2

3

You can access the documentId with the ExtLibUtil. Then you can redirect the user in the beforeContentLoad event of the dynamicContent component:

<xe:this.beforeContentLoad>
   <![CDATA[#{javascript:               
      var noteId = com.ibm.xsp.extlib.util.ExtLibUtil.readParameter(facesContext,"documentId");
      if( noteId === "ABCD" ){
         facesContext.getExternalContext().redirect("http://google.de");
      }
   }]]>
</xe:this.beforeContentLoad>

[Instead of using the hardcoded noteId you have to do your lookup for your softdelete field]

Sven Hasselbach
  • 10,455
  • 1
  • 18
  • 26
  • Fantastic, I didn't know I could do that. you just saved my day. the fact that I now can read the hash parameters using ssjs is awesome. – Thomas Adrian Dec 11 '12 at 11:07
2

Can you check for your specific "soft delete" field in one of the XPage events (such as beforePageLoad) and then use context.redirectToPage("pagename") to redirect the user to another page?

Per Henrik Lausten
  • 21,331
  • 3
  • 29
  • 76
  • not sure that work as the unid to the document is in the url and not accessible in ssjs. the url could come from an email or from a user bookmark – Thomas Adrian Dec 09 '12 at 12:32