• SFDCTech1
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 8
    Replies
My code was this its an emailtemplate. I want to display and convert currency to usd by displaying $. Amount displaying their were correct but i want to display currency symbols in the below code.

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Opportunity"
    subject="Productline Items for Opportunity: {!relatedTo.name}"
    replyTo="support@acme.com" >
   
<messaging:htmlEmailBody >       
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 11px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
        <p>Dear {!recipient.name},</p>
        <p>Below is a list of products related to the Opportunity:<b> {!relatedTo.name}</b>.</p>
        <br/>Account: <i> {!relatedTo.Account.name}  </i> 
        <br/>Opportunity Owner: {!relatedTo.owner.name}
        <br/>Opportunity Amount: {!relatedTo.Amount}
        <br/>Opportunity Close Date: {!relatedTo.CloseDate} 
  
        <p/>                 
       <table border="0" >
                 <tr >
                     <th>Action</th><th>Product Name</th><th>Product Family</th><th>Quantity</th><th>Unit Price</th><th>Total Price</th>
                  </tr>
    <apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td><a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}">View</a> | 
           <a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}/e">Edit</a></td>
           <td>{!opp.PriceBookEntry.name}</td>
           <td>{!opp.Product_Family__c}</td>
           <td>{!(opp.Quantity)}</td>
           <td>{!(opp.UnitPrice)}</td>
           <td>{!(opp.TotalPrice)}</td>
       </tr>
    </apex:repeat>                
       </table>
       <p />
</font>
      
        </body>
    </html>
</messaging:htmlEmailBody>
   
<messaging:plainTextEmailBody >
Dear {!recipient.name},

Below is a list of products related to the Opportunity: {!relatedTo.name}

Account: {!relatedTo.Account.name}
Opportunity Owner: {!relatedTo.owner.name}
Opportunity Amount: {!(relatedTo.Amount)}
Opportunity Close Date: {!relatedTo.CloseDate} 


[ Product Name ] - [ Product Family ] - [ Quantity ] - [ Units ] - [ Total Price ]
-------------------------------------------------------------------------

<apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
[ {!opp.PriceBookEntry.name} ] - [ {!opp.Product_Family__c} ] - [ {!ROUND(opp.Quantity,0)} ] - [ {!(opp.UnitPrice)} ] - [ {!(opp.TotalPrice)} ]
</apex:repeat>

</messaging:plainTextEmailBody>      
       
       
<messaging:attachment renderas="pdf" filename="Opportunity_Products.pdf">

<img src="http://www.salesforce.com/common/assets/css/images/hdr_apexdn.gif" border="0"></img>

        <p>Dear {!recipient.name},</p>
        <p>Below is a list of products related to the Opportunity:<b> {!relatedTo.name}</b>.</p>
        <br/>Account: <i> {!relatedTo.Account.name}  </i> 
        <br/>Opportunity Owner: {!relatedTo.owner.name}
        <br/>Opportunity Amount: {!(relatedTo.Amount)}
        <br/>Opportunity Close Date: {!relatedTo.CloseDate} 
  
        <p/>  
       


    <apex:datatable border="2" cellspacing="5" var="opp2" value="{!relatedTo.OpportunityLineItems}">
        <apex:facet name="header">Products associated with Opportunity {!relatedTo.name}</apex:facet>
       
          <apex:column value="{!opp2.PriceBookEntry.name}" headerValue="Product Name"/>
          <apex:column value="{!opp2.Product_Family__c}" headerValue="Product Family"/>
        <apex:column value="{!opp2.Quantity}" headerValue="Quantity" />
        <apex:column value="{!opp2.UnitPrice}" headerValue="Units" />
        <apex:column value="{!opp2.TotalPrice}" headerValue="Total Price" />
 
      </apex:datatable>


</messaging:attachment>      
       
</messaging:emailTemplate>
I have industry field having some values and now i want to update those values with new adding some more functionality. Please provide how to write a trigger on this

Error: Compile Error: Invalid initial expression type for field Opportunity.Primary_Industry_Percent__c, expecting: Decimal

 

