Clarity

  • 1.  HTML Portlet 15.5 Javascript

    Posted Jan 08, 2019 04:57 PM

    It looks like Javascript in HTML portlets is being being stripped out and replaced with an empty div tag.

     

    Anyone else experiencing this?  I looked through the release notes and didn't see this mention so I am wondering if this is an OnDemand restraint.

     

    V/r,

    Gene



  • 2.  Re: HTML Portlet 15.5 Javascript

    Posted Jan 10, 2019 09:04 AM

    Hi Gene,

     

    No not seen this on 15.5 html portlets.

    Do even basic scripts work like the below?

     

    <p>
    Just a test to see if javascript works with 15.5
    </p>

    <p id="hello_world"></p>

    <script>
    document.getElementById("hello_world").innerHTML =
    "Hello World!";
    </script>


  • 3.  Re: HTML Portlet 15.5 Javascript

    Posted Jan 13, 2019 08:30 PM

    After some more testing JavaScript is still working.

     

    My script is being replaced with a div tag if I use this script tag: <script type="text/javascript">

     

    But if I change it to <script> then the  JavaScript is deployed to the browser.

     

    The way I was getting the user’s sessionId no longer works:

    var currentSession = window.clarity.session.sessionId;

    Which now returns as undefined.

     

    There is the user's Id available:

    var currentSession = window.clarity.session.userId;

     

    V/r,

    Gene



  • 4.  Re: HTML Portlet 15.5 Javascript

    Posted Apr 25, 2019 03:09 AM

    The User ID is retrievable, but to read a NSQL, a Session ID is required.  Is there is way to get that in Clarity 15.5. and above?

     

    Thanks & Regards

    Praveen



  • 5.  Re: HTML Portlet 15.5 Javascript

    Broadcom Employee
    Posted Apr 25, 2019 07:31 AM

    Hi Praveen,

     

    If you check the below setting in NSA you will not get it. To make the system secure this was implemented. 

     



  • 6.  Re: HTML Portlet 15.5 Javascript

    Posted Apr 25, 2019 04:21 PM

    Hey Suman, Is there any way to get the Session ID in ondemand environments?

     

    We don't have access to CSA and we've deployed some HTML portlets which our users love because they close some UX gaps in the OOTB functionality.



  • 7.  Re: HTML Portlet 15.5 Javascript
    Best Answer

    Posted Apr 25, 2019 04:43 PM

    What I ended up doing was spinning up a simple web service on one of our servers.  The portlet calls it with the UserID along with an identity token. The web service lookup up the active session id via a web services query to PPM and returns it to the portlet.

     

    V/r,

    Gene



  • 8.  RE: Re: HTML Portlet 15.5 Javascript

    Posted Nov 20, 2020 08:42 AM
    Edited by Christoph Schubert Nov 20, 2020 08:59 AM
    Hi,

    I just noticed that
    window.clarity.session.sessionId​

    is also not working with PPM 15.8 anymore. (even though the flag "Use HttpOnly Session Cookie" is not checked).

    But I was able to retrieve the same sessionId with 

    document.cookie.replace("sessionId=","")

    or enhanced (as in some cases the cookie has more than one entry)

    document.cookie.substring(document.cookie.indexOf("sessionId=")+10,document.cookie.indexOf(";"))









  • 9.  Re: HTML Portlet 15.5 Javascript

    Broadcom Employee
    Posted Jan 10, 2019 09:12 AM

    This should be the case in both On Prem and SaaS env:

     

    • The primary purpose of HTML portlets is to display static data.
    • Do not introduce your own embedded Javascript inside HTML portlets. The injection of custom code with redirected links or references to dynamic external resources is not supported.

    https://docops.ca.com/ca-ppm/15-5/en/reference/ca-ppm-studio-development/ca-ppm-studio-portlets#CAPPMStudioPortlets-ht… 

     

    Best regards



  • 10.  Re: HTML Portlet 15.5 Javascript

    Posted Jan 12, 2019 05:48 PM

    Marc, while everyone understands this is not (officially) supported, many of us implement HTML portlets to make up for deficiencies in the user experience.

     

    For example, the OOTB experience of using Action Items to (e.g.) approve/return timesheets is not remotely user-friendly.  A HTML portlet that calls the Action Item Approvals XOG can significantly improve the user experience, making for happier users.

     

    Removing the ability to create these types of portlets would be a major retrograde step, and seems (much like removing the XOG page) ... punitive.