• sparrowbrad
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 7
    Replies
I've followed this article and still having issues when I test deliverability in SF.
http://www.cirrusinsight.com/blog/setting-up-email-relay-for-salesforce-with-office-365

I'm only receiving 5 of the 10 test IP email addresses.

I've made sure to whitelist all SF IP addresses.

Any help would be appreciated.
Looking to get contract help with the below - I'm not a developer, let me know if anyone is interesting in the below project based work.

Objects Referenced
Opportunity
Opportunity Line Items
Payments (custom object that is detail to Opportunity)
 
I’m looking to generate a VisualForce email template so we can send invoices to our clients. The invoice will be generated from the Payment record. 
 
On the invoice, I will display Payment fields (not an issue). But I also want to display the Opportunity Line Items from the related Opportunity record. This is where I’m running into an issue.
 
What I’ve tried is using my VisualForce template on payment object and placing an iframe (the iframe is another VisualForce page that displays the necessary Opportunity Line Items). This worked, however, I need the attachment in the Invoice email to be rendered as a PDF. Iframes are not supported in PDFs.
 
This is where I realized I need a custom controller and DEV help.
My question is directly related to this past posting. But since it's an old post, figured I'd start a new one.
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000973BIAQ

I have a custom object, called Payments, which is in a master-detail relationship to Opportunity. I'm trying to create a visualforce page (render as PDF) on the Payments object. On this visualforce page, I need to display the Opportunity Products (line items). However, I haven't found a way to reference these line items from the Payment object.

So I tried the solution, in the posting above, create two separate VF pages  
    1. One on Opportunity - to show product information
    2. One on Payments - used an iframe to display the opportunity VF page
       
This almost satifies my requirements, but you can't render as PDF with an iFrame.

Any thoughts / suggestions would be greatly appreciated!

Everything posted here is in reference to this post
http://www.michaelforce.org/recipeView?id=a0G30000006eVxVEAU

 

Installed this unmanaged package from the link above and trying to figure out why this is making user select a pricebook even though there is only one available.

 

This package includes 3 classes and 2 VF pages.

 

I can posts the others if needed, but it seems like the "issue" is within this class. Even the documentation states it shouldn't ask for a pricebook if only exists. I'm not a developer, so are there anything that stands out here.

 

 

 

