-
Notifications
You must be signed in to change notification settings - Fork 17
feat: prompt user to select lightning experince app #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| const appMenuItemsQuery = | ||
| 'SELECT Label,Description,Name FROM AppMenuItem WHERE IsAccessible=true AND IsVisible=TRUE'; | ||
| const appMenuItems = await connection.query<{ Label: string; Description: string; Name: string }>( | ||
| appMenuItemsQuery | ||
| ); | ||
|
|
||
| const appDefinitionsQuery = "SELECT DeveloperName,DurableId FROM AppDefinition WHERE UiType='Lightning'"; | ||
| const appDefinitions = await connection.query<{ DeveloperName: string; DurableId: string }>(appDefinitionsQuery); | ||
|
|
||
| appMenuItems.records.forEach((item) => { | ||
| const match = appDefinitions.records.find((definition) => definition.DeveloperName === item.Name); | ||
| if (match) { | ||
| results.push({ | ||
| DeveloperName: match.DeveloperName, | ||
| Label: item.Label, | ||
| Description: item.Description, | ||
| DurableId: match.DurableId, | ||
| }); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would do all of this in a single SQL statement using JOIN but as I understand it SF SOQL statements don't support JOIN so instead I run 2 query and filter in code (since it won't be the case that an org would have thousands and thousands of apps... but rather a handful of apps)
| // The appName is optional but if the user did provide an appName then it must be | ||
| // a valid one.... meaning that it should resolve to a valid appId. | ||
| const appId = await OrgUtils.getAppDefinitionDurableId(connection, appName); | ||
| if (!appId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If appName is not valid, should user be prompted too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not part of the UX design so we error out instead (which is consistent with the behavior of the Beta version).
sfdctaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What does this PR do?
If no value is provided for the flag
--namethen interactively prompts the user to select a lightning experience app.What issues does this PR fix or reference?
@W-16599797@