'Mark a search unrestricted in suitescript 2.0

I am using a restlet to check whether a contact exist in netsuite or not. I am calling this restlet from an external environment. The problem I'm facing is the search should be marked unrestricted in order to get results otherwise its returning nothing. How should I mark the search unrestricted? This is my code

var result = search.create({
        type : record.Type.CONTACT,
        filters:['email','IS',contact_mail],
        ispublic : true,
      unrestricted: true,
          columns: ['email']
    }).run().getRange({
        start: 0,
        end: 1
    });

Can someone help me with this!



Solution 1:[1]

You can create the contact saved search in the UI without any filters and mark it as unrestricted.

In your script, load the search with search.load, and then add the the email filter to the search before running it.

var searchObj = search.load({
 type: record.Type.CONTACT,
 id: customsearch_contact_search
});
searchObj.filters.push(['email','IS',contact_mail]);
var result = searchObj.run().getRange({start:0, end:1});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Victor Chern