I am using Apex to call an SOQL query that returns records and a few of their associated fields, some of which are formula fields which (to my understanding) are not writeable. I am then passing this list to a LWC Data Table within the LWC.
I am wanting to remove cells from the data table that do not match the current project. One of these fields happens to be the "Project_ID__c" field, this field is a formula field. I have tried to edit them directly by simply comparing each record and setting the fields I would like to be left out of the data table to null or a blank string, however I am met with the error "Field is not writeable: Project_Contact__c.Project_ID__c".
Is there a way to either remove these fields from the data table or to make a copy of the list in which the fields are cast as editable strings? I will leave snips of my code below for reference.
APEX
public static List<Project_Contact__c> searchContacts(String businessName, String PID, String Name, String PCID, String CID)
{
...
List<Project_Contact__c> StartList = Database.query(QueryString);
return StartList;
}
JS
@track columns =
[...]
@wire(searchContacts, {businessName:'$businessName', PID:'$projectId', Name:'$name', PCID:'$pcid', CID:'$cid'})
wiredAccounts({error, data})
{
if (data)
{
this.accList = data.map(row=>{
return{Test: row.Contact__r.AccountId,
Name: row.Full_Name__c,
ID: row.Project_ID__c,
Business: row.Business_Entity_Name__c,
Owner: row.Owner_Full_Name__c,
Status: row.Status__c,
LastReason: row.Last_Reason__c
}
})
this.error = undefined;
}
else if (error)
{
this.error = error;
}
}