Action

Search Craft

Posted by @FlohGro, Last update 6 months ago

UPDATES

6 months ago

fixed typo in description

Search in Craft

this action opens the search in craft profiles with the content of the draft configurable space.
before first use please configure it to use your chosen.
You can get it by copying the deeplink of a document in this space. Paste the link into a new draft and extract the combination like “2159f404-e3ed-4d8a-fbe1-6c361399c8f3” after spaceId= in the link. replace first “unconfigured” with this id in the spaceID variable of the script.

If this is useful for you - you can Buy Me A Coffee

Steps

  • script

    // created by @FlohGro
    
    // search in Craft
    
    // insert your preferred space ID for the search here. You can get it by copying the deepplink of a document in this space. Paste the link into a new draft and extract the combination like "2159f404-e3ed-4d8a-fbe1-6c361399c8f3" after spaceId= in the link. replace the first "unconfigured" (not that in the if() condition )with this id in the spaceID variable.
    
    const spaceID = "unconfigured"
    
    if(spaceID == "unconfigured"){
    
    let errorMsg = "the spaceID variable was not configured in the script"
    alert(errorMsg)
    context.fail(errorMsg)
    
    } else {
    
    let content = draft.processTemplate("[[draft]]")
    
    const baseURL = "craftdocs://opensearch?"
    
    var cb = CallbackURL.create()
    cb.baseURL = baseURL
    cb.addParameter("spaceId",spaceID)
    cb.addParameter("query",content)
    cb.waitForResponse = false
    cb.open()
    
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.