The error that you are getting is because the property tag is not supported for the lightning__RecordAction
target. According to the documentation, the property tag is only supported for the following targets:
- lightningCommunity__Default
- lightningCommunity__Page
- lightningCommunity__Page_Layout
- lightningCommunity__Theme_Layout
- lightningSnapin__ChatHeader
- lightningSnapin__ChatMessage
- lightningSnapin__Minimized
- lightningSnapin__PreChat
Therefore, you cannot use the property tag to expose a Boolean check in the target config for the lightning__RecordAction
target.
One possible way to overcome this issue, other than creating two container components with default values, is to use a custom metadata type to store the Boolean value for each customer. You can create a custom metadata type with a Boolean field and a lookup field to the User object, and then populate the records with the values for each customer.
For example, you can create a custom metadata type named Trigger_API_Setting__mdt
with the following fields:
- User__c: a lookup field to the User object
- Is_Trigger_API__c: a Boolean field to store the value of the Boolean check
Then, you can create records for each customer with their user ID and the Boolean value.
In your LWC component, you can use Apex to query the custom metadata type and get the Boolean value for the current user. For example, you can use the following code to get the Boolean value:
Apex class
public with sharing class TriggerAPIService {
// Method to get the Boolean value from the custom metadata type
@AuraEnabled(cacheable=true)
public static Boolean getIsTriggerAPI() {
Id userId = UserInfo.getUserId();
Trigger_API_Setting__mdt setting = [SELECT Is_Trigger_API__c
FROM Trigger_API_Setting__mdt
WHERE User__c = :userId];
return setting.Is_Trigger_API__c;
}
}
LWC component
import { LightningElement, wire } from 'lwc';
import getIsTriggerAPI from '@salesforce/apex/TriggerAPIService.getIsTriggerAPI';
export default class TriggerAPIComponent extends LightningElement {
@wire(getIsTriggerAPI)
isTriggerAPI;
triggerAPI() {
if (this.isTriggerAPI.data) {
// Trigger the API
} else {
// Do not trigger the API
}
}
}
This way, you can use a custom metadata type to store and retrieve the Boolean value for each customer, without using the property tag in the target config.
isExposed
is set to betrue
, Not sure if I turn it to false will allow me to build new manage package ? or it will accept package upgrade in customer orgs ?