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
kiran ravikiran ravi 

Error:sObject type 'Person__c' is not supported.

Please help me. Becuase im very new to sales force. how i can solve this problem

global with sharing class SaveExpenditureWebService {

webservice static Expenditure__c createExpenditure(Decimal amount,String expName, String paidByName )
{

Expenditure__c c = new Expenditure__c();
Person__c p = [Select p.Name From Person__c p Where Name = :paidByName limit 1];
c.Amount__c = amount;
c.Name__c = expName;
c.Exp_Date__c = Date.today();
c.Paid_By__c = p.Id;
insert c;
return c;
}

}

KaityKaity

can you please try with giving different name of alias and the variable. Currently, both are the same.

 

Person__c p = [Select p.Name From Person__c p Where Name = :paidByName limit 1];

Yoganand GadekarYoganand Gadekar

try like this

Person__c p = [Select Name From Person__c  Where Name = :paidByName limit 1];

kiran ravikiran ravi

sir ,

i have done above corrections. it was not working. it showing the same error

 

Compile Error: sObject type 'Person__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 9 column 23

 

or else i need add or create any packages before this.im  not getting please help me

 

Thank you

 

Yoganand GadekarYoganand Gadekar

make sure you are refereing to  correct API name of your custom object person...

KaityKaity

Hi,

 

Are the data types are similar: Is the data type of Amount__c of Expenditure is also Decimal? Plz  confirm?

 

global with sharing class SaveExpenditureWebService {

webservice static Expenditure__c createExpenditure(Decimal amount,String expName, String paidByName )
{

Expenditure__c c = new Expenditure__c();
Person__c p = [Select p.Name From Person__c p Where Name = :paidByName limit 1];
c.Amount__c = amount;
c.Name__c = expName;
c.Exp_Date__c = Date.today();
c.Paid_By__c = p.Id;
insert c;
return c;
}

}

Avidev9Avidev9

 

  • Make sure there exists a object with API name "Person__c". Most likely you are mistaking the object API name. Go to setup >> create Object and check the API name
kiran ravikiran ravi

Thank you sir,

I have done changes.its working fine.

 

im working on integration asp.net with salesforce.please help me for further steps

KaityKaity

Where was the issue??

kiran ravikiran ravi

im integrating salesforce with asp.net

 

we have one registration form after clicking send button in registration form the which was entered need go the salesforce 

leads tab.

im unaware of apex classes .please help me

 

Jonathan Vance 5Jonathan Vance 5
@Avidev9 You got it that was it thanks!!!
Karthik TathiReddyKarthik TathiReddy
you have to use namespace for all fields and object api name. Then you dont see this error.
MattGoncalvesMattGoncalves
Make sure you're using the right API Version. 

Ex: 

/services/data/v39.0
/services/data/v45.0/