• mmaxtra
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 16
    Replies

Hi:

   I have the following query:

 

SELECT Student__c, Name, MintoPass__c, Term,Subject FROM Courses Where Student__c='XXX'

 Which gives me table like this:

Subject AreaMinPassTerm 
Arts1.01 
Arts0.51 
English0.52 
Math0.51 
Science0.52 
Social Studies0.52 

 

I want to Group Arts together into one Line...

like 

Subjectarea MinPass Term

Arts                1.5        1

English             .5         1

 

Is there a way to break this table up into Terms???

I have place the query above into a List<Courses> student...

 

Thanks

 

 

 

 

Hi:

   I have an input Field and I wanted a help text next to it just like in regular saleforce. How would I do that???

LIke the little "i" blue icon.

 

Hi all:

I have an issue where I am getting a Subtotal on a product family but my code is hard coded with the product family.

Now if the admin adds another product family I would have to go back to the code and hard code that family...

 

Is there an easier way to do the following:

 

quote = [Select s.Opportunity__r.Pricebook2Id, Quote_Amount_rollup__c, LastmodifiedDate,Decimal__c, (Select Unit_Price__c, Unit_Net_Price__c, ServiceDate__c, Sales_Discount__c, Quote__c, Qty_Ordered__c, Product2__c, Product2__r.Name, Product2__r.Family,Name, Id, Ext_Price__c, Ext_Net_Price__c, Ext_Price_tmp__c, Description__c From Quote_Lines__r order by name ), (Select Title, Body, CreatedDate From Notes), s.Opportunity__r.HasOpportunityLineItem, s.Opportunity__r.Sub_Partner__c, s.Opportunity__r.Name, s.Name,s.Partner_Direct__c, s.Opportunity__r.Id, s.Opportunity__r.License__c,s.Opportunity__c,s.Valid_Until__c From SFDC_520_Quote__c s where s.id = :id limit 1]; quoteLineItems = quote.Quote_Lines__r; for ( SFDC_520_QuoteLine__c ql : quoteLineItems ) { if(ql.Product2__r.Family=='ABC'){ sumSub += ql.Ext_Net_Price__c; } if(ql.Product2__r.Family=='CDE'){ sumSub2 += ql.Ext_Net_Price__c; } }

 Thanks

Happy New Year

 

 

Hi I am overriden a new button using Apex Code and VF for redirect...

When the name in the contact is :

FirstName = Me & Marry

LastName = Yo

Total Name = Me & Marry Yo

 

My code works when it is Me Yo

My code ends when it is Me & Marry Yo?

 

redirectUrl = '/006/e?CF00N70000002RNNE='+c.name+'&nooverride=1';

 Any Suggestions I also tried:

 

redirectUrl = '/006/e?CF00N70000002RNNE='+c.firstname+'+'+c.lastname+'&nooverride=1';

 Did not work...

Thanks

 

 

 

Hi:

   Does anyone know how to write a testmethod for retURL and redirect...

See my code below:

 

public class newoppbutton { String retURL; String oppId; public newoppbutton(ApexPages.StandardController stdController){ } public PageReference init() { retURL= ApexPages.currentPage().getParameters().get('retURL'); oppId = retURL.substring(1); Contact c = [Select lastname,firstname from Contact where id =:oppId]; String redirectUrl = ''; String recordTypeId = System.currentPageReference().getParameters().get('RecordType'); if (recordTypeId != null) { redirectUrl = '/006/e?retURL=/006/o&RecordType=' + recordTypeId + '&nooverride=1'; } else { redirectUrl = '/006/e?CF00N70000002RNNE='+c.firstname+'+'+c.lastname+'&nooverride=1'; } PageReference newOpp = new PageReference(redirectUrl); return newOpp; } } }

 VF Code:

<apex:page standardController="Opportunity" extensions="newoppbutton" action="{!init}"> </apex:page>

 Thank you

 

 

 

Hi all:

Happy Holidays...

 

Basically something is wrong with my URL redirect that I keep getting the following error:

Attempt to de-reference a null object

 

 

public class newoppbutton { Contact contact{get;set;} public newoppbutton(ApexPages.StandardController stdController){ } public PageReference init() { String redirectUrl = ''; String recordTypeId = System.currentPageReference().getParameters().get('RecordType'); if (recordTypeId != null) { redirectUrl = '/006/e?retURL=/006/o&RecordType=' + recordTypeId + '&nooverride=1'; } else { // redirectUrl = '/006/e?nooverride=1'; redirectUrl = '/006/e?CF00N70000002RNNE='+contact.Name+'&nooverride=1'; } PageReference newOpp = new PageReference(redirectUrl); return newOpp; } } }

