File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1515 */
1616
1717import { resolve , join } from 'node:path' ;
18- import * as process from 'node:process' ;
1918import { SfCommand , Flags } from '@salesforce/sf-plugins-core' ;
2019import { AuthInfo , Connection , Messages , SfError } from '@salesforce/core' ;
2120import React from 'react' ;
@@ -113,8 +112,14 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
113112 let selectedAgent ;
114113
115114 if ( flags [ 'authoring-bundle' ] ) {
115+ const envAgentName = env . getString ( 'SF_DEMO_AGENT' ) ;
116+ const agent = agentsQuery . records . find ( ( a ) => a . DeveloperName === envAgentName ) ;
116117 selectedAgent = {
117- Id : process . env . SF_DEMO_AGENT_ID ?? 'SF_DEMO_AGENT_ID is unset' ,
118+ Id :
119+ agent ?. Id ??
120+ `Couldn't find an agent in ${ agentsQuery . records . map ( ( a ) => a . DeveloperName ) . join ( ', ' ) } matching ${
121+ envAgentName ?? '!SF_DEMO_AGENT is unset!'
122+ } `,
118123 DeveloperName : flags [ 'authoring-bundle' ] ,
119124 } ;
120125 } else if ( apiNameFlag ) {
You can’t perform that action at this time.
0 commit comments