user3075978
user3075978

Reputation: 845

Create a SuiteTalk transaction search that gets all sales order with a certain status

In NetSuite SuiteTalk (Web Services), I am trying to create a search that will find all sales orders that have the status "Pending Approval". I think I have everything structured correctly and I think the problem is the status is not actually called "Pending Approval, but something else. I have tried other variants like "_pendingApproval", but my search never returns any results. If I comment out the status part, the search works correctly and returns every sales order for this particular customer.

Any thoughts on what the problem is?

C#


TransactionSearchBasic tsb = new TransactionSearchBasic() {
    mainLine = new SearchBooleanField() {
        searchValue = true,
        searchValueSpecified = true,
    },
    type = new SearchEnumMultiSelectField() {
        @operator = SearchEnumMultiSelectFieldOperator.anyOf,
        operatorSpecified = true,
        searchValue = new string[] { "_salesOrder" },    
    },
    entity = new SearchMultiSelectField() {
        @operator = SearchMultiSelectFieldOperator.anyOf,
        operatorSpecified = true,
        searchValue = new RecordRef[] {
            new RecordRef() {
                type = RecordType.customer,
                internalId = "231"
            }
        }
    },
    status = new SearchEnumMultiSelectField() {
        @operator = SearchEnumMultiSelectFieldOperator.anyOf,
        operatorSpecified = true,
        searchValue = new string[] {
            "Pending Approval",
            "_pendingApproval",
            "pendingApproval",
            "pendingapproval",
            "pending approval",
            "0"
        }
    }
};

SearchResult results = _nss.search(tsb);

Upvotes: 0

Views: 3553

Answers (2)

user3075978
user3075978

Reputation: 845

It looks like the type of transaction needs to be prefixed to the status. For example:

status = new SearchEnumMultiSelectField() {
    @operator = SearchEnumMultiSelectFieldOperator.anyOf,
    operatorSpecified = true,
    searchValue = new string[] {
        "_salesOrderPendingApproval"
    }

}

Upvotes: 2

Rockstar
Rockstar

Reputation: 2288

Try using :

"pendingApproval"

instead of

"_pendingApproval" & "Pending Approval"

Upvotes: 0

Related Questions