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
swimminglyswimmingly 

Sites Visualforce Component to Create Case Comment

I'm looking for help with creating a component that will allow for adding a comment to an existing case.

Keep getting compile errors, I'm trying something like this:

 

        <apex:form>
        <apex:inputTextarea id="statusUpdate" value="{!comment.CommentBody}" rows="8" cols="100"/>
        </apex:form>

 

Any suggestions much appreciated.  I think I'm finding this harder than it really is, but I'm being thrown by the fact that I need this to run on a Force.com Sites Page -- a Visualforce page not on Sites can simply call the URL for new comments, something like this:

 

https://naX.salesforce.com/00a/e?parent_id=50050dd000XXXXX&retURL=%2F50050dd000XXXXX&CommentBody='This test comment'
Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

It should probably be {!CaseComment.CommentBody} instead. You should never use an "internal URL" directly in the manner you propose. You should always use URLFOR if you must use a URL (see Help for details on URLFOR), or preferably create records using your controller.

All Answers

sfdcfoxsfdcfox

It should probably be {!CaseComment.CommentBody} instead. You should never use an "internal URL" directly in the manner you propose. You should always use URLFOR if you must use a URL (see Help for details on URLFOR), or preferably create records using your controller.

This was selected as the best answer
swimminglyswimmingly

Thanks for the suggestion, sfdcfox, but I get an error:

Error: Unknown property 'CaseStandardController.caseComment'

 

You suggested a custom controller, but shouldn't I be able to do this with a standard controller?  I'm new to Apex and can't make my custom controller work either, but then I wondered why I couldn't even make the standard controller work.