I'm working on a PE with API enabled and I'm trying to create a QuoteDocument. For some reason this failed with error:

sObject type 'QuoteDocument' 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.

This is the JS on my VF page that is trying to do the creation:

        function uploadQuoteDocument( filecontent,  quoteId) {
            var quoteDocument  = new sforce.SObject('QuoteDocument');
            quoteDocument.Document = filecontent;
            quoteDocument.QuoteId = quoteId;
            var result = sforce.connection.create([quoteDocument]);
            if (result[0].getBoolean("success")) {
                alert('Quote PDF successfully generated');
                window.location.href = '/{!Quote.Id}';
            } else {
                alert('Quote PDF generation failed');

Does anyone know why am I getting this error?

  • Can you provide the code you're using? It's likely though you need to refer to it as QuoteDocument__c – David Gillen May 2 '14 at 15:54
  • Code added. It is working fine in my Dev org so I don't think its a __c issue – Dedo May 3 '14 at 4:36
  • Can you see the any of the Quote, QuoteDocument, QuoteLineItem sObjects if you connect with the same user with a tool like workbench or the Force.com Explorer? – Daniel Ballinger May 6 '14 at 19:42
  • Yes, I can query them and see them – Dedo May 7 '14 at 4:06
  • I know in PE page layout acts as field level security (if page lay says the field is readonly you'll have hard time writing to that field if you're not a SysAdmin). So maybe there's a Tab visibility that's missing or something like that? Can you access existing Quotes/QuoteDocs without problems? – eyescream May 9 '14 at 23:02

Interesting... I have some ideas, too much to put in a comment.

Add sforce.debug.trace=true; to the beginning of your method.

Regarding the API version don't be so sure you're using v. 26, check https://stackoverflow.com/q/23556030/313628.

Any special reason why it has to be done in javascript and not pure VF + apex?

insert new QuoteDocument(
    Document = Blob.toPDf('Test PDF content'),
    QuoteId = '0Q070000000OjV9'

Some <apex:input> field with should work too and be much cleaner... And if you don't want an inputField but JS way is giving you hard time you could still try with marking an apex method as webservice (oldschool way) or remoteaction. Server-side code should bypass any weird "no-Profiles-but-still" security settings in PE (I've recently had a security review and had to slap CRUD checks all over the place. Turns out managed code was bypassing the PE's "security by page layout" just fine like in orgs that really have Profiles).

Last but not least: what are you getting when you execute this (or matching describe operation in Ajax toolkit)?

Schema.DescribeSObjectResult dsr = Schema.SobjectType.QuoteDocument;
System.debug(dsr.isAccessible() + ', ' + dsr.isCreateable());
| improve this answer | |
  • many thanks, it was the API level issue. I used <apex:includeScript value="../../soap/ajax/30.0/connection.js" /> which doesn't work. Now I'm using <script src="../../soap/ajax/30.0/connection.js" type="text/javascript"></script> it works perfectly... – Dedo May 10 '14 at 16:24
  • Weird bug in includeScript then? Interesting! What if you'd use path that starts from root instead of going "up" twice? Many thanks for accepting but it feels bit wrong, it was just a couple of hints :) Still - depending how much time you have on your hands you might decide to do it with more server-side in mind, especially that they continue to improve it: developer.salesforce.com/releases/release/Spring14/…. The connection.js just brings back the not too find memories from my S-Control days... – eyescream May 10 '14 at 16:41
  • I don't have access to APEX in PE this is why I had to workaround it with JS on the page side – Dedo May 10 '14 at 17:07
  • I was under impression that you're developing a managed package, that's why I've suggested these, sorry :) PEs can use apex-based solutions from managed packages. – eyescream May 10 '14 at 21:15
  1. Make sure quotes are enabled.
  2. Make sure you are using a modern version of the API (at least 18).
  3. Make sure the user has profile permissions, if you're using custom profiles.
| improve this answer | |
  • Quotes are enabled; I'm using API 26.0. There are no profiles in this org since its a Professional Edition with API enabled – Dedo May 3 '14 at 4:38
  • That's odd, then. I'll check around and see if I can find anything else. – sfdcfox May 5 '14 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.