 Could someone tell me wz up with my code...or the correct URL to use for an user to go to a regular Opp page with the contact name filled in?

Thanks

 

 

I am getting the SOQL Query 21 Error and I really do not know what to do can someone please suggest what I should do....

I know the For loop has something to do with my query being in it, but if I take it out I do not know what to do or how to actual do this then...

 

I am getting my error :

 

for (opportunitylineitem oppline : opp.OpportunityLineItems) { i++; OpportunityLineItem sf = [SELECT Id, Product_Family__c FROM OpportunityLineItem where Id=:oppline.Id];

 This is my class...

 

 

 

public static void copyLineItemsFromOpp(List<SFDC_520_Quote__c> qs) { // We will modify and update the quotes with totals at the end, so we clone it // first since Trigger.new records cannot be modified in after triggers. Notice that // we use the deepClone method on the list as clone for sobjects creates a shallow // copy which is still read-only. List<SFDC_520_quote__c> quoteList = qs.deepClone(true); try { // By setting the inQuoteTrigger class variable, this method tells // the quoteLine trigger that it should disable itself during this // operation (the quoteLine trigger is described in Example 3) inQuoteTrigger = true; //Now the method creates an empty array of quote line items List<SFDC_520_QuoteLine__c> quoteItemList = new List<SFDC_520_QuoteLine__c>(); // Next get the opportunity line items for the respective Opportunities. // This demonstrates the aggregate relationship query pattern for getting // children correlated back to their parent. You could also query // OpportunityLineItem directly but would then have to correlate the items // back to their respective parents (opportunity) inside the code manually. // We are constructing a map so the respective opportunity // (with its line items) can be easily correlated back to quote as we process // them below. Map<Id, Opportunity> opportunityMap = new Map<Id, Opportunity>( [select Id,Partner__c, (Select Id, OpportunityId, SortOrder, PricebookEntryId, Quantity, TotalPrice, UnitPrice, ListPrice, ServiceDate, Description, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, IsDeleted , PricebookEntry.Name, PricebookEntry.Product2id,CurrencyIsoCode from opportunitylineitems order by createddate) from Opportunity where Id IN :getOpportunityIds(quoteList)]); // Iterate through the quotes in the bulk operation. for(SFDC_520_Quote__c quote:quoteList) { // Next, the method manually calculates the overall total for the quote // by iterating over an array of OpportunityLineItem records from the // preceeding SOQL query. The query selects the data from opportunity // line items that match the opportunity associated with the quote. Double tot = 0; // The running total Integer i = 0; // Number the line items // Get the respective opportunity and its line items from the map. Opportunity opp = opportunityMap.get(quote.opportunity__c); // If this quote is not associated to an opportunity then skip it. if(opp == null) continue; for (opportunitylineitem oppline : opp.OpportunityLineItems) { i++; OpportunityLineItem sf = [SELECT Id, Product_Family__c FROM OpportunityLineItem where Id=:oppline.Id]; // For each opportunity line item, the method // calculates the running total if (oppline.unitprice != null && oppline.quantity != null) tot += oppline.unitprice * oppline.quantity; // And then it adds a new quote line item to the quoteitems, // array, initializing it with values. Reseller__c[] r =[Select Name, License__c from Reseller__c where Name=:quote.Partner_Direct__c]; if(r.isEmpty()){ quoteItemList.add(new SFDC_520_quoteline__c( quote__c = quote.id, // The method uses the counter variable to number // the line items. Because the SOQL query ordered // them by the date they were created with an ORDER BY // clause, they will be numbered that way as well. //name = String.valueOf(i), // The method then uses the values for product, unit // price, quantity, total price, and color from the // opportunity line item. Sales_Discount__c = 0.0, Qty_Ordered__c = oppline.Quantity, Unit_Price__c = oppline.UnitPrice, Description__c = oppline.Description, ServiceDate__c = oppline.ServiceDate, Product2__c = oppline.PricebookEntry.Product2id, CurrencyIsoCode = oppline.CurrencyIsoCode ));} // The method uses the counter variable to number // the line items. Because the SOQL query ordered // them by the date they were created with an ORDER BY // clause, they will be numbered that way as well. //name = String.valueOf(i), // The method then uses the values for product, unit // price, quantity, total price, and color from the // opportunity line item. if(!r.isEmpty() && sf.Product_Family__c =='License'){ quoteItemList.add(new SFDC_520_quoteline__c( quote__c = quote.id, Sales_Discount__c = r[0].License__c, Qty_Ordered__c = oppline.Quantity, Unit_Price__c = oppline.UnitPrice, Description__c = oppline.Description, ServiceDate__c = oppline.ServiceDate, Product2__c = oppline.PricebookEntry.Product2id, CurrencyIsoCode = oppline.CurrencyIsoCode )); } if(!r.isEmpty() && sf.Product_Family__c <>'License'){ quoteItemList.add(new SFDC_520_quoteline__c( quote__c = quote.id, Sales_Discount__c = 0.0, Qty_Ordered__c = oppline.Quantity, Unit_Price__c = oppline.UnitPrice, Description__c = oppline.Description, ServiceDate__c = oppline.ServiceDate, Product2__c = oppline.PricebookEntry.Product2id, CurrencyIsoCode = oppline.CurrencyIsoCode )); } } } //The method adds the whole array of quote line items //to the database with a single insert statement. insert quoteItemList; update quoteList; } finally { // To clean up the working variable, the method resets inQuoteTrigger to false; inQuoteTrigger = false; } }

 

 

 

Hi:

   I have a dropdown which contains the record types. Now I would like to display fields off that record type based on what the user selected. Does anyone have an example of this? 

Thanks

MMA

I have a custom object called "Overrides".  I've been developing a VisualForce page and custom controller that would allow users to data enter as many rows that they want of Overrides objects, at one time -- basically set them all up before clicking "Save".  On save each Overrides object row is saved.  This all works just as I want.

Now I need to add RecordTypes into the mix.  Ideally I want to have a dropdown at the top of the page where they will choose the record type of all of the Overrides objects they are creating for this particular "Save" operation.  I'm new to Apex and am having a hard time figuring this out.

Can someone show some sample code how to:

1) setup the controller to populate the RecordType dropdown box
2) set the dropdown box RecordType selection to each Overrides object when saving

Here is my controller:

Code:
public class multiOverrideInsertController{ 
      
