@pipedream/servicenow 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,114 +0,0 @@
1
- import servicenow from "../../servicenow.app.mjs";
2
-
3
- export default {
4
- key: "servicenow-create-incident",
5
- name: "Create Incident",
6
- description: "Creates a new incident record in ServiceNow. [See the docs here](https://www.servicenow.com/docs/bundle/zurich-api-reference/page/integrate/inbound-rest/concept/trouble-ticket-open-api.html#title_trouble-ticket-POST-ticket-tt).",
7
- version: "0.0.1",
8
- type: "action",
9
- annotations: {
10
- destructiveHint: false,
11
- openWorldHint: true,
12
- readOnlyHint: false,
13
- },
14
- props: {
15
- servicenow,
16
- name: {
17
- propDefinition: [
18
- servicenow,
19
- "name",
20
- ],
21
- },
22
- description: {
23
- propDefinition: [
24
- servicenow,
25
- "description",
26
- ],
27
- },
28
- severity: {
29
- propDefinition: [
30
- servicenow,
31
- "incidentSeverity",
32
- ],
33
- },
34
- status: {
35
- propDefinition: [
36
- servicenow,
37
- "status",
38
- ],
39
- },
40
- contactMethod: {
41
- propDefinition: [
42
- servicenow,
43
- "contactMethod",
44
- ],
45
- },
46
- companyId: {
47
- propDefinition: [
48
- servicenow,
49
- "companyId",
50
- ],
51
- },
52
- userId: {
53
- propDefinition: [
54
- servicenow,
55
- "userId",
56
- ],
57
- },
58
- workNote: {
59
- propDefinition: [
60
- servicenow,
61
- "workNote",
62
- ],
63
- },
64
- comment: {
65
- propDefinition: [
66
- servicenow,
67
- "comment",
68
- ],
69
- },
70
- },
71
- async run({ $ }) {
72
- const {
73
- name,
74
- description,
75
- severity,
76
- status,
77
- contactMethod,
78
- companyId,
79
- userId,
80
- workNote,
81
- comment,
82
- } = this;
83
-
84
- const channel = this.servicenow.buildChannel(contactMethod);
85
-
86
- const relatedParties = this.servicenow.buildRelatedParties({
87
- customer: companyId,
88
- customer_contact: userId,
89
- });
90
-
91
- const notes = this.servicenow.buildNotes({
92
- workNote,
93
- comment,
94
- });
95
-
96
- const response = await this.servicenow.createTroubleTicket({
97
- $,
98
- data: {
99
- ticketType: "Incident",
100
- name,
101
- description,
102
- severity,
103
- status,
104
- channel,
105
- notes,
106
- relatedParties,
107
- },
108
- });
109
-
110
- $.export("$summary", "Successfully created an incident.");
111
-
112
- return response;
113
- },
114
- };
@@ -1,117 +0,0 @@
1
- // legacy_hash_id: a_rJid2e
2
- import { axios } from "@pipedream/platform";
3
-
4
- export default {
5
- key: "servicenow-get-table-record-by-sysid",
6
- name: "Get Table Record By SysId",
7
- description: "Retrieves the record identified by the specified sys_id from the specified table.",
8
- version: "0.3.2",
9
- annotations: {
10
- destructiveHint: false,
11
- openWorldHint: true,
12
- readOnlyHint: true,
13
- },
14
- type: "action",
15
- props: {
16
- servicenow: {
17
- type: "app",
18
- app: "servicenow",
19
- },
20
- table_name: {
21
- type: "string",
22
- description: "The name of the table containing the record to retrieve.",
23
- },
24
- sys_id: {
25
- type: "string",
26
- description: "Unique identifier of the record to retrieve.",
27
- },
28
- api_version: {
29
- type: "string",
30
- description: "API version number. Version numbers identify the endpoint version that a URI accesses. By specifying a version number in your URIs, you can ensure that future updates to the REST API do not negatively impact your integration. Use `lastest` to use the latest REST endpoint for your instance version.",
31
- optional: true,
32
- options: [
33
- "lastest",
34
- "v1",
35
- "v2",
36
- ],
37
- },
38
- request_format: {
39
- type: "string",
40
- description: "Format of REST request body",
41
- optional: true,
42
- options: [
43
- "application/json",
44
- "application/xml",
45
- "text/xml",
46
- ],
47
- },
48
- response_format: {
49
- type: "string",
50
- description: "Format of REST response body.",
51
- optional: true,
52
- options: [
53
- "application/json",
54
- "application/xml",
55
- "text/xml",
56
- ],
57
- },
58
- sysparm_display_value: {
59
- type: "string",
60
- description: "Return field display values (true), actual values (false), or both (all) (default: false).",
61
- optional: true,
62
- options: [
63
- "true",
64
- "false",
65
- "all",
66
- ],
67
- },
68
- sysparm_exclude_reference_link: {
69
- type: "boolean",
70
- description: "True to exclude Table API links for reference fields (default: false).",
71
- optional: true,
72
- },
73
- sysparm_fields: {
74
- type: "string",
75
- description: "A comma-separated list of fields to return in the response.",
76
- optional: true,
77
- },
78
- sysparm_view: {
79
- type: "string",
80
- description: "Render the response according to the specified UI view (overridden by sysparm_fields).",
81
- optional: true,
82
- },
83
- sysparm_query_no_domain: {
84
- type: "boolean",
85
- description: "True to access data across domains if authorized (default: false).",
86
- optional: true,
87
- },
88
- },
89
- async run({ $ }) {
90
- // See the API docs: https://docs.servicenow.com/bundle/paris-application-development/page/integrate/inbound-rest/concept/c_TableAPI.html#table-GET-id */
91
-
92
- if (!this.table_name || !this.sys_id) {
93
- throw new Error("Must provide table_name, and sys_id parameters.");
94
- }
95
-
96
- var apiVersion = "";
97
- if (this.api_version == "v1" || this.api_version == "v2") {
98
- apiVersion = this.api_version + "/";
99
- }
100
-
101
- return await axios($, {
102
- url: `https://${this.servicenow.$auth.instance_name}.service-now.com/api/now/${apiVersion}table/${this.table_name}/${this.sys_id}`,
103
- headers: {
104
- "Authorization": `Bearer ${this.servicenow.$auth.oauth_access_token}`,
105
- "Accept": this.request_format || "application/json",
106
- "Content-Type": this.response_format || "application/json",
107
- },
108
- params: {
109
- sysparm_display_value: this.sysparm_display_value,
110
- sysparm_exclude_reference_link: this.sysparm_exclude_reference_link,
111
- sysparm_fields: this.sysparm_fields,
112
- sysparm_view: this.sysparm_view,
113
- sysparm_query_no_domain: this.sysparm_query_no_domain,
114
- },
115
- });
116
- },
117
- };