mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-12 16:10:30 +02:00
Merge 04d81307a2 into 0ce820de73
This commit is contained in:
commit
b38b759a63
|
|
@ -92,18 +92,19 @@ export class ERPNext implements INodeType {
|
|||
},
|
||||
async getDocFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const docType = this.getCurrentNodeParameter('docType') as string;
|
||||
const { data } = await erpNextApiRequest.call(
|
||||
const response = await erpNextApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/api/resource/DocType/${docType}`,
|
||||
`/api/method/frappe.desk.form.load.getdoctype?doctype=${docType}`,
|
||||
{},
|
||||
);
|
||||
|
||||
const docFields = data.fields.map(
|
||||
({ label, fieldname }: { label: string; fieldname: string }) => {
|
||||
return { name: label, value: fieldname };
|
||||
},
|
||||
);
|
||||
const docFields = response.docs
|
||||
.flatMap((doc: { fields: { label: string; fieldname: string }[] }) => doc.fields)
|
||||
.map(({ label, fieldname }: { label: string; fieldname: string }) => ({
|
||||
name: label,
|
||||
value: fieldname,
|
||||
}));
|
||||
|
||||
return processNames(docFields);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user