0

I tried fetching all the journal entries in my account using the SuiteTalk SOAP API. But it fails with the message

The field type's enum value <journalEntry> is invalid for this search.

The Request and Response are as follows:

==================== Beginning of Request ====================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <ns1:searchPreferences xmlns:ns1="urn:messages_2021_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
      <ns1:pageSize>20</ns1:pageSize>
    </ns1:searchPreferences>
    <ns2:tokenPassport xmlns:ns2="urn:messages_2021_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
      <ns3:account xmlns:ns3="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns3:account>
      <ns4:consumerKey xmlns:ns4="urn:core_2021_1.platform.webservices.netsuite.com">#####3</ns4:consumerKey>
      <ns5:token xmlns:ns5="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns5:token>
      <ns6:nonce xmlns:ns6="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns6:nonce>
      <ns7:timestamp xmlns:ns7="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns7:timestamp>
      <ns8:signature xmlns:ns8="urn:core_2021_1.platform.webservices.netsuite.com" algorithm="HMAC-SHA256">#####</ns8:signature>
    </ns2:tokenPassport>
  </soapenv:Header>
  <soapenv:Body>
    <search xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
      <searchRecord xmlns:ns9="urn:common_2021_1.platform.webservices.netsuite.com" xsi:type="ns9:TransactionSearchBasic">
        <ns9:type xmlns:ns10="urn:core_2021_1.platform.webservices.netsuite.com" operator="anyOf" xsi:type="ns10:SearchEnumMultiSelectField">
          <ns10:searchValue xsi:type="xsd:string">journalEntry</ns10:searchValue>
        </ns9:type>
      </searchRecord>
    </search>
  </soapenv:Body>
</soapenv:Envelope>
==================== End of Request ====================


==================== Beginning of Response ====================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2021_1.platform.webservices.netsuite.com">
      <platformMsgs:nsId>#####</platformMsgs:nsId>
    </platformMsgs:documentInfo>
  </soapenv:Header>
  <soapenv:Body>
    <searchResponse xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
      <platformCore:searchResult xmlns:platformCore="urn:core_2021_1.platform.webservices.netsuite.com">
        <platformCore:status isSuccess="true">
          <platformCore:statusDetail type="WARN">
            <platformCore:code>WARNING</platformCore:code>
            <platformCore:message>The field type's enum value &lt;journalEntry&gt; is invalid for this search.</platformCore:message>
          </platformCore:statusDetail>
        </platformCore:status>
        <platformCore:totalRecords>0</platformCore:totalRecords>
        <platformCore:totalPages>0</platformCore:totalPages>
        <platformCore:searchId>#####a</platformCore:searchId>
        <platformCore:recordList/>
      </platformCore:searchResult>
    </searchResponse>
  </soapenv:Body>
</soapenv:Envelope>
==================== End of Response ====================

The permissions for the role are as follows: enter image description here

2 Answers2

0

The search type string should be "_journal":

<search xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
  <searchRecord xmlns:ns9="urn:common_2021_1.platform.webservices.netsuite.com" xsi:type="ns9:TransactionSearchBasic">
    <ns9:type xmlns:ns10="urn:core_2021_1.platform.webservices.netsuite.com" operator="anyOf" xsi:type="ns10:SearchEnumMultiSelectField">
      <ns10:searchValue xsi:type="xsd:string">_journal</ns10:searchValue>
    </ns9:type>
  </searchRecord>
</search>

See https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2021_1/schema/enum/transactiontype.html?mode=package and https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2021_1/schema/search/transactionsearchbasic.html?mode=package

You should always use the Schema Browser to look these things up, since they can be different between different uses.

Depending on how you are generating the SOAP message, how you get the string can vary. If using C#, Visual Studio, and the proxy classes created from the WSDL, there should be an enum that gets you the right string values.

EDIT: Specifically, the values are stored in a public enum called RecordType. In C#, RecordType.JournalEntry (which has an integer value of 94) will place "_journal" in the SOAP message.

Pierre Plourde
  • 708
  • 4
  • 12
  • I am using the Java proxies downloaded from http://content.netsuite.com/download/NSJavaClient2021-2.zip and I don't find an equivalent record type for "_journal", but only for "journalEntry" – Soban Soundararajan Dec 06 '21 at 07:33
  • Hi @SobanSoundararajan: when setting the type property in your RecordRef are you using the public enum RecordType.journalEntry or are you just using the string "journalEntry"? The former should give you the correct results in your SOAP message (i.e. "_journal"), while the latter will not. If you are not using the public enum, but want to set the property with a string, you must use "_journal". – Pierre Plourde Dec 06 '21 at 14:39
  • Was using RecordType.journalEntry – Soban Soundararajan Dec 20 '21 at 12:53
0

You should use the TransactionType enum ex in java:

SearchEnumMultiSelectField searchTypeValue = new SearchEnumMultiSelectField();
searchTypeValue.getSearchValue().add(TransactionType.JOURNAL.value());
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 29 '22 at 03:22