• go_bear_2001
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 10
    Replies

 

hi all,

 

I have this requirement and wondering as if anyone might share some of your opinions.  I need to enforce users to input a very detail Win/Loss reasons and Win/Loss Details when their opportunity are set to Won or Lost.  Only When an opportunity stage is set to Won or Lost, I need a way to display these 2 Win/Loss sections on the Opportunity Edit page which enforces users to specify its reasons and details:

-------------------------

Win/Loss Reasons:  (Checkboxes for these)

Competitive Price Bankruptcy

Specification  Quality

-------------------------

Win/Loss Details    (Drop-down selection for these)

Price Difference

Technology

Features

 

One approach is to pop out a Visualforce page which have the 2 Win/Loss sections after users click Save on Opportunity and the Opportunity Stage is Won or Loss.  However, I don't think I can override the Save button behavior there. 

 

I guess one solution is probably writing a VF page to override the Edit button on Opportunity.  Then,I can put event=onchange on Opportunity Stage and force a page refresh if Opportunity Stage is changed to Won/Loss.  However, overriding the entire Edit page on Opportunity might be a tedious task.

 

anybody has any simpler idea on achieving this?

 

thanks,

Klein 

 

 

I'm trying to insert a header in every 10 lines while iterating and display data from a list of objects. I thought of using a temp javascript variable as a counter during iteration and insert a header when necessary but it did not work.  My VF is below:

--------------

<script>

var counter =0; 

</script> 

 <table>

  <tr align="left">

<apex:repeat value="{!headers}" var="h">

<td colspan="1">{!h}</td>

</apex:repeat>

</tr>

<apex:repeat value="{!list_orders}" var="tlist">

<tr>

<td><apex:outputText value="{!tlist.productname}" /></td>

<td><apex:outputText value="{!tlist.productdesc}" /></td>

<td colspan="1"><apex:inputText size="3" value="{!tlist.Qty_M1}" /></td>

<td colspan="1"><apex:inputText size="3" value="{!tlist.Qty_M2}" /></td>

<td colspan="1"><apex:inputText size="3" value="{!tlist.Qty_M3}" /></td> 

</tr>

<script>

counter++;

if(counter % 10 ==0){ 

</script>

   <tr align="left">

<apex:repeat value="{!headers}" var="h">

<td colspan="1">{!h}</td>

</apex:repeat>

</tr>

<script>

  }

</script> 

</apex:repeat>

</table> 

-------------- 

Basically, headers is just a collection of string:

"Product    Product Desc    Quantity_Month1    Quantity_Month2    Quantity_Month3"

and list_orders is a list of a custom object (Orders) that I built from an apex controller and it returns right values.  In IE, when I running this VF page, it notifies an error on the close bracket on the script section, but could not figure out why.

 

anybody came across something like this and had a solution as if I'm not sure my above solution would work? 

thanks ,

go_bear_2001 

Hi,

I have a unique requirement and could not figure out ways to get around to display and edit data:

 

-We have Opportunity Products and then we created another custom object called AgreementOrder.  This AgreementOrder object does have a lookup reference to the Opportunity Product standard object. The AgreementOrder is used to track agreement order by month. So basically this AgreementOrder object has 3 fields:

1) ProductID(lookup to Opty Product)

2) Month

3) Quantity

 

-So for ex.:

------------------ 

***Product 1: Laptop_ABC

   *There are 3 AgreementOrder records:

      -AgreementOrder record 1: Month: Jan-2010, Quantity=10 

      -AgreementOrder record 2: Month: Feb-2010, Quantity=15  

      -AgreementOrder record 3: Month: Mar-2010, Quantity=20  

***Product 1: Laptop_XYZ

   *There are 2 AgreementOrder records:

      -AgreementOrder record 1: Month: Mar-2010, Quantity=3

      -AgreementOrder record 2: Month: Apr-2010, Quantity=50

-----------------

What I want is to display on VF something like a summary of Quantity from AgreementOrder:

 

ProductID           Jan-2010    Feb-2010   Mar-2010   April-2010 

Laptop_ABC         10               15             20             -

Laptop_XYZ          -                 -               -             50 

 

 I could not figure out a way to iterate over all AgreementOrder records since each AgreementOrder record gives me the Quantity for only a single month.  In other words, iterate over all AgreementOrder records and display one-by-one is not going to work.

 

I also thought about building a map where I map ProductID to a list of Quantity values, but then I'm not sure how to iterate over this map, and it seems complicated.

 

Anyone experience anything similar.  Any input is highly appreciated !

-Klein 

Hi,

