Redirect to another page if the url hash unid document is soft deleted using the dynamic content control in exlib

StackOverflow https://stackoverflow.com/questions/13786245

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

有帮助吗?

解决方案

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]

其他提示

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?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top