Customer Portal

Get Involved. Join the Conversation.

Topic

    Skyler Johnson
    Displaying answer access level in framework 3.0Answered
    Topic posted July 16, 2015 by Skyler JohnsonGreen Ribbon: 100+ Points 
    204 Views, 3 Comments
    Title:
    Displaying answer access level in framework 3.0
    Content:

    I'm currently looking into migrating to framework 3.0. The migration guide says there is no equivalent for answers.access_level.

    Is it possible to display answer access level for logged in users?

    Best Comment

    Kurt Helfrich

    Skyler:

    We just added a little bit of CPHP code to our answers/detail page.

    Fetch the answer object at the top of the page.

    $a_id = \RightNow\Utils\Url::getParameter('a_id');
    $answer = RightNow\Connect\v1_2\Answer::fetch($a_id, RightNow\Connect\v1_2\RNObject::VALIDATE_KEYS_OFF);
    

    Then get the access level names and display them where you want to.

    <?
      for ($i = 0; $i < count($answer->AccessLevels); $i++)
      {
       $answer_access_level .= $answer->AccessLevels[$i]->LookupName;
       if($i < count($answer->AccessLevels) -1) $answer_access_level .= ', ';
      }
      ?>
            #rn:msg:ACCESS_LVL_LBL:RNW#: <?=$answer_access_level;?><br />
    

    You could put the code to generate this in a custom widget or something if you want to.  We were lazy, and just put it inline.

    Comment

     

    • Kurt Helfrich

      Skyler:

      We just added a little bit of CPHP code to our answers/detail page.

      Fetch the answer object at the top of the page.

      $a_id = \RightNow\Utils\Url::getParameter('a_id');
      $answer = RightNow\Connect\v1_2\Answer::fetch($a_id, RightNow\Connect\v1_2\RNObject::VALIDATE_KEYS_OFF);
      

      Then get the access level names and display them where you want to.

      <?
        for ($i = 0; $i < count($answer->AccessLevels); $i++)
        {
         $answer_access_level .= $answer->AccessLevels[$i]->LookupName;
         if($i < count($answer->AccessLevels) -1) $answer_access_level .= ', ';
        }
        ?>
              #rn:msg:ACCESS_LVL_LBL:RNW#: <?=$answer_access_level;?><br />
      

      You could put the code to generate this in a custom widget or something if you want to.  We were lazy, and just put it inline.

    • Skyler Johnson

      This works perfectly. Thank you!

       

    • Sylvia De Bruin

      Hi. I would like to do the same thing, but it does not seem to work in frame work 3.7. or I am putting it at the incorrect place.

      See screenshot with code from detail.php page and result in answer page.

      Any suggestions?