• toro
  • NEWBIE
  • 49 Points
  • Member since 2011

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 9
    Replies

I need to setup validation rule on close date in opportunity.

 

What I'm trying to do is alert user if they try to change closed date after ship date in opportunity product. (ship date is custom field in opportunity product)

 

I could not find a way to compare ship date in opportunity product to close date.

 

Also we can have more than one product for an opportunity.

 

Does anyone can tell me how to do this?

  • September 08, 2011
  • Like
  • 0

Our company sells machine to the customers.

We are kind of new to salesforce.

 

We are trying to find the best way to add machine options to product.

for example, we have machine sales qty of 1 for $10,000 with option1 qty of 1 for $1500.

In product, I can add machine for $10,000, but don't know how we should handle options.

Right now, we put machine for $11,500 and options in comment.

 

It looks salesforce does not have capability to do BOM(bill of materials).

 

I don't want to add another product line for option1 because it is one machine sale and it will screw up forecast qty.

 

Does anyone know if there is any good way in salesforce? or good application available?

 

Thank you,

  • August 25, 2011
  • Like
  • 0

Hello,

 

I'm looking for a way to open PDF file in new window after saving current change on the page.

 

I created "Order Report" page, which shows lots of custom fields added on Opportunity, like customer PO#, shipping instruction etc.

When the user finish editing the order report, they need to save it in PDF.

so I've created command button "Convert to PDF" and code is:

 

<apex:commandButton value="Convert to PDF"  onClick="window.open('/apex/orderReportPDF?id={!Opportunity.Id}');" />

 The problenm is the PDF shows the data before the user edit order report.

I think I need to put some code in APEX  extension class, but don't know how to code to open the PDF in new window.

 

or is there a way to show pop-up message to tell them to click "SAVE" button before "Convert to PDF"?

 

Thanks for your help.

  • August 19, 2011
  • Like
  • 0

Hello,

 

Hopefully easy question.

 

I'm trying to create PDF page and trying to format it nicely.

 

I have datatable with columns to list items I want to show.

Since I want to line up all lable and data field nicely, I've put 4 columns (label, data, label, data).

 

The question is how can I get the label of the field?

I've tyied <apex:outuputlabel value="{!Opportunity.Account.Name.label}"/>

also tried <apex:outuputtext value="{!Opportunity.Account.Name.label}"/>

 

 but didn't work.

 

    <apex:dataTable value="{!Opportunity}" var="o" columns="4" columnsWidth="150px, 220px, 150px,220px" >
    <apex:column >
    <apex:outputlabel value="{!o.Account.Name.label}" />
    </apex:column> 
    <apex:column >
    <apex:outputText value="{!o.Account.Name}" />
    </apex:column> 

 

 

  • August 18, 2011
  • Like
  • 0

I'm trying to create PDF page and getting a strange text showing at the bottom of the page.

I'm very new to coding...

 

Can anyone tell me why I'm getting these text and how to fix?

 

the strange text is;

"JanuaryFeburaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember

2010201120122013201420152016

MonTueWedThuFriSatSun

 

Today"

 

and my code is:

<apex:page renderas="PDF" standardController="Opportunity">
<html>
<head>
  <style> 
     interger counter =0;
     body {font-family: Arial Unicode MS; FONT-SIZE:13px} 
     @page{
     size: portrait;
     @top-right {
        fnt-family:sans-serif;
        font-size:80%;
        content: "Page " counter(page)  " of " counter(pages);
    }
    }   
    .header{
    font-reight:bold;
    font-size:20px;} 

  </style>
 </head>

 <body>
<center>
<apex:outputtext value="TMU SALES ORDER REPORT" styleclass="header" />
<hr/>
</center>
<apex:form >

<apex:pageBlock >
    <apex:pageblocksection title="Customer Information" columns="2" >
    <apex:outputtext value="Customer Install Address" styleclass="header" />
    <apex:outputtext value="Invoice Address" styleClass="header" />
    <apex:outputField value="{!Opportunity.AccountID}" />
    <apex:outputtext value=""/>
    <apex:outputfield value="{!opportunity.Account.shippingStreet}" />
    <apex:outputfield value="{!opportunity.Account.billingStreet}" />
    <apex:outputfield value="{!opportunity.Account.shippingCity}" />
    <apex:outputfield value="{!opportunity.Account.billingCity}" />
    <apex:outputfield value="{!opportunity.Account.shippingState}" />
    <apex:outputfield value="{!opportunity.Account.billingState}" />
    <apex:outputfield value="{!opportunity.Account.shippingPostalCode}" />
    <apex:outputfield value="{!opportunity.Account.billingPostalCode}" />
    <br/>
    <b>    If Ship to Address is not Install Address: </b>
    <br/>
    <apex:outputtext value=""/>
    <apex:outputfield value="{!opportunity.Machine_Ship_To__c}" style="width:300px" />
    </apex:pageblocksection>
    <hr/>
         <apex:pageblocksection title="Contact Information" columns="2">
         <apex:outputfield value="{!Opportunity.Customer_Contact__c}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Phone}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Direct_Phone__c}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.FAX}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Email}"/>
     </apex:pageblocksection>
  <hr/>
