I am reading from the documentation on openlog:
Because Server-Side JavaScript Script Libraries have no context for which component called them, you will not be able to use this to pass the component to OpenLog. Instead, if you wish to identify which component called the code, you need to pass the component into your SSJS function as a parameter.
https://wiki.openntf.org/display/XOL/Using+from+SSJS+Script+Libraries
So I have a link which calls a SSJS function that resides in a script library:
<xp:link escape="true" text="#{obj.name}" rendered="#{obj.internal eq '3'}">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="dlgAssessment"> <xp:this.action><![CDATA[#{javascript:openDialogAssessment(this);}]]></xp:this.action> </xp:eventHandler> </xp:link>
The function registers failures to openlog as followed:
function openDialogAssessment(component){
try {
try{
assessmentBean.removeAssessment("assessment");
}catch(e){
openLogBean.addError(e,component);
}
//... more code
}
If I look at the log result in openlog I read:
null - Developer has passed 'this' directly from an SSJS function in Script Library /proposal.jss. Please note, SSJS Script Libraries have no context for components. You must pass the relevant component into your SSJS function as a parameter.
Can someone tell me what I am doing wrong and how I could pass the component to the function correctly?
thisis always the xp/xe/xc XML tag surrounding the code. I won't post an answer, instead Ferry should move his comment to an answer so he can get the credit for answering it correctly. - Paul Stephen Withers