    public List<Override__c> over{get; set;}   
    
    public multiOverrideInsertController(){        
        over= new List<Override__c>();        
        over.add(new Override__c());    
    }        

    public void addrow(){        
        over.add(new Override__c());    
    }     
    
    public void removerow(){  
        Integer i = over.size();      
        over.remove(i-1);    
    }        

    public PageReference save(){       
        insert over;        
        PageReference home = new PageReference('/a00/o');        
        home.setRedirect(true);        
        return home;    
    }
}

Here's my VisualForce page:

Code:
<apex:page controller="multiOverrideInsertController">    
    <apex:form >        
    <apex:pageBlock title="Insert Multiple Overrides">                    
        <apex:pageBlockButtons >                
            <apex:commandButton value="Save" action="{!save}" rerender="error,table"/>            
        </apex:pageBlockButtons>                    
        <apex:pageMessages ></apex:pageMessages>
    <apex:pageBlockTable value="{!over}" var="a" id="table">      
        <apex:column headerValue="Opportunity">                    
            <apex:inputField value="{!a.Opportunity__c}" required="true" />                         
        </apex:column>     
        <apex:column headerValue="Institution">                    
            <apex:inputField value="{!a.Institution__c}" required="true" />                         
        </apex:column> 
        <apex:column headerValue="Advisor (Rep)">                    
            <apex:inputField value="{!a.Advisor_Rep__c}" required="true" />                         
        </apex:column>                              
        <apex:column headerValue="Override Date">                      
            <apex:inputField value="{!a.Override_Date__c}" required="true" />                          
        </apex:column>
        <apex:column headerValue="Override Amount">                    
            <apex:inputField value="{!a.Override_Amount__c}" required="true" />                           
        </apex:column>                                          
     </apex:pageBlockTable>   
     <apex:pageblockButtons location="bottom">   
         <div style="text-align:right;margin-right:30px;font-weight:bold;">             
            <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error" immediate="true" /> &nbsp;|&nbsp;&nbsp;  
            <apex:commandLink id="RemoveRow" value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" />
         </div>      
     </apex:pageblockButtons>                      
    </apex:pageBlock>    
    </apex:form>
</apex:page>




Hello everyone, just wanted to share with the community this custom component I made and give something back for the help I've received. :smileyhappy:

The purpose of the component is to enable autocomplete in lookup fields. I used the autocomplete js created by Jim Roos:
(http://www.jimroos.com/2007/05/ajax-autocomplete.html) but made some modifications to it so that it could interact with an Apex controller among some other things...

So my idea was that if you were making a VF page that had an inputfield that was related to a lookupfield you would just insert this autocomplete component to that inputfield. Something like this:

Code:
           <apex:inputField value="{!Contact.accountid}" id="accname" styleClass="cField">
<c:autocomplete ObjectName="Accounts" InputId="{!$Component.accname}" AutoCompleteId="accACid" ClassName="autocomplete300"/>
</apex:inputField>

The component has 4 parameters:

The name of the object or custom object that the inputfield relates to (new objects must be added inside the apex classes since i had some problems constructing a dynamic query).
The InputId which is used to relate the component to the input field
The id for the Component
A classname parameter that basically just defines the width of the suggestions menu.

Here's a screenshot of how it looks like in action:




Here's a link to the file containing the required files:

AutoCompleteComponent



Jonathan.


Message Edited by jonathan rico on 08-16-2008 01:55 PM

Message Edited by jonathan rico on 08-17-2008 09:04 AM
Message Edited by jonathan rico on 01-02-2010 05:01 PM