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
AtiqahAtiqah 

Display data in table

Hi, need your help to check on this code.
This code does not give me the expected result. By right object should display all record name and submitted y should display user name. But both field should be can clock and redirect to its record 
User-added image
Apex class
public with sharing class toApproved {
    @AuraEnabled(cacheable=true)
    public static list<ProcessInstanceWorkitem> getItemApprove(){
        return[select id, CreatedById,ProcessInstance.TargetObject.name,ProcessInstance.TargetObjectId,CreatedDate,CreatedBy.name from ProcessInstanceWorkitem order by CreatedDate limit 100];
    }
}
 
lwc js

import { LightningElement, wire } from 'lwc';
import toApproved from '@salesforce/apex/toApproved.getItemApprove';
const columns = [
    {label: 'CreatedDate', fieldName: 'CreatedDate' },
   
    {label: 'Object',
    fieldName:'ObjectId',
    type:'url',
    typeAttributes:{
        label:{
            fieldName:'ProcessInstance.TargetObject.Name'},
            target:'_blank'}
        },
        {label: 'Submitted By',
        fieldName:'CreatedById',
        type:'url',
        typeAttributes:{
            label:{
                fieldName:'CreatedBy.name'},
                target:'_blank'}
            }
   
];
export default class ToApproved extends LightningElement {
    availableItems;
    error;
    columns = columns;
    @wire (toApproved)
    wiredAccount({error,data}){
        if(data){
            let tempRecs = [];
            data.forEach((record)=>{
                let tempRec = Object.assign({},record);
                tempRec.ObjectId = '/'+tempRec.ProcessInstance.TargetObjectId;
                tempRec.CreatedById = '/'+tempRec.CreatedById;
                tempRecs.push(tempRec);
            });
            this.availableItems = tempRecs;
            this.error = undefined;
        }else if(error){
            this.error = error;
            this.availableItems = undefined;
        }
    }
}
 
HTML

<template>
    <lightning-card title="Item to Approve" icon-name="custom:custom63">
        <div class="slds-m-around_medium">
            <template if:true={availableItems}>
                <lightning-datatable
                key-field="Id"
                data={availableItems}
                columns={columns}
                hide-checkbox-column="true"
                show-row-number-column="true">
            </lightning-datatable>
            </template>
            <template if:true={error}>
                {error}
            </template>
        </div>
    </lightning-card>
</template>