This is a public Forum  publicRSS

Topic

    Andy Townshend
    Manual entry of CreatedByAccount or UpdatedByAccount fieldsAnswered
    Topic posted September 13, 2018 by Andy TownshendApprentice 
    18 Views, 1 Comment
    Title:
    Manual entry of CreatedByAccount or UpdatedByAccount fields
    Content:

    I am adding rows to a custom object (that has a relationship with the Answer table) using a browser control within the Answer workspace.

    After entering info/checking boxes on this browser window, I save new rows to my custom object and this part is working perfectly fine. However, the CreatedByAccount and UpdatedByAccount are null for these new rows.

     

    The browser control's url contains the Agent ID (and Session ID), which I attempted to pass to my php function manually and write this data to the row, but this causes an error and no new rows are added.

     

    Is there a way to write to these tables manually, or some other way of validating/authenticating the session and therefore having the agent information correctly assigned to these fields?

     

    Thanks!

     

     

    Version:
    Service Cloud 17D
    Code Block:

    Best Answer

    Deepu Kolkkadan

    Hi Andy,

    Use session id for agent authentication.

    //Agent authentication using session id
    ini_set('display_errors', 1);
    require_once( get_cfg_var('doc_root') . '/include/ConnectPHP/Connect_init.phph' );
    use RightNow\Connect\v1_3 as RNCPHP;

      $sessionId=$_GET['session'];

      //echo $sessionId;        
      // Set up and call the AgentAuthenticator
      require_once (get_cfg_var('doc_root') . '/include/services/AgentAuthenticator.phph');
             
      $account = AgentAuthenticator::authenticateSessionID($sessionId);
      if (!isset($account))
      {
          throw new \Exception("Couldn't Authenticate Agent using Session ID");
      }

     

     

    Regards,

    Deepu

    Answer

     

    • Deepu Kolkkadan

      Hi Andy,

      Use session id for agent authentication.

      //Agent authentication using session id
      ini_set('display_errors', 1);
      require_once( get_cfg_var('doc_root') . '/include/ConnectPHP/Connect_init.phph' );
      use RightNow\Connect\v1_3 as RNCPHP;

        $sessionId=$_GET['session'];

        //echo $sessionId;        
        // Set up and call the AgentAuthenticator
        require_once (get_cfg_var('doc_root') . '/include/services/AgentAuthenticator.phph');
               
        $account = AgentAuthenticator::authenticateSessionID($sessionId);
        if (!isset($account))
        {
            throw new \Exception("Couldn't Authenticate Agent using Session ID");
        }

       

       

      Regards,

      Deepu