public with sharing class opportunityProductEntryExtension {

public Opportunity theOpp {get;set;}
public String searchString {get;set;}
public opportunityLineItem[] shoppingCart {get;set;}
public priceBookEntry[] AvailableProducts {get;set;}
public Pricebook2 theBook {get;set;}

public String toSelect {get; set;}
public String toUnselect {get; set;}
public Decimal Total {get;set;}

public Boolean overLimit {get;set;}
public Boolean multipleCurrencies {get; set;}

private Boolean forcePricebookSelection = false;

private opportunityLineItem[] forDeletion = new opportunityLineItem[]{};


public opportunityProductEntryExtension(ApexPages.StandardController controller) {

// Need to know if org has multiple currencies enabled
multipleCurrencies = UserInfo.isMultiCurrencyOrganization();

// Get information about the Opportunity being worked on
if(multipleCurrencies)
theOpp = database.query('select Id, Pricebook2Id, Pricebook2.Name, CurrencyIsoCode from Opportunity where Id = \'' + controller.getRecord().Id + '\' limit 1');
else
theOpp = [select Id, Pricebook2Id, PriceBook2.Name, Start_Date__c, End_Date__c from Opportunity where Id = :controller.getRecord().Id limit 1];

// If products were previously selected need to put them in the "selected products" section to start with
shoppingCart = [select Id, Quantity, TotalPrice, UnitPrice, Desired_Amount__c, Discount, Description, PriceBookEntryId, PriceBookEntry.Name, PriceBookEntry.IsActive, PriceBookEntry.Product2Id, PriceBookEntry.Product2.Name, PriceBookEntry.PriceBook2Id from opportunityLineItem where OpportunityId=:theOpp.Id];

// Check if Opp has a pricebook associated yet
if(theOpp.Pricebook2Id == null){
Pricebook2[] activepbs = [select Id, Name from Pricebook2 where isActive = true limit 2];
if(activepbs.size() == 2){
forcePricebookSelection = true;
theBook = new Pricebook2();
}
else{
theBook = activepbs[0];
}
}
else{
theBook = theOpp.Pricebook2;
}

if(!forcePricebookSelection)
updateAvailableList();
}

// this is the 'action' method on the page

public PageReference priceBookCheck(){

// if the user needs to select a pricebook before we proceed we send them to standard pricebook selection screen
if(forcePricebookSelection){
return changePricebook();
}
else{

//if there is only one active pricebook we go with it and save the opp
if(theOpp.pricebook2Id != theBook.Id){
try{
theOpp.Pricebook2Id = theBook.Id;
update(theOpp);
}
catch(Exception e){
ApexPages.addMessages(e);
}
}

return null;
}
}

public String getChosenCurrency(){

if(multipleCurrencies)
return (String)theOpp.get('CurrencyIsoCode');
else
return '';
}

public void updateAvailableList() {

// We dynamically build a query string and exclude items already in the shopping cart
String qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Pricebook2Id = \'' + theBook.Id + '\'';
if(multipleCurrencies)
qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';

// note that we are looking for the search string entered by the user in the name OR description
// modify this to search other fields if desired
if(searchString!=null){
qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.Description like \'%' + searchString + '%\')';
}

Set<Id> selectedEntries = new Set<Id>();
for(opportunityLineItem d:shoppingCart){
selectedEntries.add(d.PricebookEntryId);
}

if(selectedEntries.size()>0){
String tempFilter = ' and Id not in (';
for(Id i : selectedEntries){
tempFilter+= '\'' + (String)i + '\',';
}
String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
extraFilter+= ')';

qString+= extraFilter;
}

qString+= ' order by Product2.Name';
qString+= ' limit 101';

system.debug('qString:' +qString);
AvailableProducts = database.query(qString);

// We only display up to 100 results... if there are more than we let the user know (see vf page)
if(AvailableProducts.size()==101){
AvailableProducts.remove(100);
overLimit = true;
}
else{
overLimit=false;
}
}

public void addToShoppingCart(){

// This function runs when a user hits "select" button next to a product

for(PricebookEntry d : AvailableProducts){
if((String)d.Id==toSelect){
shoppingCart.add(new opportunityLineItem(OpportunityId=theOpp.Id, PriceBookEntry=d, PriceBookEntryId=d.Id, UnitPrice=d.UnitPrice));
break;
}
}

updateAvailableList();
}

public PageReference removeFromShoppingCart(){

// This function runs when a user hits "remove" on an item in the "Selected Products" section

Integer count = 0;

for(opportunityLineItem d : shoppingCart){
if((String)d.PriceBookEntryId==toUnselect){

if(d.Id!=null)
forDeletion.add(d);

shoppingCart.remove(count);
break;
}
count++;
}

updateAvailableList();

return null;
}

public PageReference onSave(){

// If previously selected products are now removed, we need to delete them
if(forDeletion.size()>0)
delete(forDeletion);

// Previously selected products may have new quantities and amounts, and we may have new products listed, so we use upsert here
try{
if(shoppingCart.size()>0)
upsert(shoppingCart);
}
catch(Exception e){
ApexPages.addMessages(e);
return null;
}

// After save return the user to the Opportunity
return new PageReference('/' + ApexPages.currentPage().getParameters().get('Id'));
}

public PageReference onCancel(){

// If user hits cancel we commit no changes and return them to the Opportunity
return new PageReference('/' + ApexPages.currentPage().getParameters().get('Id'));
}

public PageReference changePricebook(){

// This simply returns a PageReference to the standard Pricebook selection screen
// Note that is uses retURL parameter to make sure the user is sent back after they choose

PageReference ref = new PageReference('/oppitm/choosepricebook.jsp');
ref.getParameters().put('id',theOpp.Id);
ref.getParameters().put('retURL','/apex/opportunityProductEntry?id=' + theOpp.Id);

return ref;
}
}

Hello-

Junior Apex Trigger writer.

 

I am trying to Prepopulating Goal based on User/Close Date. I am getting a READ ONLY error. I am using two text formula fields (one on goal and one on payment)....to create a "unique identifier" to match the two.

------- 

UserID&Year&Month

 

Goal - Opportunity_Identifier__c

Payment - Goal_Identifier__c

-------- 

