简体   繁体   中英

VS Code cant import custom objects from salesforce

I'm trying to create a custom form to insert a record for Student but I have a problem, VS or there is maybe something else, cant see my custom object named Student

import STUDENT_OBJECT from '@salesforce/schema/Student';
import FIRST_NAME from '@salesforce/schema/Student.Firstname';
import LAST_NAME_FIELD from '@salesforce/schema/Student.Lastname';
import EMAIL_FIELD from '@salesforce/schema/Student.Email';
import PHONE_FIELD from '@salesforce/schema/Student.Phone';
import ADDRESS_FIELD from '@salesforce/schema/Student.Address';

First line, when I change to Account VS code suggest me a fields, but with Student it seems like VS code doesnt see custom object.

And errors when I try to deploy lwc :

 Invalid reference Student.Firstname of type sobjectClass in file createStudent.js
          Invalid reference Student of type sobjectClass in file createStudent.js
          Invalid reference Student.Address of type sobjectClass in file createStudent.js
          Invalid reference Student.Lastname of type sobjectClass in file createStudent.js
          Invalid reference Student.Phone of type sobjectClass in file createStudent.js
          Invalid reference Student.Email of type sobjectClass in file createStudent.js
          Invalid reference Student.Firstname of type sobjectClass in file createStudent.js
          Invalid reference Student of type sobjectClass in file createStudent.js
          Invalid reference Student.Address of type sobjectClass in file createStudent.js
          Invalid reference Student.Lastname of type sobjectClass in file createStudent.js
          Invalid reference Student.Phone of type sobjectClass in file createStudent.js
          Invalid reference Student.Email of type sobjectClass in file createStudent.js
          Invalid reference Student.Firstname of type sobjectClass in file createStudent.js
          Invalid reference Student of type sobjectClass in file createStudent.js
          Invalid reference Student.Address of type sobjectClass in file createStudent.js
          Invalid reference Student.Lastname of type sobjectClass in file createStudent.js
          Invalid reference Student.Phone of type sobjectClass in file createStudent.js
          Invalid reference Student.Email of type sobjectClass in file createStudent.js
          Invalid reference Student.Firstname of type sobjectClass in file createStudent.js
          Invalid reference Student of type sobjectClass in file createStudent.js
          Invalid reference Student.Address of type sobjectClass in file createStudent.js
          Invalid reference Student.Lastname of type sobjectClass in file createStudent.js
          Invalid reference Student.Phone of type sobjectClass in file createStudent.js
          Invalid reference Student.Email of type sobjectClass in file createStudent.js
          Invalid reference Student.Firstname of type sobjectClass in file createStudent.js
          Invalid reference Student of type sobjectClass in file createStudent.js
          Invalid reference Student.Address of type sobjectClass in file createStudent.js
          Invalid reference Student.Lastname of type sobjectClass in file createStudent.js
          Invalid reference Student.Phone of type sobjectClass in file createStudent.js
          Invalid reference Student.Email of type sobjectClass in file createStudent.js
          Invalid reference Student.Firstname of type sobjectClass in file createStudent.js
          Invalid reference Student of type sobjectClass in file createStudent.js
          Invalid reference Student.Address of type sobjectClass in file createStudent.js
          Invalid reference Student.Lastname of type sobjectClass in file createStudent.js
          Invalid reference Student.Phone of type sobjectClass in file createStudent.js
          Invalid reference Student.Email of type sobjectClass in file createStudent.js

And this is Student object:

在此处输入图像描述

Pay attention to object's API name. Your custom object (like custom fields) most likely became Student__c .

As for autocomplete issues - try Ctrl+Shift+P "sfdx: refresh sobject definitions"

You may find it easier to use to use an ODBC connection to Salesforce which handles mapping the fields to a relational model. Then you can do it all with SQL.

Check out https://www.progress.com/odbc/salesforce as one option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM