Skip to content

Commit

Permalink
Update servicenow extension (#15034)
Browse files Browse the repository at this point in the history
* Update servicenow extension

- Merge branch \'contributions/merge-1729610900174610000\'
- Pull contributions
- Fixed lint issues
- Update package.json
- Updated README
- Added new command to login to selected instance
- Added Search Resources command
- Removed unneeded tooltips in Instance Form
- Renamed update set file
- Improved search results filtering and Documate pages are opened in the editor

* Update CHANGELOG.md

* Update CHANGELOG.md and optimise images

---------

Co-authored-by: raycastbot <[email protected]>
  • Loading branch information
robertoalvarezalonso and raycastbot authored Oct 23, 2024
1 parent cae1713 commit c5b9a09
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 19 deletions.
8 changes: 8 additions & 0 deletions extensions/servicenow/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Search Documate Changelog

## [Fixes & Bits] - 2024-10-23

- Documate pages now open directly in the editor
- Improved search results filtering
- Added `Login to Selected Instance` command
- Added `Search Resources` command to help find ServiceNow resources
- Removed unnecessary tooltips in the Instance Profile Form for a cleaner interface

## [Initial Version] - 2024-10-17
12 changes: 6 additions & 6 deletions extensions/servicenow/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# ServiceNow Raycast Extension

## Overview

The **ServiceNow Raycast Extension** allows you to easily search and explore content across your ServiceNow instances. With this extension, you can perform quick searches, manage instance profiles, and open specific instances or ServiceNow records in your browser.
Expand All @@ -8,9 +6,11 @@ The **ServiceNow Raycast Extension** allows you to easily search and explore con

- **Search:** View past searches, perform new queries, and switch between ServiceNow instances.
- **Manage Instance Profiles:** Configure and manage ServiceNow instance profiles for use in search queries.
- **Quick Search:** Search your ServiceNow instance instantly from the command window by entering a query without extra steps.
- **Open Instances:** Open all configured instances or the currently selected instance in the browser.
- **Open Current URL:** Open the current ServiceNow URL in a specified instance. This feature requires the [Raycast Browser Extension](https://www.raycast.com/browser-extension)
- **Efficient Navigation:** Open specific ServiceNow instances or records directly from the command window.
- **Current URL Access:** Open the current ServiceNow URL in a different instance (requires the [Raycast Browser Extension](https://www.raycast.com/browser-extension)).
- **Table Exploration:** Navigate and explore tables within your ServiceNow instance.
- **Quick Login:** Quickly log in to your ServiceNow instances.
- **Resources Search:** Access various ServiceNow resources, including documentation, blogs, and guides.

## Setup Instructions

Expand All @@ -26,7 +26,7 @@ To allow non-admin users to view and delete their past search terms, you'll need

#### Steps to install:

1. Download the update set [Allow access to user's search terms.xml](<media/Allow access to user's search terms.xml>).
1. Download the update set [allow*access_to* user_search_terms.xml](<media/allow_access_to_ user_search_terms.xml>).
2. Navigate to **System Update Sets > Retrieved Update Sets** in your ServiceNow instance.
3. Click **Import Update Set from XML** and upload the file.
4. Commit the update set to enable the functionality.
22 changes: 21 additions & 1 deletion extensions/servicenow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "ServiceNow",
"description": "Search and explore content across your ServiceNow instances",
"icon": "servicenow.png",
"author": "ralvarezalonso",
"author": "robertoalvarezalonso",
"categories": [
"Productivity",
"Web"
Expand Down Expand Up @@ -100,6 +100,26 @@
"title": "Explore Tables",
"description": "Browse and explore the tables within an instance",
"mode": "view"
},
{
"name": "search-resources",
"title": "Search Resources",
"description": "Search across various ServiceNow resources, including documentation, blogs, guides, learning materials, and more.",
"mode": "no-view",
"arguments": [
{
"name": "query",
"placeholder": "Query",
"type": "text",
"required": true
}
]
},
{
"name": "login-to-selected-instance",
"title": "Login to Selected Instance",
"description": "Logs into the selected ServiceNow instance using the credentials stored in the associated instance profile, allowing quick and easy access without manual login steps.",
"mode": "no-view"
}
],
"dependencies": {
Expand Down
13 changes: 2 additions & 11 deletions extensions/servicenow/src/components/InstanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,8 @@ export default function InstanceForm({ onSubmit, instance }: SetInstanceFormProp
})}
</Form.Dropdown>

<Form.TextField
{...itemProps.username}
title="Username"
placeholder="Enter a username"
info="The minimum distance in meters from the place that would trigger the reminder"
/>
<Form.PasswordField
{...itemProps.password}
title="Password"
info="The minimum distance in meters from the place that would trigger the reminder"
/>
<Form.TextField {...itemProps.username} title="Username" placeholder="Enter a username" />
<Form.PasswordField {...itemProps.password} title="Password" />
</Form>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@ export default function SearchResultListItem({

const dataKeys = keys(result.data);
const accessories: List.Item.Accessory[] = [];
const title = result.metadata.title?.split(/\s|\n/);
const description = result.metadata.description?.split(/\s|\n/);
let keywords = [label, ...(description ?? [])];
let keywords = [label, ...(title ?? []), ...(description ?? [])];

let name;
if (result.table == "u_documate_page" || result.table == "u_documate_workspace") {
result.record_url = `documate.do?w=${result.data.u_workspace?.value}&p=${result.sys_id}`;
name = result.metadata.title || "Untitled page";
const dataIcon = result.data.u_icon?.display;
icon = {
source: dataIcon || Icon.Document,
tintColor: dataIcon ? null : Color.SecondaryText,
};

keywords = keywords.concat((result.data.u_workspace?.display ?? "").split(/\s|\n/));
accessories.push({
tag: {
value: result.data.u_workspace?.display,
Expand Down
15 changes: 15 additions & 0 deletions extensions/servicenow/src/login-to-selected-instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LocalStorage, open, showToast, Toast } from "@raycast/api";
import { Instance } from "./types";

export default async function main() {
const instance = await LocalStorage.getItem<string>("selected-instance");
if (!instance) {
showToast(Toast.Style.Failure, "No instances found", "Please create an instance profile first");
return;
}

const instanceProfile = JSON.parse(instance) as Instance;
open(
`https://${instanceProfile.name}.service-now.com/login.do?user_name=${instanceProfile.username}&user_password=${instanceProfile.password}&sys_action=sysverb_login`,
);
}
7 changes: 7 additions & 0 deletions extensions/servicenow/src/search-resources.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LaunchProps, open } from "@raycast/api";

export default async (props: LaunchProps) => {
const { query } = props.arguments;

open(`https://developer.servicenow.com/dev.do#!/search/tokyo/All/${query}`);
};

0 comments on commit c5b9a09

Please sign in to comment.