1

I want to create quote instance in custom controller but its giving me an error

Quote q = new Quote();
q.Name = 'quote'; // error variable does not exist: Name 

What am I doing wrong?

2
  • I don't think this code would give you this error. Can you copy and paste the code you're having trouble with? May 13, 2014 at 12:35
  • Silly question: Do you have a custom class named Quote? That would totally muck things up. Try changing the code to: Schema.Quote q = new Schema.Quote(); q.Name = 'quote';
    – sfdcfox
    Aug 11, 2014 at 17:50

2 Answers 2

1

I'm not 100% sure as I haven't checked, but I'm pretty sure Quotes will use an autonumber field so you won't be able to set the name like this.

2
  • Did you enabled quotes for your org .
    – Sathya
    Jan 13, 2014 at 7:53
  • i have checked name is string type Jan 13, 2014 at 9:16
0

I've run your code in 'execute anonymous' mode in the dev console and it passes ok. If quotes wasn't activated you'd get 'entity is not org-accessible.

If you run the code in dev console do you get the same error as in your controller?

You must log in to answer this question.

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