Opportunity Opp= new Opportunity(Name='Sample',
Account=AC,
Opportunity_Type__c='New',


Primary_Industry__c='Consumer Goods',
Primary_Industry_Percent__c='20',

My code was this its an emailtemplate. I want to display and convert currency to usd by displaying $. Amount displaying their were correct but i want to display currency symbols in the below code.

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Opportunity"
    subject="Productline Items for Opportunity: {!relatedTo.name}"
    replyTo="support@acme.com" >
   
<messaging:htmlEmailBody >       
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 11px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
        <p>Dear {!recipient.name},</p>
        <p>Below is a list of products related to the Opportunity:<b> {!relatedTo.name}</b>.</p>
        <br/>Account: <i> {!relatedTo.Account.name}  </i> 
        <br/>Opportunity Owner: {!relatedTo.owner.name}
        <br/>Opportunity Amount: {!relatedTo.Amount}
        <br/>Opportunity Close Date: {!relatedTo.CloseDate} 
  
        <p/>                 
       <table border="0" >
                 <tr >
                     <th>Action</th><th>Product Name</th><th>Product Family</th><th>Quantity</th><th>Unit Price</th><th>Total Price</th>
                  </tr>
    <apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td><a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}">View</a> | 
           <a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}/e">Edit</a></td>
           <td>{!opp.PriceBookEntry.name}</td>
           <td>{!opp.Product_Family__c}</td>
           <td>{!(opp.Quantity)}</td>
           <td>{!(opp.UnitPrice)}</td>
           <td>{!(opp.TotalPrice)}</td>
       </tr>
    </apex:repeat>                
       </table>
       <p />
</font>
      
        </body>
    </html>
</messaging:htmlEmailBody>
   
<messaging:plainTextEmailBody >
Dear {!recipient.name},

Below is a list of products related to the Opportunity: {!relatedTo.name}

Account: {!relatedTo.Account.name}
Opportunity Owner: {!relatedTo.owner.name}
Opportunity Amount: {!(relatedTo.Amount)}
Opportunity Close Date: {!relatedTo.CloseDate} 


[ Product Name ] - [ Product Family ] - [ Quantity ] - [ Units ] - [ Total Price ]
-------------------------------------------------------------------------

<apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
[ {!opp.PriceBookEntry.name} ] - [ {!opp.Product_Family__c} ] - [ {!ROUND(opp.Quantity,0)} ] - [ {!(opp.UnitPrice)} ] - [ {!(opp.TotalPrice)} ]
</apex:repeat>

</messaging:plainTextEmailBody>      
       
       
<messaging:attachment renderas="pdf" filename="Opportunity_Products.pdf">

<img src="http://www.salesforce.com/common/assets/css/images/hdr_apexdn.gif" border="0"></img>

        <p>Dear {!recipient.name},</p>
        <p>Below is a list of products related to the Opportunity:<b> {!relatedTo.name}</b>.</p>
        <br/>Account: <i> {!relatedTo.Account.name}  </i> 
        <br/>Opportunity Owner: {!relatedTo.owner.name}
        <br/>Opportunity Amount: {!(relatedTo.Amount)}
        <br/>Opportunity Close Date: {!relatedTo.CloseDate} 
  
        <p/>  
       


    <apex:datatable border="2" cellspacing="5" var="opp2" value="{!relatedTo.OpportunityLineItems}">
        <apex:facet name="header">Products associated with Opportunity {!relatedTo.name}</apex:facet>
       
          <apex:column value="{!opp2.PriceBookEntry.name}" headerValue="Product Name"/>
          <apex:column value="{!opp2.Product_Family__c}" headerValue="Product Family"/>
        <apex:column value="{!opp2.Quantity}" headerValue="Quantity" />
        <apex:column value="{!opp2.UnitPrice}" headerValue="Units" />
        <apex:column value="{!opp2.TotalPrice}" headerValue="Total Price" />
 
      </apex:datatable>


</messaging:attachment>      
       
</messaging:emailTemplate>
My code was this its an emailtemplate. I want to display and convert currency to usd by displaying $. Amount displaying their were correct but i want to display currency symbols in the below code.

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Opportunity"
    subject="Productline Items for Opportunity: {!relatedTo.name}"
    replyTo="support@acme.com" >
   
