Can any one help me on this. I have a visual force page created in PDF format.
If the product line for the product selected in opportunity items is other than ‘ DIE’ make following changes .

1) unit price should change to $1.

Code :

                      tempobj.extension=OPplineitem[i].Quantity * tempObj.unitprice;

                    // tempObj.unitprice=OPplineitem[i].ListPrice;

I get an Error as

 no viable alternative at character '$' at line 75 column 40

Any help is very much appreciated.

  • 1
    what is the datatype for this field(Unitprice) ? – DKSalesforce Lerner Mar 4 '15 at 12:36
  • @ DKSalesforce Lerner:Datatype is :Currency for unitprice – nikkey Mar 4 '15 at 15:56

unit price that you are using from priceBookEntry is basically a currency field. You dont need to append Dollar before that.

$ is automatically appended by salesforce based on the users locale.

You can just set it as 1 as internally Currency is also a number field. On the UI you can make use of inputField or output Field to display $ sign.

  • :The visual force page is in PDF format.It is a wrapper class.Previously the value for Unit price was hardcoded.Now <td class="header-table-data"><apex:outputtext value="{!line.unitprice}"></apex:outputtext></td>.Any help is very much appreciated. – nikkey Mar 4 '15 at 15:58

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.