We're currently have a Salesforce Enterprise license and I'm wondering as if is there a way we can bring all of our existing data from our Production environment to our Sandbox environment so that we can do some performance tests.  Any idea is welcome.

 

Thanks,

bear_2001

 Hi,
 
I'm having this SELF_REFERENCE_FROM_TRIGGER exception and don't know what causes this.  Basically, I need to write a trigger on Quote object so that if a Quote get approved, all Quote lines in that Quote would then have their Unit_Price set to Requested_Price.  A SFDC_520_Quote__c  is a master object,and SFDC_520_QuoteLine__c is detail object in a master-detail relationship.  The below exception was thrown on the line where I update Quote lines records.  In this case, I try to update Quote lines objects which are different from Quote objects, so I don't think I try to update the same objects on which the trigger get executed.  Can anybody give a light on this if you come across something similar?

UpdateQuotelineitems: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0I80000004PrzSEAS; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a0J80000001R4cQ) is currently in trigger UpdateQuotelineitems, therefore it cannot recursively update itself: [] Trigger.UpdateQuotelineitems

 
======== 
trigger UpdateQuotelineitems on SFDC_520_Quote__c (before update) {
// Set of quote ids for which quote_line_items are changed
    Set<ID> idSet = new Set<ID>();
    List<SFDC_520_Quote__c> quote_list = new List<SFDC_520_Quote__c>();
    
    for (ID quoteId : Trigger.newMap.keySet()){
        if (Trigger.newMap.get(quoteId).Approved__c == true){
            idSet.add(quoteId);
            quote_list.add(Trigger.newMap.get(quoteId));
        }
    }            
    if (idSet.size() == 0)
        return;
List<SFDC_520_QuoteLine__c> quotelinesList = [select id, Quote__c, Customer_Requested_Price__c, Unit_Price__c from SFDC_520_QuoteLine__c where Quote__c in :idSet];
    if (quotelinesList.size() == 0)
        return;
        
for (SFDC_520_QuoteLine__c ql : quotelinesList) {
ql. Unit_Price__c = ql.Requested_Price__c;
}        
//update Quote line records
update quotelinesList;   
for (SFDC_520_Quote__c q1 : quote_list) {
q1.Quotelinetrigger_flag__c = true;
}
}
========== 

Hi,

 

I'm trying to override a Clone button on one of our custom objects(Lead_Line_Items).  Basically I have 2 record types for this object (i.e Record Type A and Record Type B).  What I want is to override the Clone button sothat when I clone  the Lead_Line_Items object and regardless of the current record type of the object I'm cloning, the new object will be always set to have Record Type A.

 

As far as I know, I have to write a Visualforce page to override a standard button.  I'm searching around for a sample Visualforce page that overwrite a standard button but could not find any yet.  Can anyone mind to share a short sample VF page that help me to get started?  any other ideas/suggestions for solving that problem are welome.  

 

Thanks,

Klein

Message Edited by go_bear_2001 on 09-28-2009 07:12 AM

I have this trigger working but have a hard time trying to convert it to a bulk trigger to get around w/ the governor limit of invoking too many SQLs:

==========

trigger Assign_FiscalMonth on Opportunity_Line_Item__c (before insert, before update) {
    List<Opportunity_Line_Item__c> optyToUpdate = new List<Opportunity_Line_Item__c>();

    for(Opportunity_Line_Item__c opp: Trigger.New){
        Date d = opp.Win_Date__c;
        Period p = [select PeriodLabel from Period where Type='Month' and Startdate <= :d and Enddate >= :d];
        opp.Fiscal_Month__c = p.PeriodLabel;      
    }
}
==========
What it's supposed to do is for each Opportunity_Line_Item object, we examine a date custom field (Win_Date__c) and try to determine which fiscal month it's belonging to, and then set the value according to another custom field (Fiscal_Month__c) on that same object.
 
We already set the period label correct in the setup menu, so the Period table would have some thing like:
Startdate        Enddate          PeriodLabel

09/15/2009    10/13/2009     Oct

10/14/2009    11/20/2009     Nov

11/21/2009    12/16/2009     Dec

and so on.....

 

I'm thinking of create a set for all the date field (Win_Date__c), but could not come up w/ any way where I can use IN in my query.

 

Really appreaciate if anyone shares any light on this.

 

Thanks,

Klein

Message Edited by go_bear_2001 on 09-21-2009 06:06 PM

Hi,

 

I'm trying to create 2 fields which supposed to return fiscal month and fiscal year from a given date.  I set up Custom Fiscal Year from the setup menu, and the formula for the 2 fields are just MONTH (date) and YEAR (date).  Apparently the 2 values do not return correctly.  They are just return month and year value as it's in normal calendar.  Is there a way to get the fiscal month and fiscal year (based on a fiscal calendar set in the system) from a given date?  I would assume after I set Custom Fiscal Year, running MONTH(date) would return me the correct month based on fiscal year, but somehow it did not.

 

