Welcome! Share code as fast as possible.
- Use the language picker to change the language manually.
- The previous link will get modified. You can then share this new link with others.
- Visit
https://code-dump.vercel.app/<extension>
- For example, to create a link which for a JavaScript code you will visit
https://code-dump.vercel.app/js
Any link generated does not have an expiry.
GitHub
<%@ page import="/nl/core/shared/nl.js"%>
<%
//required server-side dependencies
NL.ns('NL.API');
NL.require('/nl/core/shared/core.js')
.require('/nl/core/jsspcontext.js');
//response headers
response.setContentType("application/json");
response.addHeader("Access-Control-Allow-Origin", "*")
response.addHeader("Pragma", "no-cache");
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Date", new Date());
response.addHeader("Expires", new Date());
//require authentication
var jsspContext = new NL.JSSPContext(request);
if( !jsspContext.checkAuthentication() ) {
response.sendError(403, "Authentication required");
return;
}
//datatables request params
var sl = request.getParameter('start');
var lc = request.getParameter('length');
var draw = request.getParameter('draw');
try {
var query = xtk.queryDef.create(<queryDef schema="nms:recipient" operation="select" startLine = {sl} lineCount={lc}>
<select>
<node expr="[lnkRelationshipManager/@firstName]+ ' ' + [lnkRelationshipManager/@lastName]" alias="@rm"/>
<node expr="Iif(@clawfulBasis = 0,'Removed',Iif(@clawfulBasis = 1,'None',Iif(@clawfulBasis = 2, 'Legitimate interest', 'Consent given')))" alias="@law"/>
<node expr="@blackList"/>
<node expr="@jurisdiction"/>
<node expr="@firstName+' '+@lastName" alias="@name"/>
<node expr="@email"/>
<node expr="@cmOneID"/>
<node expr="@id"/>
<node expr="[subscription/service/@id]"/>
</select>
<where>
<condition>
</condition>
</where>
</queryDef> );
var rcpXml = query.ExecuteQuery();
var data = [];
for each(var i in rcpXml) { //iterate recipient data
var rcpSubs = [];
for each (var s in i.subscription) { //iterate recipient subscriptions
rcpSubs.push(s.service.@id);
}
data.push({
"id" : i.@id.toString(),
"cmOneID" : i.@cmOneID.toString(),
"email" : i.@email.toString(),
"name" : i.@name.toString(),
"jurisdiction" : i.@jurisdiction.toString(),
"blackList" : i.@blackList.toString(),
"rm" : i.@rm.toString(),
"lawfulBasis" : i.@law.toString(),
"subscriptions" : rcpSubs.toString(),
});
var response = {
"draw": parseInt(draw),
"recordsTotal": data.length,
"recordsFiltered": data.length,
"data": data
};
}
document.write(JSON.stringify(response));
} catch (err) {//catch errors
response = {'error':err.toString()};
document.write(JSON.stringify(response));
}
%>