How to do a saved search on a support call(support...
# ask-stanley-ai
a
How to do a saved search on a support call(support case) with a filter criteria being the company(customer's internal id)? I looked at records catalog and it really has a company field but I cant have company in the filter criteria, it does but it's options are 'has keywords', 'starts with' 'contains' etc. Instead of anyof. I also tried doing suitescripts to do a search using n/search module, and searching support calls with a specific customerId and it doesn't seem to work? Even though the customerId I specified have lots of support calls. Thanks for the help."cause":{"type":"internal error","code":"UNEXPECTED_ERROR","details":null,"userEvent":"beforeload","stackTrace":["getRange(N/searchObject)", The error looks like this: " {"type":"error.SuiteScriptError","name":"UNEXPECTED_ERROR","message":null,"id":"d0b720f0-173b-4d7b-8f76-78a344c3a611-2d323032352e31302e3138","stack":["getRange(N/searchObject)","
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you are trying to filter a saved search on a support case by the company (customer's internal id). However, you are facing issues as the company field does not provide the 'anyof' option in the filter criteria. Here is a possible solution: 1. Instead of using the 'company' field, you can use the 'internalid' field with a join to the 'company' field. This should allow you to use the 'anyof' operator. Here is a sample code snippet:
Copy code
javascript
var filters = [];
filters.push(search.createFilter({
    name: 'internalid',
    join: 'company',
    operator: search.Operator.ANYOF,
    values: [customerId]
}));
2. If you are still facing issues, you can try using a Map/Reduce script. In the map phase of the script, you can write the key-value pairs with the customer id as the key and the value as the support case details. In the reduce phase, you can create the new profile by joining or concatenating the values together. Here is a sample code snippet:
Copy code
javascript
function map(context) {
    var searchResult = JSON.parse(context.value);
    var customerId = searchResult.values['internalid'];
    var supportCaseDetails = searchResult.values['supportcase'];
    context.write({
        key: customerId,
        value: supportCaseDetails
    });
}

function reduce(context) {
    var customerId = context.key;
    var supportCaseDetails = context.values;
    // Create new profile by joining or concatenating the values together
}
Remember to replace 'supportcase' with the actual field name of the support case details in your record. Please note that these are just suggestions and you might need to adjust the code according to your specific requirements and the actual structure of your records. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.866149962
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.863159239
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.85937506
Please provide your feedback on this answer.