• craigvb5
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies

I have spent a few days trying to get the custom sort to work on Quote Line Items on multiple fields.   I googled and searched the forums and found lots of helpful code that got me started.   I created a global class for sorting and have a webservice function that correctly works.   I added the custom javascript button like the forum says and that works.  The problem with this is when the user clicks the sort button, it brings up a screen with the product names in the sorted order.  So if the user clicks save.  It all good.  But the user sees a screen with a list with only product names and not the other fields that are being sorted.  So I created a custom page which almost works.  It shows the sort fields in the list.  The arrows work but the save and cancel button are broken.   

Get this error: Unable to Access Page
You are missing information needed by the page you have attempted to access. If you believe this is an error, please refresh your screen. If the error persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information.

Not sure how to debug to find out what fields is missing and if this approach that I am doing will work.  ANY CLUES??
---------------------------------------------------------------------------------------------------------------------------------------------------------

<apex:page standardController="Quote">
 
<apex:variable var="QuoteName" value="{!Quote.Name}"/>
<apex:variable var="QuoteNumber" value="{!Quote.QuoteNumber}"/>
<apex:variable var="QuoteID" value="{!Quote.ID}"/>

<!-- <apex:pageBlock title="Sort Line Items for Quote {!Quote.Name}" mode="edit"> -->
<apex:pageBlock mode="edit">

<apex:sectionHeader title="Quote" subtitle="{!Quote.Name}"/>

<apex:outputText value="Custom Sort: Use the arrows to sort the products into the desired order."/>

<table cellpadding="0"  cellspacing="0" border='1'>

<form action="/oppitm/lineitemsort.jsp" id="editPage" method="post" name="editPage"
      onsubmit="javascript&colon;saveAllSelected([ document.editPage.duel_select_0 ], [ document.editPage.duel0 ], ',', '\\', '--None--');if (window.ffInAlert) { return false; }" >

<input type="hidden" name="id"     id="id"     value="{!QuoteID}" />
<input type="hidden" name="duel0"  id="duel0"  value="" />
<input type="hidden" name="retURL" id="retURL" value="/{!QuoteID}" />
<input type="hidden" name="save"   id="save"   value=" Save " />

<input type="hidden" name="_CONFIRMATIONTOKEN" id="_CONFIRMATIONTOKEN" value="yQN58ySIY4QOYgFqpKp7921vvbV7VYmaQ5EoYKczxj5dNazdime9nNepdEnPMDabtWtrxQDk38.EWXdTnHtzykYF0rEp4.1AyPH2wH4b2bLTFxF5eYqkkGO5karLiujBR4sYwu.vOvDCJVC.2wHWAmRr.0Y=" />
<input type="hidden" name="cancelURL"    id="cancelURL"    value="/{!QuoteID}" />
<input type="hidden" name="save_new_url" id="save_new_url" value="/oppitm/lineitemsort.jsp" />
    <tr>
        <td>
            <div class="duelingListBox" id="duel">
                <div class="errorMsg" id="editPage_duel_errorMsg" style="display:none">&nbsp;</div>          
                <table class="layout">
                    <tr>
                        <td class="selectCell">
                            <div class="selectTitle">
                                <label for="duel_select_0">Products</label>
                            </div>
                            <select id="duel_select_0" multiple="multiple" name="duel_select_0" size="25">
                                <apex:repeat var="lines" value="{!Quote.QuoteLineItems}">       
                                    <option value="{!lines.Id}">
                                       <!-- <apex:outputText value=" {2}  (Qty={0}   BeginDate={1,date, MM-dd-yyyy}) "> -->
                                       <apex:outputText value=" Qty={0, number, ###,###,###}   BeginDate={1,date, MM-dd-yyyy}   Prd={2}">
                                            <apex:param value="{!lines.Quantity}"/>
                                            <apex:param value="{!lines.BeginDate__c}"/>
                                            <apex:param value="{!lines.ProductName__c}"/>
                                        </apex:outputText>                                                                      
                                    </option>
                                </apex:repeat>
                            </select>
                        </td>
                        <td class="buttonCell">
                            <div class="text">Top</div>
                            <div class="text">
                                <ahref="javascript&colon;window.editPage_DLBEInstance.instMoveTop(document.editPage.duel_select_0,'editPage_duel_errorMsg');">
                                    <img src="/s.gif" alt="Top"  class="doubleArrowUp" title="Top"/>
                                </a>
                            </div>
                            <div class="text">Up</div>
                            <div class="text">
                                <a href="javascript&colon;window.editPage_DLBEInstance.instMoveUp(document.editPage.duel_select_0, null, null, null,'editPage_duel_errorMsg');" id="duel_select_0_up"><img src="/s.gif" alt="Up"  class="upArrowIcon" title="Up"/></a>
                            </div>
                            <div class="text">
                                <a href="javascript&colon;window.editPage_DLBEInstance.instMoveDown(document.editPage.duel_select_0, null, null, null,'editPage_duel_errorMsg');" id="duel_select_0_down"><img src="/s.gif" alt="Down"  class="downArrowIcon" title="Down"/></a>
                            </div>
                            <div class="text">Down</div>
                            <div class="text">
                                <a href="javascript&colon;window.editPage_DLBEInstance.instMoveBottom(document.editPage.duel_select_0,'editPage_duel_errorMsg');"><img src="/s.gif" alt="Bottom"  class="doubleArrowDwn" title="Bottom"/></a>
                            </div>
                            <div class="text">Bottom</div>
                        </td>
                    </tr>
                </table>
            
                <script  type="text/javascript">window.editPage_DLBEInstance=new DuelingListBoxesElement(['duel_select_0'],'editPage_duel_errorMsg');
                </script>
            </div>
        </td>
    </tr>
    <tr>
        <td align="center">
            <input value=" Save "  class="btn" name="save"   title="Save"   type="submit"/>&nbsp;&nbsp;&nbsp;
            <input value="Cancel"  class="btn" name="cancel" title="Cancel" type="submit"/>
        </td>
    </tr>
</form>
</table>
</apex:pageBlock>

</apex:page>

 

 

 

 

 

I'd like to re-open the discussion of SortOrder on the OpportunityLineItem object. A thread from 3.5 years ago can be located here:
http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=3154

Looks like people from SF were going to look into it but obviously nothing has come to fruition. The reason I have put this in the Visualforce board is that we have have a few VF applications that could really take advantage of access to this field. Visualforce has also opened up new possibilities to UI design where the ability to manage SortOrder could be useful.

Also, no offense to salesforce.com, but the tool for sorting OpportunityLineItems is not that useful when there are multiple products with the same name. I have actually built a pretty slick sorting application but this is currently useless.

A lot of the concerns were about error handling. What happens if you have 3 line items but sort order is defined as, 1, 2, 2. Or 1, 2, 4. How about just throwing a sortOrder exception and force the developers to write good code?

Ideas? Thoughts?
http://ideas.salesforce.com/article/show/10092062/OpportunityLineItem_SortOrder_to_be_CreatableUpdatable

-Jason


Message Edited by TehNrd on 09-05-2008 01:22 PM
  • September 03, 2008
  • Like
  • 1