Questions tagged [wire]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
7
votes
1answer
541 views

Chain Apex Methods in LWC

I am having a situation where I'm trying to pop an alert on an opportunity, but it's conditional based on data on the current user, and data on a custom object. I noticed that on refreshes the alert ...
5
votes
1answer
152 views

Can an @AuraEnabled method be added in a managed package patch release?

I have a managed package with an LWC component. I need to enhance this LWC in a patch to allow it to receive some additional data during its initialization, which is done using an @wire. The data ...
4
votes
1answer
9k views

Unable to pass parameters to wired property in LWC

Unable to pass parameters to wired property in LWC. I have a standalone app <aura:application extends="force.slds"> <c:abc a="a" b="a,b,c" c="c" /> </aura:application> and ...
4
votes
1answer
1k views

Wired Apex Method not getting called on Load

I've a problem on a wired apex method not getting called from a Lightning Web Component on load. This web component is inside a parent Lightning Aura Component which has a date picker where today's ...
4
votes
1answer
209 views

lwc wired variable in refreshApex throws “resolved configuration is not available”

I have worked myself through several topics here on StackExchange already, finding this one to be the most helpful: working with the refreshApex feature in LWC However, the proposed solution does ...
4
votes
1answer
225 views

LWC: Assertion error when testing @wire chain in Jest

I am trying to write Jest test for a component with two @wired calls (both bound to functions), but I get assertion error about property of second @wire call not being annotated with wire annotation. ...
3
votes
1answer
4k views

LWC: Does @AuraEnabled(cacheable=true) cache the result individually or combined?

Prequel: I have several methods in need of the same @wire operations. The approach I initially took was to make a new utilities component just for the wire operations and then use the pubsub library ...
3
votes
2answers
1k views

Lightning Web Component - Must provide at least one of the parameters - 'fields', 'layoutTypes', 'optionalFields'. Update Record

I'm trying to run a simple update action on a record that I queried initially using a wired method. After prepare the recordInput object I get this error: { "error": { "ok": false, "status":...
2
votes
1answer
139 views

LWC: @wire inside method (function)

I need to run this @wire on a click event. I thought on creating, inside the LWC class, a method to call it, but it didn't work. how can I call the WIRE service inside a function with parameter? ...
2
votes
1answer
86 views

lwc wire server side changes not detected

I have a lwc component with apex service wired. This apex service takes an parameter. Since it is a wired service, I need to mark it as Cacheable=true on the apex controller. On the UI Wired service ...
2
votes
1answer
92 views

LWC child caches stale data by @wired Apex query, Parent cannot refreshApex() on child by querySelector() because child hidden by if:true. What to do?

brief app structure(see image): "Line item" child components list on the right (just one 1601xCC5Bulk on this pic), container with pallets on the left. <<Allocate btn opens another ...
2
votes
1answer
183 views

LWC wired service getRecord won't rerender with reactive property

I am trying to use wire service to get the geo data from a record, and expecting the component will rerender every time wire service gets the data. This is how my component JS looks like, import ...
2
votes
1answer
280 views

Using @api global variable showing undefined value in Salesforce Lwc in wire method

I am using global variable @api filter in wire method in child component. Defined this variable with default value="". I am passing value say 'xyz' to this filter parameter from parent lwc component. ...
2
votes
1answer
391 views

LWC: Maximum Blob Size From JS To APEX

I want to make a "custom file upload" LWC component as I am in need to build a specific design for an upload process. There are a few things I am not sure about. What would be the maximum size of a ...
2
votes
1answer
36 views

Unable to call apex method using wire service, returning the result as [Object][Object]

<lightning:card> <lightning-button variant="brand" label="New Entry" title="Open Modal" onclick={openModal} class="slds-var-m-left_x-...
2
votes
1answer
289 views

Lwc getPicklistValues not working on OpportunityLineItem

I am trying to get picklist values for the field on OpportunityLineItem, but getting {}. import { LightningElement, wire } from 'lwc'; import { getPicklistValues } from 'lightning/uiObjectInfoApi'; ...
1
vote
2answers
1k views

Concatenate two Values in a LWC (Lightning Web Component)

I am currently grabbing field values from a Lead and displaying them onto a LWC. I am having trouble taking two values and placing them into a variable. Here is my JS: // ********************* // ...
1
vote
1answer
66 views

How to modify a wired result in a getter?

