function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shubham Bansal 45Shubham Bansal 45 

How to delete a target property from config elements from lwc.

How to delete a target property from config elements from lwc.

for exx:
 <targetConfigs>
        <targetConfig targets="lightningCommunity__Default">
            <property name="recordId" type="String" label="Record ID" default="{!recordId}"  description="The value should be {!recordId}."/>
         <property name="objectApiName" type="String" label="Object Name" description="Automatically bind the page's object name to the component variable"
            default="{!objectApiName}" />
        </targetConfig>
    </targetConfigs>

i want to delete property objectApiName but when i remove code or delete from community page and publish that then also it return me errot that i can delete a config property,
Best Answer chosen by Shubham Bansal 45
Santosh Kumar 348Santosh Kumar 348
Hi Shubham,

First you need to remove thre reference of your page wherever it is used line record page, app Page or community then remove the property and deploy the updated  code it will work.

If it helped then can you please mark it as the best answer so that it can be used by others in the future.

Regards,
Santosh Kumar

All Answers

Santosh Kumar 348Santosh Kumar 348
Hi Shubham,

First you need to remove thre reference of your page wherever it is used line record page, app Page or community then remove the property and deploy the updated  code it will work.

If it helped then can you please mark it as the best answer so that it can be used by others in the future.

Regards,
Santosh Kumar
This was selected as the best answer
PatMcClellan__cPatMcClellan__c
This can be a more challenging task than you might think because the component may be included in Lightning App Pages that are not active. I thought I had removed the component from all the pages, but it still wouldn't update the targets.

I found it useful to go to Setup > Lightning Components and select the component for which you want to change the targets. Click Delete. If there are any references to the component that would prevent changing the targets, you'll get a list of pages where the component is included. Click the link to each page, click Edit, which takes you into Lightning App Builder, then remove the component and save.