<messaging:htmlEmailBody >       
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 11px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
        <p>Dear {!recipient.name},</p>
        <p>Below is a list of products related to the Opportunity:<b> {!relatedTo.name}</b>.</p>
        <br/>Account: <i> {!relatedTo.Account.name}  </i> 
        <br/>Opportunity Owner: {!relatedTo.owner.name}
        <br/>Opportunity Amount: {!relatedTo.Amount}
        <br/>Opportunity Close Date: {!relatedTo.CloseDate} 
  
        <p/>                 
       <table border="0" >
                 <tr >
                     <th>Action</th><th>Product Name</th><th>Product Family</th><th>Quantity</th><th>Unit Price</th><th>Total Price</th>
                  </tr>
    <apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td><a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}">View</a> | 
           <a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}/e">Edit</a></td>
           <td>{!opp.PriceBookEntry.name}</td>
           <td>{!opp.Product_Family__c}</td>
           <td>{!(opp.Quantity)}</td>
           <td>{!(opp.UnitPrice)}</td>
           <td>{!(opp.TotalPrice)}</td>
       </tr>
    </apex:repeat>                
       </table>
       <p />
</font>
      
        </body>
    </html>
</messaging:htmlEmailBody>
   
<messaging:plainTextEmailBody >
Dear {!recipient.name},

Below is a list of products related to the Opportunity: {!relatedTo.name}

Account: {!relatedTo.Account.name}
Opportunity Owner: {!relatedTo.owner.name}
Opportunity Amount: {!(relatedTo.Amount)}
Opportunity Close Date: {!relatedTo.CloseDate} 


[ Product Name ] - [ Product Family ] - [ Quantity ] - [ Units ] - [ Total Price ]
-------------------------------------------------------------------------

<apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
[ {!opp.PriceBookEntry.name} ] - [ {!opp.Product_Family__c} ] - [ {!ROUND(opp.Quantity,0)} ] - [ {!(opp.UnitPrice)} ] - [ {!(opp.TotalPrice)} ]
</apex:repeat>

</messaging:plainTextEmailBody>      
       
       
<messaging:attachment renderas="pdf" filename="Opportunity_Products.pdf">

<img src="http://www.salesforce.com/common/assets/css/images/hdr_apexdn.gif" border="0"></img>

        <p>Dear {!recipient.name},</p>
        <p>Below is a list of products related to the Opportunity:<b> {!relatedTo.name}</b>.</p>
        <br/>Account: <i> {!relatedTo.Account.name}  </i> 
        <br/>Opportunity Owner: {!relatedTo.owner.name}
        <br/>Opportunity Amount: {!(relatedTo.Amount)}
        <br/>Opportunity Close Date: {!relatedTo.CloseDate} 
  
        <p/>  
       


    <apex:datatable border="2" cellspacing="5" var="opp2" value="{!relatedTo.OpportunityLineItems}">
        <apex:facet name="header">Products associated with Opportunity {!relatedTo.name}</apex:facet>
       
          <apex:column value="{!opp2.PriceBookEntry.name}" headerValue="Product Name"/>
          <apex:column value="{!opp2.Product_Family__c}" headerValue="Product Family"/>
        <apex:column value="{!opp2.Quantity}" headerValue="Quantity" />
        <apex:column value="{!opp2.UnitPrice}" headerValue="Units" />
        <apex:column value="{!opp2.TotalPrice}" headerValue="Total Price" />
 
      </apex:datatable>


</messaging:attachment>      
       
</messaging:emailTemplate>
I have industry field having some values and now i want to update those values with new adding some more functionality. Please provide how to write a trigger on this

Here is the trigger I'd like to create:

 

I have an Opportunity Product with a Actual Impressions field. I use the Quantity to forecast the likely impressions; however, at the end of each month, I go back and populate Actual Impressions. When I change Actual Impressions, I'd like to launch a trigger that update the Quantity field to the value of the Actual Impressions field. 

 

Any help would be appreciated!

  

My code so far:

 

trigger updateQuantity on OpportunityLineItem (after update) {

for (OpportunityLineItem newQuantity : Trigger.new) {
    OpportunityLineItem oldQuantity = Trigger.oldMap.get(newQuantity.Id);
    if (oldQuantity.Actual_Impressions__c != newQuantity.Actual_Impressions__c) {
        // this is where I don't know how to update a given field
    }
}

}

Is it possible to implement  a functionality like Copy Billing Address to Shipping Address link (which is avilable in account object Address Information pageblock )  in my custom object