I have a wired function in an LWC that populates an array (records) on success returning an address for each array value. @wire(searchSomething, { searchSomething: '$searchObject'}) wiredContacts(...
1
vote
1answer
92 views

Reactive property in @wire notation from other @wired method

DISCLAIMER : I know there are better ways to get the current User Id, I am just writing this up as example to illustrate the issue I am facing. Let's say I have two apex methods that are @AuraEnabled ...
1
vote
2answers
47 views

Call the function if there is values returned by the wire method

I have a function in LWC which is getting invoked if Wire brings some values from Apex. but issue here i am facing is function is still getting called when data=[] Logic : Wire @wire(getRFCt, { crid: '...
1
vote
1answer
402 views

LWC to display records grouped by RecordType Name

I'm trying to get a list of all CaseT records under their respective recordtype name in a lwc component. So, CaseT Recordtypename 1 CaseT A CaseT B CaseT C CaseT Recordtypename 2 CaseT X CaseT Y ...
1
vote
2answers
2k views

LWC Wiring apex method returns [object Object]

I'm trying to display the account of the logged in community user. Right now i'm only trying to display the Id but it's returning [object Object]. Maybe i'm not going about it the right way. Here is ...
1
vote
1answer
35 views

Unable to test variable value with Wire in jest

I am trying to read simple users list with wire method. However, I'm unable to test the variable value in jest promise, is there anything wrong with my code/understanding? LWC - @wire(getUsers) ...
1
vote
1answer
237 views

LWC Wire null check in order to return null or an empty array

Hi I need help on of my req in which i want some fields from Salesforce server to display in the LWC component on the basis of it i want to show one message in the child component, If there is no ...
1
vote
0answers
54 views

LWC: @wire No such column 'UserRoleId' on entity 'User'

I am getting this error when trying to do @wire for the current user. I assume that this is some sort of sharing issue. Is there a way to do something similar to without sharing for @wire so that I ...
0
votes
2answers
111 views

LWC @wire change 'this' context

I have a problem with my code export default class PdmNewModalPlist extends LightningElement { @api objectName; @api fieldName; @api apiName; @api recordTypeId; @track obj; @...
0
votes
2answers
204 views

Why is does refreshApex need to return the method?

Given the below LWC JavaScript: import { LightningElement, wire } from "lwc"; import getRecords from '@salesforce/apex/MyController.getRecords'; import { refreshApex } from '@salesforce/apex'; ...
0
votes
1answer
17 views

LWC: Only enable button if options are available

I would like to enable/disable a button in LWC depending on if a list variable is empty or not. I know it's possible with a formula in Aura, is it doable in LWC? I have tried the below, but it doesn't ...
0
votes
1answer
53 views

LWC @wire returns undefined

I'm trying to fetch Contacts to datatable. Here is Apex class: @AuraEnabled(Cacheable = true) public static List<Contact> getPaginatedContacts(Integer pageNumber, Integer pageSize){ ...
0
votes
1answer
232 views

Can you call getRecord or @wire from child component?

I'm trying to make a basic with the @wire method on the contact record to pull in a phone number. But the error I keep getting is Cannot read property 'fields' of undefined on c:ParentElement Cannot ...
0
votes
1answer
44 views

Lightnig Web Component Wire

Hi I have set up a wire service which returns the data from the Apex side , in the Apex I have ABC__c as a field , how can i access the field in JS of LWC. Below is my code: @wire(ASD, { CFG: '$...
0
votes
3answers
391 views

LWC @wire parameter getting undefined

Hi All I declared objectName with value why I am getting objectName undefined, doinit of component // Public Property @api objectName = 'Account'; @api columns; @api relatedFieldAPI; @api ...
0
votes
1answer
97 views

LWC: Chained property not refreshing

I chained two wires to get a sales rep’s name, but the name does not refresh. This Lightning Web Component displays account information. Account has a User lookup field called Sales_Representative__c. ...
0
votes
1answer
106 views

LWC - Error passing @api values as strings to “fields” parameter for lightning-record-form

I am writing a component that allows the user to designate the API names of the fields they want to see in a related list. I am trying to pass these API field names into the "fields" ...
0
votes
2answers
300 views

getRecord, getFieldValue always return undefined values in LWC

Here is the javascript code of my LWC import { LightningElement, api, wire, track } from 'lwc'; import { getRecord, getFieldValue } from 'lightning/uiRecordApi'; import getAlertMetadata from '@...
0
votes
2answers
85 views

Cannot use an Id retreived by getFieldValue into @wire getRecord

I have an Account lookup field which gets Account ID, and need to get its Account Name on field change. (This is a Home tab component using Opportunity Form) HTML (lightning-record-edit-form; object-...
0
votes
1answer
26 views

can anyone help me,i can't see the output when fetching the data from object in a lwc

<template> <lightning-card title="AllContacts"> <ul> <template if:true={responseReceived}> <template for:each={contacts.data} for:...
0
votes
1answer
16 views

lightning web component wire property

I have an Aura method which returns Boolean public static Boolean addasFav(Id pProductId) {...} I want to call this in my lwc js I have added the below code import addasFav from '@salesforce/apex/...
0
votes
0answers
25 views

getListUi wire returns with 400 - ILLEGAL_QUERY_PARAMETER_VALUE

I query opportunity records using list view developer name, which is used for getListUi. But sometimes, randomly, when I go to the records page, I get this error: Here's the wire for getListUi: @api ...
0
votes
1answer
27 views

LWC @wire works only if page is refreshed

I got a problem with @wire. To get refreshed data I need to refresh the whole page manually. If I switch to another navigation item add or delete records, nothing happens after returning to the ...
0
votes
0answers
23 views

RefreshApex is calling ApexMethod but the contents of wire function are not executed

RefreshApex is calling ApexMethod but the contents of wire function (wiredDisableButton) are not executed. First time when user clicks the updateCase button the Apex method returns true and case is ...
0
votes
1answer
76 views

LWC Help changing field value to OldValue from Histories related object

I am having real trouble with a simple task. I have an object Contract__c and it has history tracking on. I need to button onclick revert the Contract_Status__c field back to its most previous ...
0
votes
0answers
42 views

How to refresh the other lightning web components on a page when one component updates the data on a record-form?

I have actually 2 Lightning web components- 1.) lwcPropertyList 2.) lwcProperyDetail USECASE -> When I update any of the field on the record-from(present on lwcPropertyDetail), it is required that ...
0
votes
2answers
97 views

Does the getRecordUi support Location Object?

I have a lwc component, In order to show WorkORder details page I need a relatedField on a relatedObject wich is Location.Name. I have used two methods import LOCATION_NAME_FIELD from "@salesforce/...