Can you give me some lights if you have any suggestion?  Am I missing anything?

 

Thanks,

Klein

 

hi all,

 

I have this requirement and wondering as if anyone might share some of your opinions.  I need to enforce users to input a very detail Win/Loss reasons and Win/Loss Details when their opportunity are set to Won or Lost.  Only When an opportunity stage is set to Won or Lost, I need a way to display these 2 Win/Loss sections on the Opportunity Edit page which enforces users to specify its reasons and details:

-------------------------

Win/Loss Reasons:  (Checkboxes for these)

Competitive Price Bankruptcy

Specification  Quality

-------------------------

Win/Loss Details    (Drop-down selection for these)

Price Difference

Technology

Features

 

One approach is to pop out a Visualforce page which have the 2 Win/Loss sections after users click Save on Opportunity and the Opportunity Stage is Won or Loss.  However, I don't think I can override the Save button behavior there. 

 

I guess one solution is probably writing a VF page to override the Edit button on Opportunity.  Then,I can put event=onchange on Opportunity Stage and force a page refresh if Opportunity Stage is changed to Won/Loss.  However, overriding the entire Edit page on Opportunity might be a tedious task.

 

anybody has any simpler idea on achieving this?

 

thanks,

Klein 

 

 

I'm trying to insert a header in every 10 lines while iterating and display data from a list of objects. I thought of using a temp javascript variable as a counter during iteration and insert a header when necessary but it did not work.  My VF is below:

--------------

<script>

var counter =0; 

</script> 

 <table>

  <tr align="left">

<apex:repeat value="{!headers}" var="h">

<td colspan="1">{!h}</td>

</apex:repeat>

</tr>

<apex:repeat value="{!list_orders}" var="tlist">

<tr>

<td><apex:outputText value="{!tlist.productname}" /></td>

<td><apex:outputText value="{!tlist.productdesc}" /></td>

<td colspan="1"><apex:inputText size="3" value="{!tlist.Qty_M1}" /></td>

<td colspan="1"><apex:inputText size="3" value="{!tlist.Qty_M2}" /></td>

<td colspan="1"><apex:inputText size="3" value="{!tlist.Qty_M3}" /></td> 

</tr>

<script>

counter++;

if(counter % 10 ==0){ 

</script>

   <tr align="left">

<apex:repeat value="{!headers}" var="h">

<td colspan="1">{!h}</td>

</apex:repeat>

</tr>

<script>

  }

</script> 

</apex:repeat>

</table> 

-------------- 

Basically, headers is just a collection of string:

"Product    Product Desc    Quantity_Month1    Quantity_Month2    Quantity_Month3"

and list_orders is a list of a custom object (Orders) that I built from an apex controller and it returns right values.  In IE, when I running this VF page, it notifies an error on the close bracket on the script section, but could not figure out why.

 

anybody came across something like this and had a solution as if I'm not sure my above solution would work? 

thanks ,

go_bear_2001 

Hi,

I have a unique requirement and could not figure out ways to get around to display and edit data:

 

-We have Opportunity Products and then we created another custom object called AgreementOrder.  This AgreementOrder object does have a lookup reference to the Opportunity Product standard object. The AgreementOrder is used to track agreement order by month. So basically this AgreementOrder object has 3 fields:

1) ProductID(lookup to Opty Product)

2) Month

3) Quantity

 

-So for ex.:

------------------ 

***Product 1: Laptop_ABC

   *There are 3 AgreementOrder records:

      -AgreementOrder record 1: Month: Jan-2010, Quantity=10 

      -AgreementOrder record 2: Month: Feb-2010, Quantity=15  

      -AgreementOrder record 3: Month: Mar-2010, Quantity=20  

***Product 1: Laptop_XYZ

   *There are 2 AgreementOrder records:

      -AgreementOrder record 1: Month: Mar-2010, Quantity=3

      -AgreementOrder record 2: Month: Apr-2010, Quantity=50

-----------------

What I want is to display on VF something like a summary of Quantity from AgreementOrder:

 

ProductID           Jan-2010    Feb-2010   Mar-2010   April-2010 

Laptop_ABC         10               15             20             -

Laptop_XYZ          -                 -               -             50 

 

 I could not figure out a way to iterate over all AgreementOrder records since each AgreementOrder record gives me the Quantity for only a single month.  In other words, iterate over all AgreementOrder records and display one-by-one is not going to work.

 

