• Max Smith
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
Hi All,

My salesforce org has multi-currency enabled.  We have a separate PriceBook (not separate entries in the same PriceBook) for all of our regions.  
 I have a custom object Professional_Services__c that is the child of Opportunity.  I have built a flow using the Process Builder that inserts/updates an OpportunityLineItem whenever a  Professional_Services__c object is inserted/updated.  

The PriceBookEntryID of the OLI will vary based on the PriceBook associated with the Opportunity (e.g. OLI will have a GBP PricebookEntry if Opportunity Pricebook is GBP, USD PricebookEntry if Opportunity Pricebook is USD).  
User-added image
The obvious problem here is that currently I'm forced to hardcode the PriceBookEntryID.  So when I migrate this process to production, I would have to change the PriceBookEntryIDs to those in Production which would be annoying but not showstopping.  The showstopping part is that this breaks my tests, which I need to migrate to production.  The tests generate PriceBooks, PriceBookEntries, etc. to prevent all of the pitfalls of using the (SeeAllData=true) annotation.  Is there any possible way to dynamically reference the PriceBookEntryID in the Process Builder?

As a side, because of the order of execution, I cannot accomplish this task using triggers, as relevant values from roll-up fields wouldn't be populated.

Thank you all in advance for your time,

Max
Hi All, 

I believe this is a bug although I hope someone can point out that I'm doing something wrong.  In of my controllers for I'm preparing parameters to pass information to a visualforce page once the user clicks my custom 'Next" button.  See below
 
PageReference retValue = Page.OppAccountSelection;
retValue.getParameters().put('RecordType',rtid);

I have verified that at this point in time rtid = 012e00000009EE6AAM.  The URL for the page is
  
https://c.cs15.visual.force.com/apex/OpportunityRedirect?lookupcmpgn=1&retURL=%2F003e000000ajjOV&accid=001e000000lfd7B&conid=003e000000ajjOV&RecordType=012e00000009EE6&ent=Opportunity&save_new=1&sfdc.override=1

The first weird thing is that it shaved the final three characters off
012e00000009EE6AAM (input) vs. 012e00000009EE6 (URL)

The second strange thing is that after I go to the new VisualForce page (above URL) and I execute the following in the controller
Map<String, String> strMap = ApexPages.currentPage().getParameters();
ID rtid = strMap.get('RecordType');

I get 

System.StringException: Invalid id: 012e00000009EE6AAM?retURL=/003e000000ajjOV
Error is in expression '{!selectAccount}' in component <apex:commandButton> in page oppaccountselection: Class.OpportunityRedirectController.selectAccount: line 186, column 1
Class.OpportunityRedirectController.selectAccount: line 186, column 1

I have printed out strMap and it turns out getParameters is parsing the RecordType paramater as 012e00000009EE6AAM?retURL=/003e000000ajjOV and completely ignoring the usual '?' separator.

I am completely clueless as to why this is happening.

Thanks in advance!

Max
 
Hi All,

I'm trying to get a different approval process to kick off depending on the Record Type of the Opportunity.  Besides Record Type, Stage = 'Closed Won' on the Opportunity is the other entry criteria.  I thought that this would be as easy as selecting "Opportunity: Record Type ID" from the entry criteria on the Approval Process Entry Criteria page but I can't get this option to appear.  Any help would be greatly appreciated.

As a side, this is in the context that I want a different email template to be used for each record type for a submitted opportunity.  Because you can only select one email template per approval process, I am going off of the assumption that I just have to make several approval processes to do the same thing.  The processes themselves don't look different, just the email template.

Thanks in Advance,

Max
Hi All,

Please see my code below
<table class="section">
        <tr>
            <apex:repeat value="{!hostedHeaders}" var="header">
                <th><apex:outputText value="{!header}"></apex:outputText> </th>
            </apex:repeat>   
        </tr>       
        <apex:repeat value="{!hostedProducts}" var="hProd">
        	<tr>
	       		<apex:repeat value="{!hProd}" var="prod">
	       			<td><apex:outputText value="{!prod}"></apex:outputText> </td>
	           	</apex:repeat>  
            </tr>
        </apex:repeat>
    </table>

