0

I am trying to show data of object.

Object: enter image description here

test.apex:

public with sharing class test {
    /**
     * Webkul Software.
     *
     * @category  Webkul
     * @author    Webkul
     * @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
     * @license   https://store.webkul.com/license.html
     */

    @AuraEnabled//Annotation to use method in lightning component
    public static List<Project_task__c> getProjectList() {//Fetch data
        return [SELECT Id, Pt_Name__c, Pt_ID__c, Milestone__c, Pt_completeddate__c, Project_id__c, Pt_startdate__c FROM Project_task__c ORDER BY Pt_startdate__c ASC];
    }   

testHelper.js

({
    /**
     * Webkul Software.
     *
     * @category  Webkul
     * @author    Webkul
     * @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
     * @license   https://store.webkul.com/license.html
     */
         
     getProject : function(component) {
         var action = component.get("c.getProjectList");//get data from controller
         action.setCallback(this, function(a) {
             component.set("v.projects", a.getReturnValue());//set data in the page variable
         });
         $A.enqueueAction(action);
     }
})

testController.js

({
    getProject : function(component, event, helper) {
        helper.getProject(component);//get data from the helper
    }
})

test.cmp

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller= "test" >
    <!-- Progress Bar-->
    <div class="slds-grid slds-p-left_medium slds-p-right_medium">
        <div class="slds-tabs--path" role="application">
            <aura:attribute name="projects" type="Project_task__c[]"/><!--List Of Vehicles-->
            <aura:handler name="init" value="{!this}" action="{!c.getProject}" /><!--Client-side Controller-->
            <ul class="slds-tabs--path__nav" role="tablist">
                <aura:iteration items="1,2,3,4,5"  var="item">
                    <li aura:id="step1Indicator" class="slds-tabs--path__item slds-is-current" role="presentation" >
                        <a class="slds-tabs--path__link" id="tabs-path-2326" aria-controls="content-path-1" aria-selected="false" tabindex="-1" role="tab" href="javascript:void(0);" aria-live="assertive">
                            <span class="slds-tabs--path__stage">
                                <lightning:icon iconName="utility:check  " size="x-small" alternativeText="Indicates approval"/>
                            </span>
                            <span class="slds-tabs--path__title" style="color:black;"><div class="slds-text-heading_small">Call Customer<br/>Completed: 2022-11-02</div></span>
                        </a>
                    </li>
                </aura:iteration>
            </ul>
        </div>
    </div>
</aura:component>

it is error in cmp

enter image description here

3
  • Welcome to Salesforce Stack Exchange (SFSE)! What happens if you move your <aura:attribute> line to be immediately under your <aura:component> line.
    – Moonpie
    Commented Dec 2, 2022 at 13:12
  • what do you mean?
    – Bohdan V.
    Commented Dec 3, 2022 at 0:00
  • Exactly what I said. It won't format well in a comment, so I'll put it as an answer - but it's really more of a half-educated guess.
    – Moonpie
    Commented Dec 3, 2022 at 1:19

1 Answer 1

0

In your test.cmp file (which in my comment I didn't think I would need to explicitly state since

  • It's the file you are getting the error on, and
  • It's the only one with <aura:...> lines

), change this...

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller= "test" >
    <!-- Progress Bar-->
    <div class="slds-grid slds-p-left_medium slds-p-right_medium">
        <div class="slds-tabs--path" role="application">
            <aura:attribute name="projects" type="Project_task__c[]"/><!--List Of Vehicles-->
            <aura:handler name="init" value="{!this}" action="{!c.getProject}" /><!--Client-side Controller-->
            <ul class="slds-tabs--path__nav" role="tablist">

...to this...

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller= "test" >
    <aura:attribute name="projects" type="Project_task__c[]"/><!--List Of Vehicles-->
    <!-- Progress Bar-->
    <div class="slds-grid slds-p-left_medium slds-p-right_medium">
        <div class="slds-tabs--path" role="application">
            <aura:handler name="init" value="{!this}" action="{!c.getProject}" /><!--Client-side Controller-->
            <ul class="slds-tabs--path__nav" role="tablist">

...effectively moving your <aura:attribute> line to be immediately under your <aura:component> line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .