This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jun 20, 2011, 2:10 PM
25 Posts

Re: SSJS and CSJS and Scope variables and View Columns

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 2
 James,
 
If you're using the Extension Library you can use the JSON RPC service ("Remote Service" in the component palette) to do this. But first I would ask if those values change or are specific to a certain user, click or are different between sessions? If so, I would look at using the sessionScope instead, unless it's specific to a click then I would use viewScope. If you have more than one user clicking those links, using the applicationScope those values will be changing for everyone, not just the current user. If I understood your post correctly and these values are coming from a view then I assume these values are specific to the current user. To learn more about the scoped variables see this article http://www-10.lotus.com/ldd/ddwiki.nsf/dx/xpages-scoped-variables.htm.
 
But onto the RPC, this allows you to define a SSJS method that can be called via CSJS. To do this follow the below procedure: 
  1. Put the RPC control on your page or on a top level page so the same RPC is available everywhere
  2. Give it an ID and a usable Service Name - The service name is what will be used to access the RPC via CSJS
  3. Define your methods and any  arguments they may require
Now that you have an RPC on the page with a service name of "myRPC" and let's say a method of "setApplicationScope" and 2 arguments "varName" and "varValue" you can call it from CSJS like:
 
myRPC.setApplicationScope("orgNumber",arlist.getColumnValue("tx_orgid")); 
 
The JSON RPC is a great tool for allowing/facilitating communication with the server via CSJS. 
 
Keith 
Jun 22, 2011, 6:32 PM
3 Posts
Re: SSJS and CSJS and Scope variables and View Columns
Thanks Keith,
 
Yes, the scope variable shoukld not be application, but session.  I found your other entry http://planetlotus.org/profiles/keith-strickland_91450_the-json-rpc-service and this one by Niklas http://planetlotus.org/profiles/openNTF_81647 whjich helped on the setup, but I ran into a problem in the scope variables actually getting set when clicked on the column link, it would save the previous click and so on. It appeared related to no refresh.  Anyway, I am glad to have learned about this cool json rpc tool.
 
After much frustration, my entire issue was I am a new to xpages and it was just a syntax issue on the csjs, so here is the actual code I have in the column for the on click event for csjs. I changed my ssjs function so I could pass the two variables I needed to build the link.
 

var li = "#{javascript:getARInvoiceLink2(arlist.getColumnValue("tx_orgid"),arlist.getColumnValue("tx_trxnumber"))}";

window.open(li);

 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal