@pipedream/salesforce_rest_api 1.11.3 → 1.11.5

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.
@@ -3,9 +3,8 @@ import salesforce from "../../salesforce_rest_api.app.mjs";
3
3
  export default {
4
4
  key: "salesforce_rest_api-search-string",
5
5
  name: "Search Object Records",
6
- description:
7
- "Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized_get.htm)",
8
- version: "0.0.6",
6
+ description: "Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized_get.htm)",
7
+ version: "0.0.8",
9
8
  annotations: {
10
9
  destructiveHint: false,
11
10
  openWorldHint: true,
@@ -24,18 +23,28 @@ export default {
24
23
  salesforce,
25
24
  "objectType",
26
25
  ],
27
- description: "The type of object to search for records.",
26
+ description: "The type of object to search for records",
28
27
  },
29
28
  searchTerm: {
30
29
  type: "string",
31
30
  label: "Search Term",
32
- description: "The term to search for.",
31
+ description: "The term to search for",
33
32
  },
34
33
  fields: {
35
- type: "string[]",
36
- label: "Fields",
37
- description:
38
- "List of the Salesforce object's fields to get values from, such as `Id` or `Name`.",
34
+ propDefinition: [
35
+ salesforce,
36
+ "fieldsToObtain",
37
+ (c) => ({
38
+ objType: c.sobjectType,
39
+ }),
40
+ ],
41
+ },
42
+ },
43
+ methods: {
44
+ // constructs a url that users can copy into a browser to view the record in Salesforce
45
+ createBrowserUrl(baseUrl, url) {
46
+ return `${baseUrl.replace(".my.salesforce.com", ".lightning.force.com")}/lightning/r/${url.match(/sobjects\/([^/]+)\/([^/]+)/).slice(1)
47
+ .join("/")}/view`;
39
48
  },
40
49
  },
41
50
  async run({ $ }) {
@@ -54,7 +63,22 @@ export default {
54
63
  },
55
64
  });
56
65
  const resultsFound = response.searchRecords.length;
57
- $.export("$summary", `Sucessfully found ${resultsFound} results`);
66
+ const baseUrl = this.salesforce._baseApiUrl();
67
+ response.searchRecords = response.searchRecords.map((record) => {
68
+ const url = record?.attributes?.url;
69
+ if (!url) return record;
70
+ return {
71
+ ...record,
72
+ attributes: {
73
+ ...record.attributes,
74
+ url: `${baseUrl}${url}`, // api url
75
+ browserUrl: this.createBrowserUrl(baseUrl, url),
76
+ },
77
+ };
78
+ });
79
+ $.export("$summary", `Successfully found ${resultsFound} result${resultsFound === 1
80
+ ? ""
81
+ : "s"}`);
58
82
  return response;
59
83
  },
60
84
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/salesforce_rest_api",
3
- "version": "1.11.3",
3
+ "version": "1.11.5",
4
4
  "description": "Pipedream Salesforce (REST API) Components",
5
5
  "main": "salesforce_rest_api.app.mjs",
6
6
  "keywords": [