Basically I want the payment to match its identifier with the one Goal record it finds, then insert that Goal ID on the payment record

I can’t figure it out, but clearly violating some order of execution (code below) What do you think?

 

 

-------

trigger UpdateGoalname on Payments__c (after insert,after update) {

 

    Payments__c[] pay = Trigger.new;

   

    if(pay.size() ==1)

    {

        Goal__c g = [select id, Opportunity_Identifier__c from Goal__c where Opportunity_Identifier__c = :pay[0].Goal_Identifier__c];

       

         pay[0].Goal__c = g.id ;

           

        update pay;

       

          } 

            

        }

My question is directly related to this past posting. But since it's an old post, figured I'd start a new one.
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000973BIAQ

I have a custom object, called Payments, which is in a master-detail relationship to Opportunity. I'm trying to create a visualforce page (render as PDF) on the Payments object. On this visualforce page, I need to display the Opportunity Products (line items). However, I haven't found a way to reference these line items from the Payment object.

So I tried the solution, in the posting above, create two separate VF pages  
    1. One on Opportunity - to show product information
    2. One on Payments - used an iframe to display the opportunity VF page
       
This almost satifies my requirements, but you can't render as PDF with an iFrame.

Any thoughts / suggestions would be greatly appreciated!

Hello-

Junior Apex Trigger writer.

 

I am trying to Prepopulating Goal based on User/Close Date. I am getting a READ ONLY error. I am using two text formula fields (one on goal and one on payment)....to create a "unique identifier" to match the two.

------- 

UserID&Year&Month

 

Goal - Opportunity_Identifier__c

Payment - Goal_Identifier__c

-------- 

Basically I want the payment to match its identifier with the one Goal record it finds, then insert that Goal ID on the payment record

I can’t figure it out, but clearly violating some order of execution (code below) What do you think?

 

 

-------

trigger UpdateGoalname on Payments__c (after insert,after update) {

 

    Payments__c[] pay = Trigger.new;

   

    if(pay.size() ==1)

    {

        Goal__c g = [select id, Opportunity_Identifier__c from Goal__c where Opportunity_Identifier__c = :pay[0].Goal_Identifier__c];

       

         pay[0].Goal__c = g.id ;

           

        update pay;

       

          } 

            

        }

Hi,

 

I'm getting this error: 

 


Error: Invalid field Discount for SObject OpportunityLineItem in creating a new VisualForce Page.

 

To be noted is Discount is already there in the Quote Line Item .

 

And the same Code works well for visualforce email Template.

 

Please help me.

 

<td><apex:OutputField value="{!line.Discount}"/></td>

  • March 25, 2012
  • Like
  • 0

I need to conditionally display some text based on an Account field.  The email template is based on Case.

 

Here are two formulas I'm using:

 

  • Account- {!Account.BusinessUnitOwner__c}
  • {!IF(ISPICKVAL(Account.BusinessUnitOwner__c,'Shoes'),'YES','NO')}

 

The first formula correctly displays the Business Unit Owner field in my template.  The second formula always returns NO, regardless of the value of Business Unit Owner.  I have pasted the second formula into a custom formula field on Case, and it works correctly there.  It just won't work in the email template.

 

Can anyone offer advice on how to get this working in an email template?

 

This is my VF code:

 

<apex:dataTable value="{!Order__c.Opportunity__r.OpportunityLineItems}" var="d">
	<apex:column headerValue="Desc" value="{!d.Description}"/>
</apex:dataTable>

 

I am receiving an error: Error: Aggregate Relationship is used in an unsupported complex expression containing 'opportunity__r.opportunitylineitems'

 

 

Order__c is a custom object which has master-detail relationship with opportunity. I am trying to display the OpportunityLineItem details in a VF page on click of a button(Generate Order, present in Order detail page).

 

Can anybody explain whats wrong?

 

Is there a way to use formulas in Email templates to handle conditional formatting?

For example, I'd like to use the formula UPPER( NAME HERE ) to cause the person's name to appear in all CAPS, even though it may appear as "Name Here" in the SFDC database. This is just one example.

Furthermore, there may be conditions upon which you do or do not want to show certain information in an email response. Using formulas would be helpful. I didn't see any documentation on this when search for "formulas in email templates" -- so I'm not sure if it's possible.

Thanks.