</apex:pageblock>
</apex:form>

<apex:pageblock >
    <apex:pageBlockSection >
    <apex:relatedList list="OpportunityLineItems"/>
    </apex:pageBlockSection>
</apex:pageblock>

</body>
</html>
</apex:page>

 Thanks.

 

  • August 11, 2011
  • Like
  • 0

Hello,

I'm trying to create test method for my control class.

Here is my control class;

 

 

public class VFController { private final OpportunityLineItem o; public VFController(ApexPages.StandardController stdController) { this.o = (OpportunityLineItem)stdController.getRecord(); } public string theId; // Code we will invoke on page load. public PageReference autoRun() { theId = ApexPages.currentPage().getParameters().get('id'); OpportunityLineItem newprod; string oppID; string prodID; if (theId == null) { // Display the Visualforce page's content if no Id is passed over return null; } upsert(o); for (OpportunityLineItem o:[select Buffers__c, ATC__c, CNC__c, CTS_PSI__c, Chip_Conveyor__c, CreatedById, CreatedDate, ServiceDate, IsDeleted, Head_Change__c, Head_Type__c, OpportunityId, L_U__c, LastModifiedById, LastModifiedDate, Description, Id, ListPrice, Number_of_Pallets__c, Other_Options__c, PricebookEntryId, Product_Family__c, Quantity, RGV__c, Ship_Date__c, SortOrder, Spindle__c, Spindle_Taper__c, SystemModstamp, Table__c, TotalPrice, Delivery_Date__c from OpportunityLineItem where id =:theId]) { // Do all the dirty work we need the code to do upsert(o); newprod = o.clone(false); newprod.Machine_SN__c = 'TBD'; oppID = newprod.OpportunityId; insert newprod; } // Redirect the user back to the original page PageReference pageRef = new PageReference('/' + newprod.id + '/e?retURL='+ oppID); pageRef.setRedirect(true); return pageRef; } 

      

and here is my test method:

 

      static testMethod void testAutoRun(){ OpportunityLineItem opl = new OpportunityLineItem(); opl = [select Id, OpportunityId, Spindle__c, Quantity, Table__c, Ship_Date__c, Delivery_Date__c, Machine_SN__c,TotalPrice from OpportunityLineItem limit 1]; pagereference pageref = new pagereference('/'+opl.Id); Test.setcurrentpage(pageref); VFController vfc = new VFController(new ApexPages.StandardController(opl)); vfc.theId = opl.Id; vfc.autorun(); } 

 

 

How can I put value on theId? The test always go with theId ==null and never gets lower half of the code because I can't put value in theId....

 

This is my first testmethod.

Does anyone can help me? 

 

Thanks.

  • August 03, 2011
  • Like
  • 0

I need to setup validation rule on close date in opportunity.

 

What I'm trying to do is alert user if they try to change closed date after ship date in opportunity product. (ship date is custom field in opportunity product)

 

I could not find a way to compare ship date in opportunity product to close date.

 

Also we can have more than one product for an opportunity.

 

Does anyone can tell me how to do this?

  • September 08, 2011
  • Like
  • 0

Hello,

 

I'm looking for a way to open PDF file in new window after saving current change on the page.

 

I created "Order Report" page, which shows lots of custom fields added on Opportunity, like customer PO#, shipping instruction etc.

When the user finish editing the order report, they need to save it in PDF.

so I've created command button "Convert to PDF" and code is:

 

<apex:commandButton value="Convert to PDF"  onClick="window.open('/apex/orderReportPDF?id={!Opportunity.Id}');" />

 The problenm is the PDF shows the data before the user edit order report.

I think I need to put some code in APEX  extension class, but don't know how to code to open the PDF in new window.

 

or is there a way to show pop-up message to tell them to click "SAVE" button before "Convert to PDF"?

 

Thanks for your help.

  • August 19, 2011
  • Like
  • 0

Hello,

 

Hopefully easy question.

 

I'm trying to create PDF page and trying to format it nicely.

 

I have datatable with columns to list items I want to show.

Since I want to line up all lable and data field nicely, I've put 4 columns (label, data, label, data).

 

The question is how can I get the label of the field?

I've tyied <apex:outuputlabel value="{!Opportunity.Account.Name.label}"/>

also tried <apex:outuputtext value="{!Opportunity.Account.Name.label}"/>

 

 but didn't work.

 

    <apex:dataTable value="{!Opportunity}" var="o" columns="4" columnsWidth="150px, 220px, 150px,220px" >
    <apex:column >
    <apex:outputlabel value="{!o.Account.Name.label}" />
    </apex:column> 
    <apex:column >
    <apex:outputText value="{!o.Account.Name}" />
    </apex:column> 

 

 

