You need to sign in to do that
Don't have an account?
Mitesh Sura
Cannot create PDF as community user
Hi,
We have need to create Quote PDF documents upon apprval. The flow is trigger ==> @Future Class ==> REST (HTTP Post) . While this works for internal users, community users get below error. The user is the opportunity and quote owner. Also the profile has access to all apex classes.
Error:
EXCEPTION_THROWN|[23]|System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.: [NetworkId]
REST Class
We have need to create Quote PDF documents upon apprval. The flow is trigger ==> @Future Class ==> REST (HTTP Post) . While this works for internal users, community users get below error. The user is the opportunity and quote owner. Also the profile has access to all apex classes.
Error:
EXCEPTION_THROWN|[23]|System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.: [NetworkId]
REST Class
@RestResource(urlMapping='/savePDF/*') global class savePDF{ @HttpPost global static void savePDF(list<string> quote_template_id) { system.debug('quote_template_id ' + quote_template_id); string quoteId, templateId; PageReference pageRef; Blob pdf; list<QuoteDocument> docs = new list<QuoteDocument>(); for(string q : quote_template_id){ if(q.contains('::')){ quoteId = q.split('::')[0]; templateId = q.split('::')[1]; pageRef = new PageReference('/quote/quoteTemplateDataViewer.apexp?id=' +quoteId+ '&headerHeight=109&footerHeight=10&summlid=' +templateId+ '#toolbar=1&navpanes=0&zoom=90'); pdf = pageRef.getContentAsPdf(); docs.add(new QuoteDocument(Document=pdf, QuoteId=quoteId)); } } if(docs.size() > 0) insert docs; } }
They can view the PDF, but cannot create one.
We twead the code to move the PDFs to attachment related list instead.
All Answers
If you are using the above code for 'Customer Community' or 'Customer Community Plus', you will not be able to access Quotes. Only for 'Partner Community', Quotes are accessible.
Please refer to the below Salesforce Documentation:
https://help.salesforce.com/HTViewHelpDoc?id=users_license_types_communities.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=users_license_types_communities.htm&language=en_US)
Please let me know if this helps.
If yes, please mark the question as Solved.
Thanks and Regards,
Anirudh Singh
They can view the PDF, but cannot create one.
We twead the code to move the PDFs to attachment related list instead.