I also thought about building a map where I map ProductID to a list of Quantity values, but then I'm not sure how to iterate over this map, and it seems complicated.

 

Anyone experience anything similar.  Any input is highly appreciated !

-Klein 

Hi,

We're currently have a Salesforce Enterprise license and I'm wondering as if is there a way we can bring all of our existing data from our Production environment to our Sandbox environment so that we can do some performance tests.  Any idea is welcome.

 

Thanks,

bear_2001

 Hi,
 
I'm having this SELF_REFERENCE_FROM_TRIGGER exception and don't know what causes this.  Basically, I need to write a trigger on Quote object so that if a Quote get approved, all Quote lines in that Quote would then have their Unit_Price set to Requested_Price.  A SFDC_520_Quote__c  is a master object,and SFDC_520_QuoteLine__c is detail object in a master-detail relationship.  The below exception was thrown on the line where I update Quote lines records.  In this case, I try to update Quote lines objects which are different from Quote objects, so I don't think I try to update the same objects on which the trigger get executed.  Can anybody give a light on this if you come across something similar?

UpdateQuotelineitems: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0I80000004PrzSEAS; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a0J80000001R4cQ) is currently in trigger UpdateQuotelineitems, therefore it cannot recursively update itself: [] Trigger.UpdateQuotelineitems

 
======== 
trigger UpdateQuotelineitems on SFDC_520_Quote__c (before update) {
// Set of quote ids for which quote_line_items are changed
    Set<ID> idSet = new Set<ID>();
    List<SFDC_520_Quote__c> quote_list = new List<SFDC_520_Quote__c>();
    
    for (ID quoteId : Trigger.newMap.keySet()){
        if (Trigger.newMap.get(quoteId).Approved__c == true){
            idSet.add(quoteId);
            quote_list.add(Trigger.newMap.get(quoteId));
        }
    }            
    if (idSet.size() == 0)
        return;
List<SFDC_520_QuoteLine__c> quotelinesList = [select id, Quote__c, Customer_Requested_Price__c, Unit_Price__c from SFDC_520_QuoteLine__c where Quote__c in :idSet];
    if (quotelinesList.size() == 0)
        return;
        
for (SFDC_520_QuoteLine__c ql : quotelinesList) {
ql. Unit_Price__c = ql.Requested_Price__c;
}        
//update Quote line records
update quotelinesList;   
for (SFDC_520_Quote__c q1 : quote_list) {
q1.Quotelinetrigger_flag__c = true;
}
}
========== 

Hi,

 

I'm trying to override a Clone button on one of our custom objects(Lead_Line_Items).  Basically I have 2 record types for this object (i.e Record Type A and Record Type B).  What I want is to override the Clone button sothat when I clone  the Lead_Line_Items object and regardless of the current record type of the object I'm cloning, the new object will be always set to have Record Type A.

 

As far as I know, I have to write a Visualforce page to override a standard button.  I'm searching around for a sample Visualforce page that overwrite a standard button but could not find any yet.  Can anyone mind to share a short sample VF page that help me to get started?  any other ideas/suggestions for solving that problem are welome.  

 

Thanks,

Klein

Message Edited by go_bear_2001 on 09-28-2009 07:12 AM

I have this trigger working but have a hard time trying to convert it to a bulk trigger to get around w/ the governor limit of invoking too many SQLs:

==========

trigger Assign_FiscalMonth on Opportunity_Line_Item__c (before insert, before update) {
    List<Opportunity_Line_Item__c> optyToUpdate = new List<Opportunity_Line_Item__c>();

    for(Opportunity_Line_Item__c opp: Trigger.New){
        Date d = opp.Win_Date__c;
        Period p = [select PeriodLabel from Period where Type='Month' and Startdate <= :d and Enddate >= :d];
        opp.Fiscal_Month__c = p.PeriodLabel;      
    }
}
==========
What it's supposed to do is for each Opportunity_Line_Item object, we examine a date custom field (Win_Date__c) and try to determine which fiscal month it's belonging to, and then set the value according to another custom field (Fiscal_Month__c) on that same object.
 
We already set the period label correct in the setup menu, so the Period table would have some thing like:
Startdate        Enddate          PeriodLabel

09/15/2009    10/13/2009     Oct

10/14/2009    11/20/2009     Nov

11/21/2009    12/16/2009     Dec

and so on.....

 

I'm thinking of create a set for all the date field (Win_Date__c), but could not come up w/ any way where I can use IN in my query.

 

Really appreaciate if anyone shares any light on this.

 

Thanks,

Klein

Message Edited by go_bear_2001 on 09-21-2009 06:06 PM