Skip to content
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

[data-export] Double "Show all data" button #63

Closed
tprouvot opened this issue Apr 17, 2023 · 5 comments · Fixed by #291
Closed

[data-export] Double "Show all data" button #63

tprouvot opened this issue Apr 17, 2023 · 5 comments · Fixed by #291
Assignees
Labels
bug Something isn't working

Comments

@tprouvot
Copy link
Owner

tprouvot commented Apr 17, 2023

Describe the bug
When running a query on ContentDocument, we have two buttons "Show all data", one for ContentDocument and the other for ContentNote (the extra one to remove)

image

SELECT Id, title FROM ContentDocument WHERE LatestPublishedVersionId ='068XXXXXXXX'

@tprouvot tprouvot added the bug Something isn't working label Apr 17, 2023
@tprouvot tprouvot self-assigned this Apr 17, 2023
@baslu93
Copy link
Contributor

baslu93 commented Sep 27, 2023

Hi @tprouvot,

I was not able to replicate it.
I'm using the latest version, was it fixed already?

image

@tprouvot
Copy link
Owner Author

Hi @baslu93 ,
This is not fixed yet but it may depends on the ContentDocument type or it's context creation.
I'll check today if I can add more information on the use case

@tprouvot
Copy link
Owner Author

Hi @baslu93,

It looks like this bug only occurs on orgs that have Notes enabled:

image

@baslu93
Copy link
Contributor

baslu93 commented Sep 28, 2023

Hi @tprouvot,

Thank you!
I was able to replicate it.

You can assign the issue to me.

@tprouvot
Copy link
Owner Author

Hi @baslu93,
Sorry for the delay reviewing the PR.

I like the idea to do a callout on ui-api to get the object name but I would prever to do it only when needed.
In our case it would be when objectTypes lenght is more than 1.

There is also a new feature (Query record) which relies on the sobject name and must be available from data-export page.
I think something like this could do the job but we have to manage the delay to get the rest response on time:

    popLink(
      () => {
        let recordId = cell;
        let {globalDescribe} = rt.describeInfo.describeGlobal(rt.isTooling);
        let objectTypes = [];
        if (globalDescribe) {
          let keyPrefix = recordId.substring(0, 3);
          objectTypes = globalDescribe.sobjects.filter(sobject => sobject.keyPrefix == keyPrefix).map(sobject => sobject.name);
          //particular use case when multiple sobjects have the same keyPrefix
          if (objectTypes.length > 1){
            sfConn.rest(`/services/data/v${apiVersion}/ui-api/records/${recordId}?layoutTypes=Compact`).then(res => {
              objectTypes = objectTypes.filter(objectType => objectType == res.apiName);
            });
          }
        }
        return {objectTypes, recordId};
      },
      cell
    );

tprouvot added a commit that referenced this issue Jan 29, 2024
## Describe your changes
I created a new pull request, following @tprouvot suggestion.
Now only when the object is one of the following:
| Object Name | Key Prefix |
| ------------- | ------------- |
| entitlementcontact | 000 |
| entitysubscription | 000 |
| productentitlementtemplate | 000 |
| casecomment | 00a |
| ideacomment | 00a |
| accountpartner | 00I |
| opportunitypartner | 00I |
| partner | 00I |
| leadstatus | 01J |
| opportunitystage | 01J |
| contentdocument | 069 |
| contentnote | 069 |

a callout using `/ui-api/records/` is fired to get the exact Object
ApiName.
The api has `layoutTypes=Compact` so that not all the layout infos are
pulled, but just the compact layout infos.
In the objects listed above the changes that can be applied to the
compact layout are limited, so that I expect the api speed cannot
drammatically change.

### Test executed:
- Click "Show all data" in the query results of "SELECT Id FROM Account"
- Click "Query record" in the query results of "SELECT Id FROM Account"
- Click "Show all data" in the query results of "SELECT Id FROM
ContentDocument"
- Click "Query record" in the query results of "SELECT Id FROM
ContentDocument"
- Click "Show all data" in the query results of "SELECT Id,WhatId FROM
Task" (both Id and WhaId)
- Click "Query record" in the query results of "SELECT Id,WhatId FROM
Task" (both Id and WhaId)

## Issue ticket number and link
[Issue
63](#63)

## Checklist before requesting a review
- [x] I have read and understand the [Contributions
section](https://github.com/tprouvot/Salesforce-Inspector-reloaded#contributions)
- [x] Target branch is releaseCandidate and not master
- [x] I have performed a self-review of my code
- [x] I documented the changes I've made on the
[CHANGES.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/CHANGES.md)
and followed actual conventions
- [ ] I ran the [unit
tests](https://github.com/tprouvot/Salesforce-Inspector-reloaded#unit-tests)
and my PR does not break any tests
- [ ] I added a new section on
[how-to.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/docs/how-to.md)
(optional)

---------

Co-authored-by: DIR\luca.bassani <[email protected]>
Co-authored-by: Thomas Prouvot <[email protected]>
@tprouvot tprouvot pinned this issue Jan 29, 2024
@tprouvot tprouvot unpinned this issue Jan 29, 2024
@tprouvot tprouvot linked a pull request Jan 29, 2024 that will close this issue
6 tasks
@dufoli dufoli mentioned this issue Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants