From 8fdd2bb88b538cc016bdef23f208380583453160 Mon Sep 17 00:00:00 2001 From: Katy Bowman Date: Tue, 4 Aug 2026 16:10:40 -0400 Subject: [PATCH 1/6] feat: add --no-assignment-rules flag to data create/update record Sends the Sforce-Auto-Assign: FALSE REST header so records created or updated by these commands aren't reassigned by active Account, Case, or Lead assignment rules. --- messages/record.create.md | 4 ++++ messages/record.update.md | 4 ++++ src/commands/data/create/record.ts | 8 +++++++- src/commands/data/update/record.ts | 7 ++++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/messages/record.create.md b/messages/record.create.md index c839f424b..6f541ff28 100644 --- a/messages/record.create.md +++ b/messages/record.create.md @@ -22,6 +22,10 @@ Values for the flags in the form =, separate multiple pairs wi Use Tooling API so you can insert a record in a Tooling API object. +# flags.no-assignment-rules.summary + +Don't apply active assignment rules when creating the record; applies to Account, Case, and Lead records. + # examples - Insert a record into the Account object of your default org; only the required Name field has a value: diff --git a/messages/record.update.md b/messages/record.update.md index 57be9d89c..71b1bd1b3 100644 --- a/messages/record.update.md +++ b/messages/record.update.md @@ -30,6 +30,10 @@ Use Tooling API so you can update a record in a Tooling API object. Fields that you're updating, in the format of = pairs. +# flags.no-assignment-rules.summary + +Don't apply active assignment rules when updating the record; applies to Account, Case, and Lead records. + # examples - Update the Name field of an Account record with the specified (truncated) ID: diff --git a/src/commands/data/create/record.ts b/src/commands/data/create/record.ts index 4da5ee333..ac38b97f8 100644 --- a/src/commands/data/create/record.ts +++ b/src/commands/data/create/record.ts @@ -50,6 +50,9 @@ export default class Create extends SfCommand { deprecateAliases: true, }), perflog: perflogFlag, + 'no-assignment-rules': Flags.boolean({ + summary: messages.getMessage('flags.no-assignment-rules.summary'), + }), }; public async run(): Promise { @@ -62,7 +65,10 @@ export default class Create extends SfCommand { : flags['target-org'].getConnection(flags['api-version']) ).sobject(flags.sobject); const values = stringToDictionary(flags.values); - const result = await sobject.insert(values); + const result = await sobject.insert( + values, + flags['no-assignment-rules'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {} + ); if (result.success) { this.log(messages.getMessage('createSuccess', [result.id || 'unknown id'])); this.spinner.stop(); diff --git a/src/commands/data/update/record.ts b/src/commands/data/update/record.ts index 9876ac7ee..02f2da1f5 100644 --- a/src/commands/data/update/record.ts +++ b/src/commands/data/update/record.ts @@ -72,6 +72,9 @@ export default class Update extends SfCommand { version: '57', }, }), + 'no-assignment-rules': Flags.boolean({ + summary: messages.getMessage('flags.no-assignment-rules.summary'), + }), }; public async run(): Promise { @@ -86,7 +89,9 @@ export default class Update extends SfCommand { const sObjectId = flags['record-id'] ?? ((await query(conn, flags.sobject, flags.where as string)).Id as string); try { const updateObject = { ...stringToDictionary(flags.values), Id: sObjectId }; - const result = await conn.sobject(flags.sobject).update(updateObject); + const result = await conn + .sobject(flags.sobject) + .update(updateObject, flags['no-assignment-rules'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {}); if (result.success) { this.log(messages.getMessage('updateSuccess', [sObjectId])); } else { From 73c2e839d325c5691af7b2808cec33ffcc94cc71 Mon Sep 17 00:00:00 2001 From: Katy Bowman Date: Tue, 4 Aug 2026 16:10:47 -0400 Subject: [PATCH 2/6] test: cover --no-assignment-rules header behavior in unit tests --- test/commands/data/create/record.test.ts | 23 +++++++++ test/commands/data/update/record.test.ts | 65 ++++++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/test/commands/data/create/record.test.ts b/test/commands/data/create/record.test.ts index f8933f230..27e8371a7 100644 --- a/test/commands/data/create/record.test.ts +++ b/test/commands/data/create/record.test.ts @@ -30,13 +30,16 @@ describe('data:create:record', () => { const config = new Config({ root: resolve(dirname(fileURLToPath(import.meta.url)), '../../../package.json'), }); + let capturedHeaders: Record | undefined; beforeEach(async () => { await $$.stubAuths(testOrg); await config.load(); + capturedHeaders = undefined; $$.fakeConnectionRequest = (request: AnyJson): Promise => { const requestWithUrl = ensureJsonMap(request); if (request && ensureString(requestWithUrl.url).includes('Account')) { + capturedHeaders = requestWithUrl.headers as Record | undefined; return Promise.resolve({ id: sObjectId, success: true, @@ -56,4 +59,24 @@ describe('data:create:record', () => { const result = await cmd.run(); expect(result.id).to.equal(sObjectId); }); + + it('should not send the Sforce-Auto-Assign header by default', async () => { + const cmd = new Create( + ['--target-org', 'test@org.com', '--sobject', 'Account', '-v', '"Name=Acme"', '--json'], + config + ); + + await cmd.run(); + expect(capturedHeaders).to.not.have.property('Sforce-Auto-Assign'); + }); + + it('should send Sforce-Auto-Assign: FALSE when --no-assignment-rules is set', async () => { + const cmd = new Create( + ['--target-org', 'test@org.com', '--sobject', 'Account', '-v', '"Name=Acme"', '--no-assignment-rules', '--json'], + config + ); + + await cmd.run(); + expect(capturedHeaders).to.have.property('Sforce-Auto-Assign', 'FALSE'); + }); }); diff --git a/test/commands/data/update/record.test.ts b/test/commands/data/update/record.test.ts index b4472172d..4e038b9a2 100644 --- a/test/commands/data/update/record.test.ts +++ b/test/commands/data/update/record.test.ts @@ -121,6 +121,71 @@ describe('data:update:record', () => { } }); + it('should not send the Sforce-Auto-Assign header by default', async () => { + let capturedHeaders: Record | undefined; + $$.fakeConnectionRequest = (request: AnyJson): Promise => { + const requestMap = ensureJsonMap(request); + if (ensureString(requestMap.url).includes('query')) { + return Promise.resolve({ records: [{ Id: sObjectId }] }); + } + if (ensureString(requestMap.url).includes('Account')) { + capturedHeaders = requestMap.headers as Record | undefined; + return Promise.resolve({ id: sObjectId, success: true, errors: [] }); + } + return Promise.resolve({}); + }; + + const cmd = new Update( + [ + '--target-org', + 'test@org.com', + '--sobject', + 'Account', + '--record-id', + sObjectId, + '-v', + '"Name=NewName"', + '--json', + ], + config + ); + await cmd.run(); + expect(capturedHeaders).to.not.have.property('Sforce-Auto-Assign'); + }); + + it('should send Sforce-Auto-Assign: FALSE when --no-assignment-rules is set', async () => { + let capturedHeaders: Record | undefined; + $$.fakeConnectionRequest = (request: AnyJson): Promise => { + const requestMap = ensureJsonMap(request); + if (ensureString(requestMap.url).includes('query')) { + return Promise.resolve({ records: [{ Id: sObjectId }] }); + } + if (ensureString(requestMap.url).includes('Account')) { + capturedHeaders = requestMap.headers as Record | undefined; + return Promise.resolve({ id: sObjectId, success: true, errors: [] }); + } + return Promise.resolve({}); + }; + + const cmd = new Update( + [ + '--target-org', + 'test@org.com', + '--sobject', + 'Account', + '--record-id', + sObjectId, + '-v', + '"Name=NewName"', + '--no-assignment-rules', + '--json', + ], + config + ); + await cmd.run(); + expect(capturedHeaders).to.have.property('Sforce-Auto-Assign', 'FALSE'); + }); + it('should throw an error if both --where and --record-id are provided', async () => { const cmd = new Update( [ From 7bfe7cd2c2d6f04331455a0b9016fbcc5979f047 Mon Sep 17 00:00:00 2001 From: Katy Bowman Date: Tue, 4 Aug 2026 16:11:02 -0400 Subject: [PATCH 3/6] test: add NUTs for --no-assignment-rules on data create/update record Adds a Case assignment rule and TestCaseQueue to the test data project so NUTs can verify the header suppresses reassignment end-to-end. --- test/commands/data/record/dataRecord.nut.ts | 85 +++++++++++++++++++ .../Case.assignmentRules-meta.xml | 17 ++++ .../queues/TestCaseQueue.queue-meta.xml | 8 ++ 3 files changed, 110 insertions(+) create mode 100644 test/test-files/data-project/force-app/main/default/assignmentRules/Case.assignmentRules-meta.xml create mode 100644 test/test-files/data-project/force-app/main/default/queues/TestCaseQueue.queue-meta.xml diff --git a/test/commands/data/record/dataRecord.nut.ts b/test/commands/data/record/dataRecord.nut.ts index 45fd89876..c424e0cf4 100644 --- a/test/commands/data/record/dataRecord.nut.ts +++ b/test/commands/data/record/dataRecord.nut.ts @@ -262,6 +262,91 @@ describe('data:record commands', () => { }); }); + describe('no-assignment-rules flag', () => { + // The Case assignment rule in the test project routes Cases whose Subject starts with + // "AssignmentRuleTest" to TestCaseQueue. When --no-assignment-rules is passed, the record + // should stay owned by the running user instead of being reassigned to the queue. + type CaseRecord = { Id: string; OwnerId: string; Subject: string }; + type QueueRecord = { records: Array<{ Id: string }> }; + + let queueId: string; + let runningUserId: string; + + before(() => { + const queue = execCmd( + "data:query --query \"SELECT Id FROM Group WHERE Type='Queue' AND DeveloperName='TestCaseQueue'\" --json", + { ensureExitCode: 0 } + ).jsonOutput?.result; + assert(queue?.records?.[0]?.Id, 'TestCaseQueue must exist in the scratch org'); + queueId = queue.records[0].Id; + + // Determine the running user by creating a Case that does NOT match the assignment rule + // and reading its OwnerId — avoids brittle username/alias lookups. + const seed = execCmd( + `data:create:record --sobject Case --values "Subject='NoRuleMatchSeed-${genUniqueString()}'" --json`, + { ensureExitCode: 0 } + ).jsonOutput?.result; + assert(seed?.id); + const seedRecord = execCmd(`data:get:record --sobject Case --record-id ${seed.id} --json`, { + ensureExitCode: 0, + }).jsonOutput?.result; + assert(seedRecord?.OwnerId); + runningUserId = seedRecord.OwnerId; + }); + + it('assigns Case to the queue when --no-assignment-rules is NOT set', () => { + const subject = `AssignmentRuleTest-${genUniqueString()}`; + const createResponse = execCmd( + `data:create:record --sobject Case --values "Subject='${subject}'" --json`, + { ensureExitCode: 0 } + ).jsonOutput?.result; + assert(createResponse?.id); + + const getResponse = execCmd( + `data:get:record --sobject Case --record-id ${createResponse.id} --json`, + { ensureExitCode: 0 } + ).jsonOutput?.result; + expect(getResponse).to.have.property('OwnerId', queueId); + }); + + it('leaves Case owned by the running user when --no-assignment-rules is set on create', () => { + const subject = `AssignmentRuleTest-${genUniqueString()}`; + const createResponse = execCmd( + `data:create:record --sobject Case --values "Subject='${subject}'" --no-assignment-rules --json`, + { ensureExitCode: 0 } + ).jsonOutput?.result; + assert(createResponse?.id); + + const getResponse = execCmd( + `data:get:record --sobject Case --record-id ${createResponse.id} --json`, + { ensureExitCode: 0 } + ).jsonOutput?.result; + expect(getResponse).to.have.property('OwnerId', runningUserId); + }); + + it('leaves Case owner unchanged on update when --no-assignment-rules is set', () => { + // Seed a Case that does NOT match the rule (so it's owned by the running user). + const seedSubject = `NoRuleMatch-${genUniqueString()}`; + const seed = execCmd( + `data:create:record --sobject Case --values "Subject='${seedSubject}'" --no-assignment-rules --json`, + { ensureExitCode: 0 } + ).jsonOutput?.result; + assert(seed?.id); + + // Update to a subject that would match the assignment rule, but suppress it. + const newSubject = `AssignmentRuleTest-${genUniqueString()}`; + execCmd( + `data:update:record --sobject Case --record-id ${seed.id} --values "Subject='${newSubject}'" --no-assignment-rules --json`, + { ensureExitCode: 0 } + ); + + const getResponse = execCmd(`data:get:record --sobject Case --record-id ${seed.id} --json`, { + ensureExitCode: 0, + }).jsonOutput?.result; + expect(getResponse).to.have.property('OwnerId', runningUserId); + }); + }); + describe('json parsing', () => { it('will parse JSON correctly for update', () => { const result = execCmd<{ records: Array<{ Id: string }> }>( diff --git a/test/test-files/data-project/force-app/main/default/assignmentRules/Case.assignmentRules-meta.xml b/test/test-files/data-project/force-app/main/default/assignmentRules/Case.assignmentRules-meta.xml new file mode 100644 index 000000000..ea3f6fa10 --- /dev/null +++ b/test/test-files/data-project/force-app/main/default/assignmentRules/Case.assignmentRules-meta.xml @@ -0,0 +1,17 @@ + + + + TestCaseAssignmentRule + true + + TestCaseQueue + Queue + 1 + + Case.Subject + startsWith + AssignmentRuleTest + + + + diff --git a/test/test-files/data-project/force-app/main/default/queues/TestCaseQueue.queue-meta.xml b/test/test-files/data-project/force-app/main/default/queues/TestCaseQueue.queue-meta.xml new file mode 100644 index 000000000..850313079 --- /dev/null +++ b/test/test-files/data-project/force-app/main/default/queues/TestCaseQueue.queue-meta.xml @@ -0,0 +1,8 @@ + + + Test Case Queue + false + + Case + + From 4b3fe2dd378a005f3277c57a58cba6490db0bed1 Mon Sep 17 00:00:00 2001 From: Katy Bowman Date: Tue, 4 Aug 2026 16:42:05 -0400 Subject: [PATCH 4/6] chore: update snapshot --- command-snapshot.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command-snapshot.json b/command-snapshot.json index de919e69a..54a873bec 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -25,6 +25,7 @@ "flags-dir", "json", "loglevel", + "no-assignment-rules", "perflog", "sobject", "target-org", @@ -234,6 +235,7 @@ "flags-dir", "json", "loglevel", + "no-assignment-rules", "perflog", "record-id", "sobject", From 55940a4d2f05873dd4b05714f1edb205ae97b4db Mon Sep 17 00:00:00 2001 From: Katy Bowman Date: Wed, 5 Aug 2026 09:20:44 -0400 Subject: [PATCH 5/6] refactor: rename --no-assignment-rules to --skip-rule-assignment --- command-snapshot.json | 4 ++-- messages/record.create.md | 2 +- messages/record.update.md | 2 +- src/commands/data/create/record.ts | 6 +++--- src/commands/data/update/record.ts | 6 +++--- test/commands/data/create/record.test.ts | 4 ++-- test/commands/data/record/dataRecord.nut.ts | 16 ++++++++-------- test/commands/data/update/record.test.ts | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index 54a873bec..0e3fdd2e5 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -25,8 +25,8 @@ "flags-dir", "json", "loglevel", - "no-assignment-rules", "perflog", + "skip-rule-assignment", "sobject", "target-org", "use-tooling-api", @@ -235,9 +235,9 @@ "flags-dir", "json", "loglevel", - "no-assignment-rules", "perflog", "record-id", + "skip-rule-assignment", "sobject", "target-org", "use-tooling-api", diff --git a/messages/record.create.md b/messages/record.create.md index 6f541ff28..f986d2603 100644 --- a/messages/record.create.md +++ b/messages/record.create.md @@ -22,7 +22,7 @@ Values for the flags in the form =, separate multiple pairs wi Use Tooling API so you can insert a record in a Tooling API object. -# flags.no-assignment-rules.summary +# flags.skip-rule-assignment.summary Don't apply active assignment rules when creating the record; applies to Account, Case, and Lead records. diff --git a/messages/record.update.md b/messages/record.update.md index 71b1bd1b3..e215319cc 100644 --- a/messages/record.update.md +++ b/messages/record.update.md @@ -30,7 +30,7 @@ Use Tooling API so you can update a record in a Tooling API object. Fields that you're updating, in the format of = pairs. -# flags.no-assignment-rules.summary +# flags.skip-rule-assignment.summary Don't apply active assignment rules when updating the record; applies to Account, Case, and Lead records. diff --git a/src/commands/data/create/record.ts b/src/commands/data/create/record.ts index ac38b97f8..e82c22fd2 100644 --- a/src/commands/data/create/record.ts +++ b/src/commands/data/create/record.ts @@ -50,8 +50,8 @@ export default class Create extends SfCommand { deprecateAliases: true, }), perflog: perflogFlag, - 'no-assignment-rules': Flags.boolean({ - summary: messages.getMessage('flags.no-assignment-rules.summary'), + 'skip-rule-assignment': Flags.boolean({ + summary: messages.getMessage('flags.skip-rule-assignment.summary'), }), }; @@ -67,7 +67,7 @@ export default class Create extends SfCommand { const values = stringToDictionary(flags.values); const result = await sobject.insert( values, - flags['no-assignment-rules'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {} + flags['skip-rule-assignment'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {} ); if (result.success) { this.log(messages.getMessage('createSuccess', [result.id || 'unknown id'])); diff --git a/src/commands/data/update/record.ts b/src/commands/data/update/record.ts index 02f2da1f5..d534b9e03 100644 --- a/src/commands/data/update/record.ts +++ b/src/commands/data/update/record.ts @@ -72,8 +72,8 @@ export default class Update extends SfCommand { version: '57', }, }), - 'no-assignment-rules': Flags.boolean({ - summary: messages.getMessage('flags.no-assignment-rules.summary'), + 'skip-rule-assignment': Flags.boolean({ + summary: messages.getMessage('flags.skip-rule-assignment.summary'), }), }; @@ -91,7 +91,7 @@ export default class Update extends SfCommand { const updateObject = { ...stringToDictionary(flags.values), Id: sObjectId }; const result = await conn .sobject(flags.sobject) - .update(updateObject, flags['no-assignment-rules'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {}); + .update(updateObject, flags['skip-rule-assignment'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {}); if (result.success) { this.log(messages.getMessage('updateSuccess', [sObjectId])); } else { diff --git a/test/commands/data/create/record.test.ts b/test/commands/data/create/record.test.ts index 27e8371a7..458432830 100644 --- a/test/commands/data/create/record.test.ts +++ b/test/commands/data/create/record.test.ts @@ -70,9 +70,9 @@ describe('data:create:record', () => { expect(capturedHeaders).to.not.have.property('Sforce-Auto-Assign'); }); - it('should send Sforce-Auto-Assign: FALSE when --no-assignment-rules is set', async () => { + it('should send Sforce-Auto-Assign: FALSE when --skip-rule-assignment is set', async () => { const cmd = new Create( - ['--target-org', 'test@org.com', '--sobject', 'Account', '-v', '"Name=Acme"', '--no-assignment-rules', '--json'], + ['--target-org', 'test@org.com', '--sobject', 'Account', '-v', '"Name=Acme"', '--skip-rule-assignment', '--json'], config ); diff --git a/test/commands/data/record/dataRecord.nut.ts b/test/commands/data/record/dataRecord.nut.ts index c424e0cf4..b30cdfd53 100644 --- a/test/commands/data/record/dataRecord.nut.ts +++ b/test/commands/data/record/dataRecord.nut.ts @@ -262,9 +262,9 @@ describe('data:record commands', () => { }); }); - describe('no-assignment-rules flag', () => { + describe('skip-rule-assignment flag', () => { // The Case assignment rule in the test project routes Cases whose Subject starts with - // "AssignmentRuleTest" to TestCaseQueue. When --no-assignment-rules is passed, the record + // "AssignmentRuleTest" to TestCaseQueue. When --skip-rule-assignment is passed, the record // should stay owned by the running user instead of being reassigned to the queue. type CaseRecord = { Id: string; OwnerId: string; Subject: string }; type QueueRecord = { records: Array<{ Id: string }> }; @@ -294,7 +294,7 @@ describe('data:record commands', () => { runningUserId = seedRecord.OwnerId; }); - it('assigns Case to the queue when --no-assignment-rules is NOT set', () => { + it('assigns Case to the queue when --skip-rule-assignment is NOT set', () => { const subject = `AssignmentRuleTest-${genUniqueString()}`; const createResponse = execCmd( `data:create:record --sobject Case --values "Subject='${subject}'" --json`, @@ -309,10 +309,10 @@ describe('data:record commands', () => { expect(getResponse).to.have.property('OwnerId', queueId); }); - it('leaves Case owned by the running user when --no-assignment-rules is set on create', () => { + it('leaves Case owned by the running user when --skip-rule-assignment is set on create', () => { const subject = `AssignmentRuleTest-${genUniqueString()}`; const createResponse = execCmd( - `data:create:record --sobject Case --values "Subject='${subject}'" --no-assignment-rules --json`, + `data:create:record --sobject Case --values "Subject='${subject}'" --skip-rule-assignment --json`, { ensureExitCode: 0 } ).jsonOutput?.result; assert(createResponse?.id); @@ -324,11 +324,11 @@ describe('data:record commands', () => { expect(getResponse).to.have.property('OwnerId', runningUserId); }); - it('leaves Case owner unchanged on update when --no-assignment-rules is set', () => { + it('leaves Case owner unchanged on update when --skip-rule-assignment is set', () => { // Seed a Case that does NOT match the rule (so it's owned by the running user). const seedSubject = `NoRuleMatch-${genUniqueString()}`; const seed = execCmd( - `data:create:record --sobject Case --values "Subject='${seedSubject}'" --no-assignment-rules --json`, + `data:create:record --sobject Case --values "Subject='${seedSubject}'" --skip-rule-assignment --json`, { ensureExitCode: 0 } ).jsonOutput?.result; assert(seed?.id); @@ -336,7 +336,7 @@ describe('data:record commands', () => { // Update to a subject that would match the assignment rule, but suppress it. const newSubject = `AssignmentRuleTest-${genUniqueString()}`; execCmd( - `data:update:record --sobject Case --record-id ${seed.id} --values "Subject='${newSubject}'" --no-assignment-rules --json`, + `data:update:record --sobject Case --record-id ${seed.id} --values "Subject='${newSubject}'" --skip-rule-assignment --json`, { ensureExitCode: 0 } ); diff --git a/test/commands/data/update/record.test.ts b/test/commands/data/update/record.test.ts index 4e038b9a2..59c8cc37d 100644 --- a/test/commands/data/update/record.test.ts +++ b/test/commands/data/update/record.test.ts @@ -153,7 +153,7 @@ describe('data:update:record', () => { expect(capturedHeaders).to.not.have.property('Sforce-Auto-Assign'); }); - it('should send Sforce-Auto-Assign: FALSE when --no-assignment-rules is set', async () => { + it('should send Sforce-Auto-Assign: FALSE when --skip-rule-assignment is set', async () => { let capturedHeaders: Record | undefined; $$.fakeConnectionRequest = (request: AnyJson): Promise => { const requestMap = ensureJsonMap(request); @@ -177,7 +177,7 @@ describe('data:update:record', () => { sObjectId, '-v', '"Name=NewName"', - '--no-assignment-rules', + '--skip-rule-assignment', '--json', ], config From 0018bcd1be974d2edef02f87423cc01bb542845d Mon Sep 17 00:00:00 2001 From: Katy Bowman Date: Wed, 5 Aug 2026 09:43:16 -0400 Subject: [PATCH 6/6] refactor: rename --skip-rule-assignment to --skip-assignment-rules --- command-snapshot.json | 4 ++-- messages/record.create.md | 2 +- messages/record.update.md | 2 +- src/commands/data/create/record.ts | 6 +++--- src/commands/data/update/record.ts | 6 +++--- test/commands/data/create/record.test.ts | 13 +++++++++++-- test/commands/data/record/dataRecord.nut.ts | 16 ++++++++-------- test/commands/data/update/record.test.ts | 4 ++-- 8 files changed, 31 insertions(+), 22 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index 0e3fdd2e5..078cc7f05 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -26,7 +26,7 @@ "json", "loglevel", "perflog", - "skip-rule-assignment", + "skip-assignment-rules", "sobject", "target-org", "use-tooling-api", @@ -237,7 +237,7 @@ "loglevel", "perflog", "record-id", - "skip-rule-assignment", + "skip-assignment-rules", "sobject", "target-org", "use-tooling-api", diff --git a/messages/record.create.md b/messages/record.create.md index f986d2603..003c03f7e 100644 --- a/messages/record.create.md +++ b/messages/record.create.md @@ -22,7 +22,7 @@ Values for the flags in the form =, separate multiple pairs wi Use Tooling API so you can insert a record in a Tooling API object. -# flags.skip-rule-assignment.summary +# flags.skip-assignment-rules.summary Don't apply active assignment rules when creating the record; applies to Account, Case, and Lead records. diff --git a/messages/record.update.md b/messages/record.update.md index e215319cc..c862642e1 100644 --- a/messages/record.update.md +++ b/messages/record.update.md @@ -30,7 +30,7 @@ Use Tooling API so you can update a record in a Tooling API object. Fields that you're updating, in the format of = pairs. -# flags.skip-rule-assignment.summary +# flags.skip-assignment-rules.summary Don't apply active assignment rules when updating the record; applies to Account, Case, and Lead records. diff --git a/src/commands/data/create/record.ts b/src/commands/data/create/record.ts index e82c22fd2..294486d41 100644 --- a/src/commands/data/create/record.ts +++ b/src/commands/data/create/record.ts @@ -50,8 +50,8 @@ export default class Create extends SfCommand { deprecateAliases: true, }), perflog: perflogFlag, - 'skip-rule-assignment': Flags.boolean({ - summary: messages.getMessage('flags.skip-rule-assignment.summary'), + 'skip-assignment-rules': Flags.boolean({ + summary: messages.getMessage('flags.skip-assignment-rules.summary'), }), }; @@ -67,7 +67,7 @@ export default class Create extends SfCommand { const values = stringToDictionary(flags.values); const result = await sobject.insert( values, - flags['skip-rule-assignment'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {} + flags['skip-assignment-rules'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {} ); if (result.success) { this.log(messages.getMessage('createSuccess', [result.id || 'unknown id'])); diff --git a/src/commands/data/update/record.ts b/src/commands/data/update/record.ts index d534b9e03..38a84ac9f 100644 --- a/src/commands/data/update/record.ts +++ b/src/commands/data/update/record.ts @@ -72,8 +72,8 @@ export default class Update extends SfCommand { version: '57', }, }), - 'skip-rule-assignment': Flags.boolean({ - summary: messages.getMessage('flags.skip-rule-assignment.summary'), + 'skip-assignment-rules': Flags.boolean({ + summary: messages.getMessage('flags.skip-assignment-rules.summary'), }), }; @@ -91,7 +91,7 @@ export default class Update extends SfCommand { const updateObject = { ...stringToDictionary(flags.values), Id: sObjectId }; const result = await conn .sobject(flags.sobject) - .update(updateObject, flags['skip-rule-assignment'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {}); + .update(updateObject, flags['skip-assignment-rules'] ? { headers: { 'Sforce-Auto-Assign': 'FALSE' } } : {}); if (result.success) { this.log(messages.getMessage('updateSuccess', [sObjectId])); } else { diff --git a/test/commands/data/create/record.test.ts b/test/commands/data/create/record.test.ts index 458432830..76e5bd426 100644 --- a/test/commands/data/create/record.test.ts +++ b/test/commands/data/create/record.test.ts @@ -70,9 +70,18 @@ describe('data:create:record', () => { expect(capturedHeaders).to.not.have.property('Sforce-Auto-Assign'); }); - it('should send Sforce-Auto-Assign: FALSE when --skip-rule-assignment is set', async () => { + it('should send Sforce-Auto-Assign: FALSE when --skip-assignment-rules is set', async () => { const cmd = new Create( - ['--target-org', 'test@org.com', '--sobject', 'Account', '-v', '"Name=Acme"', '--skip-rule-assignment', '--json'], + [ + '--target-org', + 'test@org.com', + '--sobject', + 'Account', + '-v', + '"Name=Acme"', + '--skip-assignment-rules', + '--json', + ], config ); diff --git a/test/commands/data/record/dataRecord.nut.ts b/test/commands/data/record/dataRecord.nut.ts index b30cdfd53..0a648a61e 100644 --- a/test/commands/data/record/dataRecord.nut.ts +++ b/test/commands/data/record/dataRecord.nut.ts @@ -262,9 +262,9 @@ describe('data:record commands', () => { }); }); - describe('skip-rule-assignment flag', () => { + describe('skip-assignment-rules flag', () => { // The Case assignment rule in the test project routes Cases whose Subject starts with - // "AssignmentRuleTest" to TestCaseQueue. When --skip-rule-assignment is passed, the record + // "AssignmentRuleTest" to TestCaseQueue. When --skip-assignment-rules is passed, the record // should stay owned by the running user instead of being reassigned to the queue. type CaseRecord = { Id: string; OwnerId: string; Subject: string }; type QueueRecord = { records: Array<{ Id: string }> }; @@ -294,7 +294,7 @@ describe('data:record commands', () => { runningUserId = seedRecord.OwnerId; }); - it('assigns Case to the queue when --skip-rule-assignment is NOT set', () => { + it('assigns Case to the queue when --skip-assignment-rules is NOT set', () => { const subject = `AssignmentRuleTest-${genUniqueString()}`; const createResponse = execCmd( `data:create:record --sobject Case --values "Subject='${subject}'" --json`, @@ -309,10 +309,10 @@ describe('data:record commands', () => { expect(getResponse).to.have.property('OwnerId', queueId); }); - it('leaves Case owned by the running user when --skip-rule-assignment is set on create', () => { + it('leaves Case owned by the running user when --skip-assignment-rules is set on create', () => { const subject = `AssignmentRuleTest-${genUniqueString()}`; const createResponse = execCmd( - `data:create:record --sobject Case --values "Subject='${subject}'" --skip-rule-assignment --json`, + `data:create:record --sobject Case --values "Subject='${subject}'" --skip-assignment-rules --json`, { ensureExitCode: 0 } ).jsonOutput?.result; assert(createResponse?.id); @@ -324,11 +324,11 @@ describe('data:record commands', () => { expect(getResponse).to.have.property('OwnerId', runningUserId); }); - it('leaves Case owner unchanged on update when --skip-rule-assignment is set', () => { + it('leaves Case owner unchanged on update when --skip-assignment-rules is set', () => { // Seed a Case that does NOT match the rule (so it's owned by the running user). const seedSubject = `NoRuleMatch-${genUniqueString()}`; const seed = execCmd( - `data:create:record --sobject Case --values "Subject='${seedSubject}'" --skip-rule-assignment --json`, + `data:create:record --sobject Case --values "Subject='${seedSubject}'" --skip-assignment-rules --json`, { ensureExitCode: 0 } ).jsonOutput?.result; assert(seed?.id); @@ -336,7 +336,7 @@ describe('data:record commands', () => { // Update to a subject that would match the assignment rule, but suppress it. const newSubject = `AssignmentRuleTest-${genUniqueString()}`; execCmd( - `data:update:record --sobject Case --record-id ${seed.id} --values "Subject='${newSubject}'" --skip-rule-assignment --json`, + `data:update:record --sobject Case --record-id ${seed.id} --values "Subject='${newSubject}'" --skip-assignment-rules --json`, { ensureExitCode: 0 } ); diff --git a/test/commands/data/update/record.test.ts b/test/commands/data/update/record.test.ts index 59c8cc37d..9de579f95 100644 --- a/test/commands/data/update/record.test.ts +++ b/test/commands/data/update/record.test.ts @@ -153,7 +153,7 @@ describe('data:update:record', () => { expect(capturedHeaders).to.not.have.property('Sforce-Auto-Assign'); }); - it('should send Sforce-Auto-Assign: FALSE when --skip-rule-assignment is set', async () => { + it('should send Sforce-Auto-Assign: FALSE when --skip-assignment-rules is set', async () => { let capturedHeaders: Record | undefined; $$.fakeConnectionRequest = (request: AnyJson): Promise => { const requestMap = ensureJsonMap(request); @@ -177,7 +177,7 @@ describe('data:update:record', () => { sObjectId, '-v', '"Name=NewName"', - '--skip-rule-assignment', + '--skip-assignment-rules', '--json', ], config