Customer Portal

Get Involved. Join the Conversation.


    Qing Liu
    Show/hide page content based on SLA
    Topic posted August 10, 2010 by Qing LiuGold Medal: 3,500+ Points, last edited October 29, 2011 
    6247 Views, 37 Comments
    Show/hide page content based on SLA

    Hi All,

    The manual of Nov 2009 indicates we can hide page content with an SLA condition. Cool, but I test rn condition tag; it does not seem to work for me.

     Here is my test code:

    <rn:condition sla="internal_US" >

    <p>The content is only showing to Agents who have internal US SLA</p> </rn:condition>.

    As I read from community (, the rn:condition SLA will only check SLA options, like  <rn:condition sla="selfservice">, <rn:condition sla="incident"> etc. It will not check SLA ID.

    If that is true, how we can show/hide contents on end users page based on SLA ID?  In my case, internal_US(17), internal_UK(18) both get different SLA ID.

    Is it some simply way to do like

    <rn:condition sla_id="17">,

    Show to US people


    <rn:condition sla_id="18">,

    Show to UK people


    I also look at SlaDiv widget, I found out that it also only reads SLA options

    Thanks you,  I am looking forward to your reply


    • Maria

      Thanks Kelli!!


      I changed the sla_check.php header for the new version:

      namespace Custom\Models;
      use RightNow\Connect\v1_1 as RNCPHP;
      class Sla_check extends \RightNow\Models\Base

      Attach File

      Thanks a LOT!!


    • ksmithSerSol

      Excellent!  I was thinking you'd probably need to edit a few things in the model file but I wasn't sure what.  Glad you figured it out and that it works!

    • Yi?it Demirba?

      As an alternative to sla for selective content on customer portal we are using custom fields based on our criteria. A simple model is adequate with this case;

      $CI = get_instance();
         $custid= $CI->session->getProfileData('c_id');
          $contacts = RNCPHP\Contact::find('ID ='.$custid.'');
          foreach ($contacts as $contact) {

          $result = $contact->CustomFields->c->customcriteriafield;
          if($result == 1){
           return TRUE;
           return FALSE;
         catch(Exception $err){
          echo $err->getCode();

      I hope this helps too.


    • jamie23aks

      Not a Web dev so looking for some assistance.

      So I;ve been using this method with success for a while. Now however we are moving to a PCI Compliant  to a PCI pod and some of the code needs to be sanitized. The initial code review came back with this:



      ·Failure: Injection Vulnerability (SQL)

      This code allows a malicious user to inject content into a database query and requires sanitation. Contact ID not verified to be integer.

      I believe specifically this line:

      $si = "SELECT sla_set from sla_instances WHERE state=2 AND owner_id=".$contactID;


      I've had  our former web dev ( yes we let him go and did not back fill - duh) take a look and he was kind enough to put this together:

      if (is_int($contactId)) $si = "SELECT sla_set from sla_instances WHERE state=2 AND owner_id=".$contactID; 
      else $si = "SELECT 0";
      Which is working in errors...but I'm, also not getting the navbar at all.
      Anyone have a similar issue or suggestions? I understand this is a pretty old  thread.


    • BIll Spoonster

      Has anyone added this to a Framework 3 environment? I added all the code as described, but it doesn't seem to be doing anything...

    • Qing Liu

      Right, The Framework 3 does not allow direct SQL call. I guess you have to use Connect PHP API.

      Something like that 

      use \RightNow\Connect\v1_2 as RNCPHP;
      $query= "SELECT sla_set from sla_instances where state=2 AND owner_id=".$contactID;
      $res = RNCPHP\ROQL::query($query)->next();
    • Allan Schrum

      For a Contact, the available SLA Instances are available through Contact->ServiceSettings->SLAInstances. Your equivalent ROQL query would be:

      SELECT ServiceSettings.SLAInstances.SLASet FROM Contact WHERE ID = {$contactID} AND ServiceSettings.SLAInstances.StateOfSLA = 2

      Be aware that a Contact can have multiple SLAInstance objects so you might also sort by ActiveDate or ExpireDate and pick the first one. Also, you can check the available counts that remain if you are choosing one to use instead of the default.