Let n8n create and update campaigns with scope sources
Replace the separate Add Source operation with multi-select source fields on create and update. Create passes accessReviewSourceIds to the existing GraphQL input; update gains the same omittable field and backend source sync so workflows can configure sources in one step. Load source options from the organization in the n8n UI, and keep surfacing INVALID errors when start fails for missing sources. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { proboApiRequest } from '../../GenericFunctions';
|
||||
import { accessReviewSourceIdsField } from './sources.fields';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
@@ -63,6 +64,7 @@ export const description: INodeProperties[] = [
|
||||
default: '',
|
||||
description: 'The description of the access review campaign',
|
||||
},
|
||||
accessReviewSourceIdsField,
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
@@ -72,6 +74,7 @@ export async function execute(
|
||||
const organizationId = this.getNodeParameter('organizationId', itemIndex) as string;
|
||||
const name = this.getNodeParameter('name', itemIndex) as string;
|
||||
const description = this.getNodeParameter('description', itemIndex, '') as string;
|
||||
const accessReviewSourceIds = this.getNodeParameter('accessReviewSourceIds', itemIndex, []) as string[];
|
||||
|
||||
const query = `
|
||||
mutation CreateAccessReviewCampaign($input: CreateAccessReviewCampaignInput!) {
|
||||
@@ -97,6 +100,7 @@ export async function execute(
|
||||
organizationId,
|
||||
name,
|
||||
...(description && { description }),
|
||||
...(accessReviewSourceIds.length > 0 && { accessReviewSourceIds }),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user