I'm trying to dynamically create a table for an email template.  The table will have a dynamic number of columns.  The above visualforce markup is controlled by a custom controller on the back end and I can provide it if needed but I don't want to overly complicate things.

HostedProducts is a list of OpportunityLineItem.  The controller decides which OLI fields are queried and sent back to the component.  I want to display every queried field for each OLI returned.  Because this is dynamic, I don't know the field names until runtime.  So I can't use the typical {!hprod.unitprice}.

Any direction would be appreciated.

Thanks,
Max
Hi All,

I've created a custom visualforce component and controller for use in a custom visualforce email template.  The component code is below:
<apex:component access="global" controller="hostedFeeInfoController">    
    <apex:attribute type="String" name="oppoID" assignTo="{!oppID}" description="current opportunity ID"/> 
    <apex:attribute type="Decimal" name="contractTerm" assignTo="{!term}" description="length of contract term"/>
    
	<p class="sectionHeaders">Hosted Fee Information</p>  
    <apex:dataTable id="hostedFeeTable" value="{!yt}" var="yearT">
        <apex:repeat var="total" value="{!yearT.totals}">
            <apex:column headerValue="test">
            	<apex:outputText value="{!total}"></apex:outputText>
        	</apex:column> 
        </apex:repeat>
    </apex:dataTable>
</apex:component>

The component is called with the exact same parameters between the email body and also in a PDF attachment.  Surprisingly, the "Hosted Fee Information" in the <p> tag displays in the PDF but not the email body.  The actual data table does not display in either.  My question is, how do I go about debugging this?  Is there some log I can look at?  I can't find an error message, the table just simply doesn't appear

Thanks,
Max
Hi All,

On two occasions now (triggers and mail templates) developing with apex I have seen the behavior displayed in the picture below.  The editor highlights the line I'm on but actually gets in the way of me seeing what I'm typing.  Does anybody know how to turn off this highlight line?User-added image
 
Hi All,

I'm trying to get a different approval process to kick off depending on the Record Type of the Opportunity.  Besides Record Type, Stage = 'Closed Won' on the Opportunity is the other entry criteria.  I thought that this would be as easy as selecting "Opportunity: Record Type ID" from the entry criteria on the Approval Process Entry Criteria page but I can't get this option to appear.  Any help would be greatly appreciated.

As a side, this is in the context that I want a different email template to be used for each record type for a submitted opportunity.  Because you can only select one email template per approval process, I am going off of the assumption that I just have to make several approval processes to do the same thing.  The processes themselves don't look different, just the email template.

Thanks in Advance,

Max
Hi All,

Please see my code below
<table class="section">
        <tr>
            <apex:repeat value="{!hostedHeaders}" var="header">
                <th><apex:outputText value="{!header}"></apex:outputText> </th>
            </apex:repeat>   
        </tr>       
        <apex:repeat value="{!hostedProducts}" var="hProd">
        	<tr>
	       		<apex:repeat value="{!hProd}" var="prod">
	       			<td><apex:outputText value="{!prod}"></apex:outputText> </td>
	           	</apex:repeat>  
            </tr>
        </apex:repeat>
    </table>

I'm trying to dynamically create a table for an email template.  The table will have a dynamic number of columns.  The above visualforce markup is controlled by a custom controller on the back end and I can provide it if needed but I don't want to overly complicate things.

HostedProducts is a list of OpportunityLineItem.  The controller decides which OLI fields are queried and sent back to the component.  I want to display every queried field for each OLI returned.  Because this is dynamic, I don't know the field names until runtime.  So I can't use the typical {!hprod.unitprice}.

Any direction would be appreciated.

Thanks,
Max