  • August 18, 2011
  • Like
  • 0

I'm trying to create PDF page and getting a strange text showing at the bottom of the page.

I'm very new to coding...

 

Can anyone tell me why I'm getting these text and how to fix?

 

the strange text is;

"JanuaryFeburaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember

2010201120122013201420152016

MonTueWedThuFriSatSun

 

Today"

 

and my code is:

<apex:page renderas="PDF" standardController="Opportunity">
<html>
<head>
  <style> 
     interger counter =0;
     body {font-family: Arial Unicode MS; FONT-SIZE:13px} 
     @page{
     size: portrait;
     @top-right {
        fnt-family:sans-serif;
        font-size:80%;
        content: "Page " counter(page)  " of " counter(pages);
    }
    }   
    .header{
    font-reight:bold;
    font-size:20px;} 

  </style>
 </head>

 <body>
<center>
<apex:outputtext value="TMU SALES ORDER REPORT" styleclass="header" />
<hr/>
</center>
<apex:form >

<apex:pageBlock >
    <apex:pageblocksection title="Customer Information" columns="2" >
    <apex:outputtext value="Customer Install Address" styleclass="header" />
    <apex:outputtext value="Invoice Address" styleClass="header" />
    <apex:outputField value="{!Opportunity.AccountID}" />
    <apex:outputtext value=""/>
    <apex:outputfield value="{!opportunity.Account.shippingStreet}" />
    <apex:outputfield value="{!opportunity.Account.billingStreet}" />
    <apex:outputfield value="{!opportunity.Account.shippingCity}" />
    <apex:outputfield value="{!opportunity.Account.billingCity}" />
    <apex:outputfield value="{!opportunity.Account.shippingState}" />
    <apex:outputfield value="{!opportunity.Account.billingState}" />
    <apex:outputfield value="{!opportunity.Account.shippingPostalCode}" />
    <apex:outputfield value="{!opportunity.Account.billingPostalCode}" />
    <br/>
    <b>    If Ship to Address is not Install Address: </b>
    <br/>
    <apex:outputtext value=""/>
    <apex:outputfield value="{!opportunity.Machine_Ship_To__c}" style="width:300px" />
    </apex:pageblocksection>
    <hr/>
         <apex:pageblocksection title="Contact Information" columns="2">
         <apex:outputfield value="{!Opportunity.Customer_Contact__c}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Phone}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Direct_Phone__c}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.FAX}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Email}"/>
     </apex:pageblocksection>
  <hr/>
</apex:pageblock>
</apex:form>

<apex:pageblock >
    <apex:pageBlockSection >
    <apex:relatedList list="OpportunityLineItems"/>
    </apex:pageBlockSection>
</apex:pageblock>

</body>
</html>
</apex:page>

 Thanks.

 

  • August 11, 2011
  • Like
  • 0

Hello,

I'm trying to create test method for my control class.

Here is my control class;

 

 

public class VFController { private final OpportunityLineItem o; public VFController(ApexPages.StandardController stdController) { this.o = (OpportunityLineItem)stdController.getRecord(); } public string theId; // Code we will invoke on page load. public PageReference autoRun() { theId = ApexPages.currentPage().getParameters().get('id'); OpportunityLineItem newprod; string oppID; string prodID; if (theId == null) { // Display the Visualforce page's content if no Id is passed over return null; } upsert(o); for (OpportunityLineItem o:[select Buffers__c, ATC__c, CNC__c, CTS_PSI__c, Chip_Conveyor__c, CreatedById, CreatedDate, ServiceDate, IsDeleted, Head_Change__c, Head_Type__c, OpportunityId, L_U__c, LastModifiedById, LastModifiedDate, Description, Id, ListPrice, Number_of_Pallets__c, Other_Options__c, PricebookEntryId, Product_Family__c, Quantity, RGV__c, Ship_Date__c, SortOrder, Spindle__c, Spindle_Taper__c, SystemModstamp, Table__c, TotalPrice, Delivery_Date__c from OpportunityLineItem where id =:theId]) { // Do all the dirty work we need the code to do upsert(o); newprod = o.clone(false); newprod.Machine_SN__c = 'TBD'; oppID = newprod.OpportunityId; insert newprod; } // Redirect the user back to the original page PageReference pageRef = new PageReference('/' + newprod.id + '/e?retURL='+ oppID); pageRef.setRedirect(true); return pageRef; } 

      

and here is my test method:

 

      static testMethod void testAutoRun(){ OpportunityLineItem opl = new OpportunityLineItem(); opl = [select Id, OpportunityId, Spindle__c, Quantity, Table__c, Ship_Date__c, Delivery_Date__c, Machine_SN__c,TotalPrice from OpportunityLineItem limit 1]; pagereference pageref = new pagereference('/'+opl.Id); Test.setcurrentpage(pageref); VFController vfc = new VFController(new ApexPages.StandardController(opl)); vfc.theId = opl.Id; vfc.autorun(); } 

 

 

How can I put value on theId? The test always go with theId ==null and never gets lower half of the code because I can't put value in theId....

 

This is my first testmethod.

Does anyone can help me? 

 

Thanks.

  • August 03, 2011
  • Like
  • 0