feat(salesforce): add list fields data
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import listObjects from './list-objects';
|
import listObjects from './list-objects';
|
||||||
|
import listFields from './list-fields';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
listObjects,
|
listObjects,
|
||||||
|
listFields,
|
||||||
];
|
];
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
|
||||||
|
type TResponse = {
|
||||||
|
fields: TField[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type TField = {
|
||||||
|
name: string;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'List fields',
|
||||||
|
key: 'listFields',
|
||||||
|
|
||||||
|
async run($: IGlobalVariable) {
|
||||||
|
const { object } = $.step.parameters;
|
||||||
|
const response = await $.http.get<TResponse>(`/services/data/v56.0/sobjects/${object}/describe`);
|
||||||
|
|
||||||
|
const fields = response.data.fields.map((field) => {
|
||||||
|
return {
|
||||||
|
value: field.name,
|
||||||
|
name: field.label,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return { data: fields };
|
||||||
|
},
|
||||||
|
};
|
Reference in New Issue
Block a user