0

I am pretty new to using lwc and I was using the uiListApi to query records for the workorder object. A couple days ago the query was working just fine and I was able to query the records based on the selected listview on my scratch org but now I don't seem to get any records at all. I am not really sure what the problem is as I haven't made any changes to the code in days. The namespace is just the current namespace I am working with, not sure if I need to add the namespace I am working to the listViewName.

import { LightningElement, wire} from 'lwc';
import {getListUi} from 'lightning/uiListApi';
import WORKORDER_OBJECT from '@salesforce/schema/Workorder__c'
import listViews from '@salesforce/apex/ServiceCalendarController.listValues'
import { refreshApex } from '@salesforce/apex';
export default class CalendarFilter extends LightningElement {
    listViewName = 'NAMESPACE__All';
    queriedRecords;
    @wire(getListUi, {
        objectApiName: WORKORDER_OBJECT,
        listViewApiName: '$listViewName'
    })
    wiredlistView
    ({
        error,
        data
    })
    {
        if (data)
        {
            this.queriedRecords = data.records.records;
            this.dispatchEvent(new CustomEvent('valuechange',
            {
                detail:
                {
                    data: this.queriedRecords
                }
            }));
        }
    }
    handleChange(event)
    {
        refreshApex(this.wiredlistView);
        this.listViewName = 'NAMESPACE__' + event.detail.value;
    }
}
1
  • I've noticed this breaking in summer20 release too. I can see the network request succeeds, but @wire callback is never called.
    – dzh
    Commented Jun 4, 2020 at 1:21

1 Answer 1

1

Thanks for letting us know about this. Based on the symptoms you describe this sounds like a known bug that has been fixed in the in-development version of Salesforce. If you can report the issue through the normal support channels it will help us correctly prioritize backporting the fix.

For anyone else that runs across this, the underlying issue prevents using listViewApiName/objectApiName to wire list views from a namespace.

I'm not 100% certain this will work, but as a temporary workaround you might try requesting the list view by its id (listViewId) rather than its name. Your code will only work for a single org (yuck) but it might let you make progress while we get this sorted out.

2
  • Thanks Mike, that worked. Didn't realise there's API for getting views by Id now. It is actually going to make usage of API easier - previously we used to check if there's a namespace on list view and prepend it to a list view name before invoking a wire. We can still dynamically pass view Id (and we even have a fallback to REST API in cases where current API fails - Territory2 or User objects (tho in this case there was no error at all)). If you know more about perils of using this API from a AppExchange package - do let me know!
    – dzh
    Commented Jun 4, 2020 at 21:52
  • No other issues that we know of, but please report any that you run across! This particular bug was only found a few weeks ago by a Salesforce engineer working on a demo.
    – Mike Burr
    Commented Jun 5, 2020 at 1:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .