-1
<?php
// Token-based Authentication
require 'vendor/autoload.php';

use NetSuite\NetSuiteService;


$config = array(
    // required -------------------------------------
    "endpoint" => "2019_1",
    "host"     => "https://webservices.netsuite.com",
    "email"    => "myemail@domain.com",
    "password" => "Mypassword",
    "role"     => "12345",
    "account"  => "7654321",
    "app_id"   => "XXXXXXX-XXXXX-XXXXX-XXXX-XXXXXXXXX",
);
$service = new NetSuiteService($config);
$service->setSearchPreferences(true, 20);

use NetSuite\Classes\SearchDateField;
use NetSuite\Classes\TimeEntrySearch;
use NetSuite\Classes\TimeEntrySearchBasic;
use NetSuite\Classes\TimeEntrySearchAdvanced;
use NetSuite\Classes\SearchRequest;



//Search Date
$SearchField = new SearchDateField();
$SearchField->searchValue = '2021-05-01T00:16:11+00:00';
$SearchField->operator = "after";
$ItemSearchBasic = new TimeEntrySearchBasic();
$ItemSearchBasic->lastModified = $SearchField;

$ItemSearch = new TimeEntrySearch();
$ItemSearch->basic = $ItemSearchBasic;

$search = new TimeEntrySearchAdvanced();
$search->columns = "TimeEntrySearchRow";
$search->criteria = $ItemSearch;
       
$request = new SearchRequest();
$request->searchRecord = $search;
    
$searchResponse = $service->search($request);
    echo "<pre>";print_r($searchResponse);die();
    if (!$searchResponse->searchResult->status->isSuccess) {
        echo "SEARCH ERROR";
    } else {
        echo "SEARCH SUCCESS, records found: " . $searchResponse->searchResult->totalRecords . "\n";
        $records = $searchResponse->searchResult->searchRowList->searchRow;
        
        foreach ($records as $record)  {
            echo "Name: " . $record->basic->name->searchValue . "\n";
        }
    
    }
?>

I'm trying to get the last Time Entry in NetSuite filter by lastModified operator "After", I don't know what I'm doing wrong.

The error message is: -> The ''Timesheets'' feature is not enabled in your NetSuite account.

What do I need to activate?

  • ___Sorry, but I have to ask___ Did you check that the ''Timesheets'' feature **is** enabled in your NetSuite account. **??** – RiggsFolly Jun 08 '21 at 15:27
  • **Or** that you are using the correct account! The one where the ''Timesheets'' feature is enabled – RiggsFolly Jun 08 '21 at 15:28
  • Would [this answer the question](https://www.abaci-us.com/new-user-interface-weekly-timesheet/) _What do I need to activate?_ – RiggsFolly Jun 08 '21 at 15:33
  • The report that I'm trying to reach is Transactions->Employees->Track Time->List, and the API user is an admin. I have activated already "New Weekly timesheet interface", but I still get the same issue. I wonder if is something in my role to be activated. – Mauricio Giraldo Jun 09 '21 at 17:09

1 Answers1

0

Please use token based Authentication instead of APP ID and also the host should match with the SOAP URL mentioned under company information. Below is the config file screen shot.

enter image description here