I'm creating a LWC (lightning web component) which allows any field to be displayed of any field type for any object, and to drop these into a flow page.
I've run into a problem, where, I'd like to do something like this (AND THIS CODE WORKS - it is the next block of code that does not work)
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
...
@wire(getObjectInfo, {objectApiName:{ "objectApiName": "Account"}}) })
objectInfo(...
...
// note would have default attribute set but this is not supported in flow
and in the xml I have something like this
<targetConfigs>
<targetConfig targets="lightning__FlowScreen">
<property name="objectName" type="String"></property>...
But I've not got anywhere with this, because the objectName in the controller is coming as undefined?{objectName} in the template code, it displays as correctly configured in the component meta-data "Account". Really, this is driving me nuts and seems like something I should be able to do:
@api objectName;
...
@wire(getObjectInfo, {objectApiName:{ "objectApiName": '$objectName'}})
But when I do this, I just receive the following coming back from the wire: 403 access denied
Because the value being sent via the call, as I can see in network logs, it is sending literally "$objectName" instead of even undefined or, what I'd really like - "Account".
Do I need to something to wait, for this $objectName to be set before calling wire? Surely @wire should notice the change, which eventually it does have because I can see in the UI-- and then load the right data??
{ apiName: 'object-api-name-here'}