how to load a saved search of workflow instance wh...
# ask-stanley-ai
t
how to load a saved search of workflow instance while it throw error when not providing type, but the type workflow instance cannot be found in search.Type enum
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that you are trying to load a saved search of a workflow instance in SuiteScript, but you are encountering an error when not providing the
type
parameter. However, you are unable to find the
workflow instance
in the
search.Type
enum. The
search.load
function in SuiteScript requires the
type
parameter when it cannot determine the search type. This typically happens when you are searching on a custom record. The
type
parameter should be the script ID of the record type that the search is based on. However, it seems that
workflow instance
is not a valid search type in the
search.Type
enum. This could be because SuiteScript does not support loading saved searches of workflow instances directly. Here's a workaround you can try: 1. Determine the record type that the workflow instance is associated with. For example, if the workflow is associated with a transaction, the record type would be
transaction
. 2. Create a saved search based on that record type instead of the workflow instance. 3. Load the saved search in SuiteScript using the
search.load
function, providing the
type
parameter with the appropriate record type. Here's a sample code snippet:
Copy code
javascript
const savedSearchId = 'your_saved_search_id';
const recordType = 'your_record_type'; // replace with the actual record type

let savedSearch = search.load({
    id: savedSearchId,
    type: recordType
});
Remember to replace
'your_saved_search_id'
and
'your_record_type'
with the actual saved search ID and record type respectively. ****** 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.801941
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.798339844
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.79422
Please provide your feedback on this answer.