Search code examples
muleesbnetsuite

How to find all active employees using NetSuite connector in Mule?


I configured the following component:

<netsuite:search config-ref="Netsuite" searchRecord="EMPLOYEE" bodyFieldsOnly="false" returnSearchColumns="false" pageSize="10" doc:name="Netsuite">
    <netsuite:criteria>
        <netsuite:criterium key="isInactive">false</netsuite:criterium>
    </netsuite:criteria>
</netsuite:search>

I am getting an error:

java.lang.IllegalArgumentException: Property isInactive in class class com.netsuite.webservices.lists.employees_2013_1.EmployeeSearch is not readable

Solution

  • I was able to find a solution for this. At first stage, we create a spring bean containing a search field value. Then use this bean in the NetSuite component. The correct flow is the following:

    <spring:beans>
        <spring:bean id="SearchBooleanField" name="SearchBooleanField" class="com.netsuite.webservices.platform.core_2013_1.SearchBooleanField" scope="prototype">
            <spring:property name="searchValue" value="false"/>
        </spring:bean>
    </spring:beans>
    
    ...
    
    <netsuite:search config-ref="Netsuite" searchRecord="EMPLOYEE_BASIC" bodyFieldsOnly="false" returnSearchColumns="false" pageSize="10" doc:name="Netsuite">
        <netsuite:criteria>
            <netsuite:criterium key="isInactive">#[app.registry.SearchBooleanField]</netsuite:criterium>
        </netsuite:criteria>
    </netsuite:search>