• MrHammy
  • NEWBIE
  • 20 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 8
    Replies
Working on a test class and am missing something basic, error is System.NullPointerException: Attempt to de-reference a null object  and the stack trace is Class.programclone.<init>: line 39, column 1
Class.testclonedppage.test_method_one: line 52, column 1

VF page 
 
<apex:page Controller="programclone" >
 


     <apex:form id="frm1" >
     

     
        <apex:pageblock >
        
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            
            
                    <apex:pageBlockTable value="{!Records}" var="Record"> 
            <apex:column > 
                <apex:facet name="header">Account Name</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.name}"/> 
            </apex:column> 
            
                        <apex:column > 
                <apex:facet name="header">EWS Territory</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.Territory_EWS__c}"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">City</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.billingcity}"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">State</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.billingState}"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">Key Contact</apex:facet> 
                <apex:outputText value="{!Record.DIST_EXEC_SPONSOR__r.firstname}"/> 
            </apex:column> 

            <apex:column > 
                <apex:facet name="header">Email</apex:facet> 
                <apex:outputText value="{!Record.DIST_E_S_Email__c}"/> 
            </apex:column>             
            <apex:column > 
                <apex:facet name="header">Program Type </apex:facet> 
                <apex:outputText value="{!Record.RecordType.name }"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">Status</apex:facet> 
                <apex:outputText value="{!Record.Program_Status__c }"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">100%</apex:facet> 
                <apex:Outputtext value="{!Record.CS_100PercentCommitted__c }"/> 
            </apex:column> 
           
           
           
             <apex:column > 
                <apex:facet name="header">YTD Sales</apex:facet> 
              <apex:Outputtext value="{!Record.CS_YTD_Sales__c}"/> 
            </apex:column>  
            
            <apex:column > 
                <apex:facet name="header">Run Rate</apex:facet> 
               <apex:Outputtext value="{!Record.CS_Run_Rate__c}"/> 
            </apex:column>  
                         
            <apex:column > 
                <apex:facet name="header">Projected Payout</apex:facet> 
               <apex:Outputtext value="{!Record.CS_Projected_Payout__c}"/> 
            </apex:column>  
            
            
            <apex:column > 
                <apex:facet name="header">Clone</apex:facet> 
                <apex:inputField value="{!Record.Clone_no_send__c}"/> 
            </apex:column> 
            
            
                        <apex:column > 
                <apex:facet name="header">Send now</apex:facet> 
                <apex:inputField value="{!Record.Clone_Send_now__c }"/> 
            </apex:column> 
            
        </apex:pageBlockTable> 
            
            
            
        </apex:pageblock>
    </apex:form>
 
 
</apex:page>

and controller
public class programclone {

    public programclone() {
    
     String myterr = [Select Sales_Territory__c From User Where Id = :UserInfo.getUserId()][0].Sales_Territory__c ;
    System.debug(cloneyear );
        Records =[select Account_Name__r.name,
                         Account_Name__r.billingcity, 
                         Account_Name__r.billingstate, 
                         Account_Name__r.Territory_EWS__c,
                         DIST_EXEC_SPONSOR__r.name,
                         DIST_EXEC_SPONSOR__r.firstname,
                         DIST_E_S_Email__c,
                         Account_Number__c, 
                         Program_Status__c, 
                         RecordTypeid, 
                         Program_Year__c,
                         recordtype.name,
                         CS_YTD_Sales__c,
                         CS_Run_Rate__c,
                         CS_Projected_Payout__c,
                         CS_100PercentCommitted__c,  
                         Clone_Send_now__c , 
                         Clone_no_send__c 
                         from Distributor_Program__c 
                         Where Program_Status__c='active' 
                         and ( CreatedByid = :UserInfo.getUserid()  or   Account_Name__r.Territory_EWS__c = :myterr ) 
                         and Program_Year__c = :cloneyear 
                         and   Clone_no_send__c  != true 
                         and   Clone_Send_now__c != true 
                         order by Account_Name__r.name limit 200]; 


    }


        cloan_program_year__c settings = cloan_program_year__c.getInstance('cloneyear');
   
        string cloneyear =string.valueof(settings.Year__c);

       
   

public List<Distributor_Program__c> Records {get; set;} 


 

    public PageReference cancel() {
             return new PageReference('/home/home.jsp');
    }


    public PageReference Save() {
       update records;
        return new PageReference('/apex/nextstep');

    }



    }

And the test class 
 
@isTest
private class testclonedppage {

private static final Id acctrtid = Schema.SObjectType.account.getRecordTypeInfosByName().get('Distributor').getRecordTypeId();
private static final Id dpid = Schema.SObjectType.Distributor_Program__c.getRecordTypeInfosByName().get('PS Cornerstone').getRecordTypeId();

	@isTest static void test_method_one() {
		 
   

	Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
	User u = new User(Alias = 'standt', Email='standarduser@testorg.com', 
	EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
	LocaleSidKey='en_US', ProfileId = p.Id, 
	TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@hammybuiltthis.com',
	Sales_Territory__c = '1');

  	cloan_program_year__C cs = new cloan_program_year__c(name = 'cloneyear' , year__c = '2016', year1__c = '2017' );

  	Account acc = new Account();
  	acc.Name='Abce';
	acc.Type='Distributor';
	acc.recordtypeid = acctrtid;
	acc.Territory_EWS__c = '1';
  	
  	insert acc;

  	Contact c = new Contact();
  	c.Firstname = 'first';
  	c.Lastname = 'last';
  	c.Email = 'email@email.com';
  	c.Accountid = acc.id;


  	insert c;

	System.runAs(u) {

		Distributor_Program__c  dp = new Distributor_Program__c();
		dp.RecordTypeId = dpid;
		dp.Account_Number__c = '1';
		dp.Program_Year__c = cs.year__c;
		dp.Account_Name__c = acc.id;
		dp.DIST_EXEC_SPONSOR__c = c.id;
		insert dp;
		
System.debug('Current Contact name: ' + c.firstname);
System.debug('Current User: ' + UserInfo.getUserName());
System.debug('Current Profile: ' + UserInfo.getProfileId());
		
		Test.setCurrentPage(Page.programclone);
		programclone controller = new programclone();
	
		controller.save();


		

		}

	}
	

	
}

 
I am replacing a formula that has grown too large with a Visualforce page and an extension to do the work.  When passing the fully composed  apex:outputLink back as a string  is displays as just that a string. How should I be passing this back? I have stripped out all the logic so it is just building the first of about 20 different links that i need to build, once one is working the others will be easy 

VF page:
<apex:page standardController="SFDC_520_Quote__c" showHeader="false" sidebar="false" extensions="makelink">

 
 {!mylink}  
 


</apex:page>
Extention
 
public class makelink {

 private final SFDC_520_Quote__c q;

    public makelink(ApexPages.StandardController stdController) {
        this.q = (SFDC_520_Quote__c)stdController.getRecord();
    }

public string getmylink(){
string l;

l = '<apex:outputLink target="_blank" value="https://inside.legrandna.com/mainpage/Sales/tws_quote_program/find_quote.cfm?quote=' + q.Quote_ID__c + '&oppid=' + q.Opportunity__c + '&quoteid=' + q.id + '">WS Quote</apex:outputLink>';

return l ;
}
 

}

 
Hi!

I am setting up a class, called via a trigger, to set an email address. I need to go from my custom object Product_Assessment__c to its parent case and then on to the contact, retrieve the email and populate it. I have the class working but it is not bulkified, my loop as 2 SOQL query's in it and  as we all know that's just BAD! I know I need to build up a map to return the correct  email address but am struggling a bit. can someone lend a hand? 
​Thanks for your time!


 
public with sharing class Product_Assessment_set_contact_email {
	
	// These variables store Trigger.oldMap and Trigger.newMap
  Map<Id, Product_Assessment__c> oldpas;
  Map<Id, Product_Assessment__c> newpas;	
	
// This is the constructor
// A map of the old and new records is expected as inputs
  public Product_Assessment_set_contact_email(
    Map<Id, Product_Assessment__c> oldTriggerpas, 
    Map<Id, Product_Assessment__c> newTriggerpas) {
      oldpas = oldTriggerpas;
      newpas = newTriggerpas;
  }
  
  
  public void set_email(){
  

  	for (Product_Assessment__c p : newpas.values())      
       {
       	
       	case con = [SELECT ContactId FROM Case WHERE Id = :p.case__c ];
       	
       	contact em = [select email from contact where id = :con.ContactId];
       	
       	p.email_of_contact__c = em.email;

       }
  }
  

}

 
I want to build a view of a chatter group to put inside a VF page, I feel i am missing something fundamental, I just can see what

I can get the elements 
global ConnectApi.FeedElementPage getFeedItems() {
 
        System.Debug('>>>>>>group id ' + groupId ) ;
        System.Debug('>>>>>>community id ' +  communityId) ;
        ConnectApi.FeedElementPage items = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(communityId , ConnectApi.FeedType.Record , groupId);
        return items;
    }

and then call it on a visualforce page
 
<apex:repeat value="{!feedItems}" var="x">
          <div>
                     
            <apex:outputPanel >
            
            {!x.currentPageUrl}
             
            </apex:outputPanel>
          </div>
        </apex:repeat>

But all i show is   /services/data/v32.0/connect/communities/0DBC0000000CdsLOAS/chatter/feeds/record/0F9M00000009NEfKAM/feed-elements. If i just show  !x i get all the elements

 
I am trying to replace a chatter feed I use in a VF page, in the past I used 
 
return ConnectApi.ChatterFeeds.getFeedItemsFromFeed(communityId, ConnectApi.FeedType.Record, groupId).items

But that has gone away in api 31 (it also just broke on its own somehow) and I want to use the most up-to-date way of getting the data. I am getting  the error   Line: 6, Column: 90 unexpected token: ','  when I try and run this in execute anonymous,
 
private static List<Community> customCommunity = [Select NetworkId, Name From Community where name = 'Sales Community'];
    private static String communityId = customCommunity[0].NetworkId;
    private static List<CollaborationGroup> CollaborationGroup = [SELECT Id FROM CollaborationGroup where name = 'Agency Forum'];
  	private static String groupId = CollaborationGroup[0].Id;

	public static ConnectApi.FeedElementPage ConnectApi.getFeedElementsFromFeed( communityId , ConnectApi.FeedType.Record , groupId);

I can find no real world examples of how to do this
Hi,

I am trying to Sort Quick Text in the Live Agent console. All the quick texts are showing up in the order they were created, making it hard for an agent to find the one they are looking for. Sorting them alpha is the request from the team using this tool but even a manual method wold help 

Thanks!
in the code below the dp.CS_LocationsCSV__c is comma selerated string of account numbers  ie  123,145,16,143  and i need to use them in the soql querey  SELECT Account__r.id ,source_key__c  FROM ERP_Data__c where source_key__c = :csv   this works fine with one account number but i may have up to 50, how can i get them into a useable set for the querey?

trigger CS_links on Distributor_Program__c (after update) {

   if(checkRecursive.runOnce())
    {

// get a list of all Distributor_Program__c to evaluate

Set<String> csv = new Set<String>();
Set<Id> changedcsv = new Set<Id>();

for (Distributor_Program__c  dp :trigger.new){

    String oldcsv = Trigger.oldMap.get(dp.Id).CS_LocationsCSV__c;
    String newcsv = dp.CS_LocationsCSV__c;

    if (oldcsv != newcsv){
    changedcsv.add(dp.id);
    csv.add(dp.CS_LocationsCSV__c);
    }

}
// delete all exsiting Participating_Branch_Locations__c if CS_LocationsCSV__c has changed

list <Participating_Branch_Locations__c> pb = [select id from Participating_Branch_Locations__c where Distributor_Program__c in :changedcsv];
delete pb;

// find the accounts to link to the Distributor_Program__c where the CS_LocationsCSV__c has changed

map<string , account> accids = new map<string , account> ();

list<ERP_Data__c> erps = [SELECT Account__r.id ,source_key__c  FROM ERP_Data__c where source_key__c = :csv];  // todo use the csv string 

for (ERP_Data__c erp :erps){
    accids.put(erp.source_key__c  , erp.Account__r );
     }

//create the Participating_Branch_Locations__c and link to the account and Distributor_Program__c 


list<Participating_Branch_Locations__c> npb = new list<Participating_Branch_Locations__c> ();
        for (Distributor_Program__c  dp :trigger.new){

        account a = accids.get(dp.CS_LocationsCSV__c);
            if (a != null){
            
           
                for (erp_data__c acc : erps) {
                Participating_Branch_Locations__c apbl = new Participating_Branch_Locations__c();
                apbl.Account__c = a.id;
                apbl.Distributor_Program__c = dp.id;
                apbl.key_id__c = a.id + '' +  dp.id ;
                npb.add(apbl);
                }

            }
        }
        insert npb;
        }
}


workign with someone elses code, we ran into a bulk DML issue, I set up a list to hold the updates untill after the for loop but now I am geting

System.NullPointerException: Attempt to de-reference a null object

I feel it is something to do with the loop but am not sure what, any help would be appreciated ,

here is the class:



public class CustomerSalesOrgManager {

public static void UpdateCustomerSalesOrg (   MDMCustomer.UpdateRequest customer)    {
   

    // first, get the ERP_Data__c records which are linked to this MDS Code
   
    try {               
    List<ERP_Data__c> erpData = [select MDS_Salesperson_Code__c,
         Name,  
         MDS_Salesperson_Name__c,
         MDS_Territory_Code__c,
         MDS_Territory_Name__c,
         MDS_Region_Code__c,
         MDS_Region_Name__c,
         MDS_District_Code__c,
         MDS_District_Name__c,
         RecordTypeId,
         BU_SOURCE_SYSTEM__c  
        from ERP_Data__c
        where MDS_Code__c =: customer.code for update];
       
            // build a list to update at the very end to prevent limit issues dgh 2/13/2014
        List<ERP_Data__c> updatedList = new List<ERP_Data__c>();
              
        for(ERP_Data__c record:erpData) {
            System.debug(record.Name + 'found');
                   
            // for every record linked this way, update the sales org fields based upon record type
            if ((record.BU_SOURCE_SYSTEM__c.contains('LC'))) {
                // update as LCI Customer
                    if (customer.LCITerritory != null)
                    {              
                     record.MDS_Territory_Code__c = customer.LCITerritory.Code;
                     record.MDS_Territory_Name__c = customer.LCITerritory.Name;                    
                    }
                    if (customer.LCIRegion != null)
                    {                  
                     record.MDS_Region_Code__c = customer.LCIRegion.Code;                    
                     record.MDS_Region_Name__c = customer.LCIRegion.Name;                    
                    }                    
            }        
            else if ((record.RecordTypeId=='0128000000020mT') || (record.RecordTypeId=='0128000000020mO') || (record.RecordTypeId=='0128000000020mV'))
            {
                 // update as EWS customer
                if (customer.EWSSalesperson != null) {                
                     record.MDS_Salesperson_Code__c = customer.EWSSalesperson.Code;
                     record.MDS_Salesperson_Name__c = customer.EWSSalesperson.Name;           
                }
                if (customer.EWSTerritory != null) {                
                     record.MDS_Territory_Code__c = customer.EWSTerritory.Code;
                     record.MDS_Territory_Name__c = customer.EWSTerritory.Name;
                }
                if (customer.EWSRegion != null) {
                     record.MDS_Region_Code__c = customer.EWSRegion.Code;
                     record.MDS_Region_Name__c = customer.EWSRegion.Name;                                 
                }                
            }
            else if (record.RecordTypeId=='0128000000020mJ') {
                // update as Wattstopper customer
                if (customer.WSSalesRep != null) {              
                    record.MDS_Salesperson_Code__c = customer.WSSalesRep.Code;
                    record.MDS_Salesperson_Name__c = customer.WSSalesRep.Name;           
                }
                if (customer.WSDistrict != null) {               
                    record.MDS_District_Code__c = customer.WSDistrict.Code;
                    record.MDS_District_Name__c = customer.WSDistrict.Name;
                }
                if (customer.WSRegion != null) {               
                    record.MDS_Region_Code__c = customer.WSRegion.Code;
                    record.MDS_Region_Name__c = customer.WSRegion.Name;                              
                }               
            }
            else if ((record.RecordTypeId=='0128000000026Bx') || (record.RecordTypeId=='0128000000026C7') || (record.RecordTypeId=='012C0000000G9MU')) {
                //update as Home Systems customer
               
                
            }
            else if (record.RecordTypeId=='0128000000020mU') {
                // update as Ortronics customer
                if (customer.ORRepAgency != null) {               
                    record.MDS_Salesperson_Code__c = customer.ORRepAgency.Code;
                    record.MDS_Salesperson_Name__c = customer.ORRepAgency.Name;
                }
                if (customer.ORRegion != null) {               
                    record.MDS_Region_Code__c = customer.ORRegion.Code;
                    record.MDS_Region_Name__c = customer.ORRegion.Name;                     
                }
            }    
                    
            updatedList.add(record);
        }
         update updatedList;  
    }
   
   
    catch (System.QueryException qex){
        // no erp records tied to this MDS Code
        } 
}

}

My class is now working and doing everything I want with the exception of large result sets.  My public PageReference Save is a for loop and calls another class that is making way to many  DML calls. Its the end of the day and I thought I would ask if anyone can point me at a way to bulkify this a little bit, I know what's wrong I just can't find the fix yet.

 

Thanks for all the help

 

public class MultiRow {
        public List<multiRowContact> Contacts { get; set; }
        String chainname, prog, filter;
        String idx = ApexPages.currentPage().getParameters().get('idx') ;
    
        public PageReference 
        cancel() {
        return new PageReference('/'+idx);
        }
 
    public MultiRow() {
        chainname = ApexPages.currentPage().getParameters().get('name') ;
        prog = ApexPages.currentPage().getParameters().get('pg') ;
        if(prog == 'WM Synergy'){
        filter = '0128000000020mOAAQ'; //WM Synergy
        } else if (prog == 'PS Cornerstone') {
        filter = '0128000000020mTAAQ'; //PS Cornerstone
          } else if (prog == 'CB Ascend') {
        filter = '0128000000020mVAAQ'; //CB Ascend
        } else {
        filter = ''; 
        }
        LoadData();        
    }
     


    private void LoadData() { 
        Contacts = new List<multiRowContact>();
        for (List<erp_data__c> cs : [SELECT name, Account__c ,Acct_RT_Name__c, Chain__c,Id, Program__c, RecordTypeId , updatetowhat__c 
               FROM ERP_Data__c  
               WHERE Chain__c = :chainname and RecordTypeId = :filter limit 25]) {
               
                for (erp_data__c c : cs) {
                    multiRowContact MRC = new multiRowContact();
                    MRC.ID = c.ID;
                    MRC.Checked = true;
                    MRC.Name = c.Name;
                    MRC.Program = c.Program__c;
                    MRC.account = c.Account__c ;
                    MRC.updatetowhat = prog;
                    Contacts.add(MRC);
            }
        }
    }
    public PageReference Save() {
        for (multiRowContact MRC : Contacts) {
        MRC.Save();
        }
        //LoadData();
        return new PageReference('/'+idx);
    } 

    private class multiRowContact {
    String prog = ApexPages.currentPage().getParameters().get('pg') ;
    String idx = ApexPages.currentPage().getParameters().get('idx') ;
        public String ID { get; set; }
        public String Name { get; set; }
        public String Account { get; set; }
        public String updatetowhat{ get; set; }
        public String Program { get; set; }
        public Boolean Checked { get; set; }
        List<Participating_Branch_Locations__c > updatedList = new List<Participating_Branch_Locations__c >();
        List<erp_data__c > updatedList_erp = new List<erp_data__c >();
       
        public void Save() {
           

            if (Checked) {
            
            //select account__c  from Participating_Branch_Locations__c where Distributor_Program__c = idx
            
            list <Participating_Branch_Locations__c > ids = [select account__c  from Participating_Branch_Locations__c where Distributor_Program__c = :idx];
            
                if( 1 == 2){
            
                } else {
            
                    System.debug('Saving...ID: ' + ID);
                    erp_data__c c = [SELECT c.updatetowhat__c FROM erp_data__c c WHERE c.ID = :ID LIMIT 1];
                    c.updatetowhat__c = prog;
                    updatedList_erp.add(c);
                    
                    Participating_Branch_Locations__c newpbl = new Participating_Branch_Locations__c (Account__c = Account ,Distributor_Program__c = idx);
                   
                    updatedList.add(newpbl);
            
            
            
                }
            
            
            
            }
            insert updatedList;
            update updatedList_erp;

        }

    }

}

 

 

 

still learning and getting better but why is the if statment  not working in this controller? ( know that data is the same, just need it to work at all . i get Error: MultiRow Compile Error: expecting right curly bracket, found 'if' at line 16 column 2

 

public class MultiRow {
    public List<multiRowContact> Contacts { get; set; }
 
         String chainname = ApexPages.currentPage().getParameters().get('name') ;
         String prog = ApexPages.currentPage().getParameters().get('pg') ;
      
      


    public MultiRow() {
        LoadData();        
    }
     


  if(prog == 'WM Synergy'){
  string   filter = '0128000000020mOAAQ'; //'WM Synergy
  } else {
  string   filter = '0128000000020mOAAQ'; //'WM Synergy
  } 
 
    public PageReference Save() {
        for (multiRowContact MRC : Contacts) {
            MRC.Save();
        }
        LoadData();
        return null;
    }
    private void LoadData() {
    

  
        Contacts = new List<multiRowContact>();
        for (List<erp_data__c> cs : [SELECT name, Account__c ,Acct_RT_Name__c, Chain__c,Id, Program__c, RecordTypeId ,updatechain__c , updatetowhat__c 
               FROM ERP_Data__c  
               WHERE Chain__c = :chainname and RecordTypeId = :filter limit 125]) {
               
                for (erp_data__c c : cs) {
                    multiRowContact MRC = new multiRowContact();
                    MRC.ID = c.ID;
                    MRC.Checked = true;
                    MRC.Name = c.Name;
                    MRC.Program = c.Program__c;
                    MRC.account = c.Account__c ;
                    MRC.updatetowhat = c.updatetowhat__c;
                    Contacts.add(MRC);
            }
        }
    }
 
    private class multiRowContact {
    String prog = ApexPages.currentPage().getParameters().get('pg') ;
    String idx = ApexPages.currentPage().getParameters().get('idx') ;
        public String ID { get; set; }
        public String Name { get; set; }
        public String Account { get; set; }
        public String updatetowhat{ get; set; }
        public String Program { get; set; }
        public Boolean Checked { get; set; }
        public void Save() {
            if (Checked) {
                System.debug('Saving...ID: ' + ID);
                erp_data__c c = [SELECT c.updatetowhat__c FROM erp_data__c c WHERE c.ID = :ID LIMIT 1];
                c.updatetowhat__c = prog;
                update c;
                
                Participating_Branch_Locations__c newpbl = new Participating_Branch_Locations__c (Account__c = Account ,Distributor_Program__c = idx);
                try {
                   insert newpbl;
                } catch (DmlException e) {
                // Process exception here
                }
            }
        }
    }
}

 

it sounds so simple, get a list of similar items and allow the user to edit one field, then click save and return to where you came from. I just do not understand enough to make this happen, can some one take a look? When i hit save i get the page back but no updates have happened 

 

VF page 

 

<apex:page standardController="ERP_Data__c" extensions="opportunityList2Con">

    <apex:form >
        <apex:pageBlock title="{!erp.Chain__c}" >
            <apex:pageMessages />
            <apex:pageBlockButtons >
              <apex:commandButton value="Save" action="{!mysave}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!Opportunities}" var="o" >
                
                <apex:column value="{!o.Account__c}"/>
                
                <apex:column value="{!o.id}"/>
                
                <apex:column value="{!o.Acct_RT_Name__c}"/>
              
                <apex:column headerValue="Program">
                
                    <apex:inputField value="{!o.Program__c}"/>
                    
                </apex:column>
                
            </apex:pageBlockTable>      
        </apex:pageBlock>
    </apex:form>
    
</apex:page>

 and the controler

 

public class opportunityList2Con {
public opportunityList2Con(ApexPages.StandardController controller) {}

erp_data__c erp;
public erp_data__c geterp() {
if (erp == null){                      
erp = [SELECT Chain__c FROM ERP_Data__c WHERE 
    id = :ApexPages.currentPage().getParameters().get('id')];
      }
   return erp;

}

String myTestString = ApexPages.currentPage().getParameters().get('name') ;

// ApexPages.StandardSetController must be instantiated
// for standard list controllers
public ApexPages.StandardSetController seterp {
     get {
        if(seterp == null) {
           return new ApexPages.StandardSetController(
                     Database.getQueryLocator(
                [SELECT name, Account__c ,Acct_RT_Name__c, Chain__c, 
                        Id, Program__c, RecordTypeId    
                 FROM ERP_Data__c  
                 WHERE Chain__c = :myTestString limit 25 ]));
        }
        return seterp;
    }
   set;
 }
 
 
 
 
// Initialize seterp and return a list of records
public list<ERP_Data__c> getOpportunities()  
{
return (list<ERP_Data__c>) seterp.getRecords();
}
public PageReference mysave(){

    seterp.save();  //call the save method on your set controller
    //controller.save();  add this if you want to save your original ERP_Data__c record         
    //as well
    
    
return null;

}
}

 Most of this code I have picked up and modified from other people projects so my understanding  on why some things are here is low. Once i get it working i will spend the time to clean up the naming spacing and comments , thanks in advance!

I have my first trigger up and runing but i do not understand where to start for bulkifacaton. It works fine on up to 9 updates and crashes after that. I am used to php and mysql. if someone could look at my code and point me in the right direction it would be great! here is my code:

 

trigger setProject_Territory_Link on LNA_Project__c (after update){

    List<Project_Territory_Link__c> newptl = new List<Project_Territory_Link__c>();
  
    for (LNA_Project__c p : Trigger.new) { 
        

        List<Project_Territory_Link__c> ter_link_all = [SELECT id FROM Project_Territory_Link__c WHERE name = :p.Id ];
        
        List<Project_Territory_Link__c> ter_link_used = new List<Project_Territory_Link__c>();
        

                if (p.Territory_VN__c != null){
                
                    sobject vn_ter = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_VN__c limit 1 ];

                    if (vn_ter.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :vn_ter.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = vn_ter.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                
                
                    if (p.Territory_CDC__c != null){
                
                    sobject cdc_ter = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_CDC__c limit 1 ];

                    if (cdc_ter.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :cdc_ter.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = cdc_ter.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                
                if (p.Territory_EWS__c != null){
                
                    sobject ews_ter = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_EWS__c limit 1 ];

                    if (ews_ter.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :ews_ter.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = ews_ter.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                if (p.Territory_WS__c != null){
                
                    sobject ws_ter = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_WS__c limit 1 ];

                    if (ws_ter.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :ws_ter.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = ws_ter.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                
                if (p.Territory_WM_C__c != null){
                
                    sobject WM_C_link = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_WM_C__c limit 1 ];

                    if (WM_C_link.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :WM_C_link.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = WM_C_link.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                
                if (p.Territory_PS_C__c != null){
                
                    sobject PS_C_link = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_PS_C__c limit 1 ];

                    if (PS_C_link.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :PS_C_link.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = PS_C_link.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                
                if (p.Territory_CF_C__c != null){
                
                    sobject CF_C_link = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_CF_C__c limit 1 ];

                    if (CF_C_link.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :CF_C_link.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = CF_C_link.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                
                if (p.Territory_OQ__c != null){
                
                    sobject OQ_link = [Select Id , Name  From LNA_Territory__c  WHERE Name = :p.Territory_OQ__c limit 1 ];

                    if (OQ_link.id != null){
                        
                        try{
                        sobject ter_link = [Select Id From Project_Territory_Link__c where LNA_Territory__c = :OQ_link.id and LNA_Project__c = :p.Id limit 1 ];
                        
                        } catch(System.QueryException e){
                
                            Project_Territory_Link__c ptl = new Project_Territory_Link__c
                            (LNA_Project__c = p.ID, LNA_Territory__c = OQ_link.id );
                            newptl.add(ptl);
                        } 
                    }
                }
                
                
                
                   
                
                
           
    }
    insert newptl;
    

 

 

I am replacing a formula that has grown too large with a Visualforce page and an extension to do the work.  When passing the fully composed  apex:outputLink back as a string  is displays as just that a string. How should I be passing this back? I have stripped out all the logic so it is just building the first of about 20 different links that i need to build, once one is working the others will be easy 

VF page:
<apex:page standardController="SFDC_520_Quote__c" showHeader="false" sidebar="false" extensions="makelink">

 
 {!mylink}  
 


</apex:page>
Extention
 
public class makelink {

 private final SFDC_520_Quote__c q;

    public makelink(ApexPages.StandardController stdController) {
        this.q = (SFDC_520_Quote__c)stdController.getRecord();
    }

public string getmylink(){
string l;

l = '<apex:outputLink target="_blank" value="https://inside.legrandna.com/mainpage/Sales/tws_quote_program/find_quote.cfm?quote=' + q.Quote_ID__c + '&oppid=' + q.Opportunity__c + '&quoteid=' + q.id + '">WS Quote</apex:outputLink>';

return l ;
}
 

}

 
If we have "Unanimous approval required" on a process that x, y, & z need to approve it. Is there a way so that when each one of them individually does there part and approves it. That a email alert will go out to the case/record owner? So the case owner should get bascially get 3 emails(1 each time an approver approved the request).
User-added image
These are the fields where i am trying to access it from native dataloader import wizard.
All the fields have its Field level security set for Admin Profile.I have 7 fields among which only 2 are automatically mapped other are not visible

I haven't created a tab for the custom object, will it be a issue.

User-added image
This is the CSV format.

User-added image


 I am not able to fetch remaining fields in Wizard.

 Thanks in Advance.



 
I want to build a view of a chatter group to put inside a VF page, I feel i am missing something fundamental, I just can see what

I can get the elements 
global ConnectApi.FeedElementPage getFeedItems() {
 
        System.Debug('>>>>>>group id ' + groupId ) ;
        System.Debug('>>>>>>community id ' +  communityId) ;
        ConnectApi.FeedElementPage items = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(communityId , ConnectApi.FeedType.Record , groupId);
        return items;
    }

and then call it on a visualforce page
 
<apex:repeat value="{!feedItems}" var="x">
          <div>
                     
            <apex:outputPanel >
            
            {!x.currentPageUrl}
             
            </apex:outputPanel>
          </div>
        </apex:repeat>

But all i show is   /services/data/v32.0/connect/communities/0DBC0000000CdsLOAS/chatter/feeds/record/0F9M00000009NEfKAM/feed-elements. If i just show  !x i get all the elements

 

My class is now working and doing everything I want with the exception of large result sets.  My public PageReference Save is a for loop and calls another class that is making way to many  DML calls. Its the end of the day and I thought I would ask if anyone can point me at a way to bulkify this a little bit, I know what's wrong I just can't find the fix yet.

 

Thanks for all the help

 

public class MultiRow {
        public List<multiRowContact> Contacts { get; set; }
        String chainname, prog, filter;
        String idx = ApexPages.currentPage().getParameters().get('idx') ;
    
        public PageReference 
        cancel() {
        return new PageReference('/'+idx);
        }
 
    public MultiRow() {
        chainname = ApexPages.currentPage().getParameters().get('name') ;
        prog = ApexPages.currentPage().getParameters().get('pg') ;
        if(prog == 'WM Synergy'){
        filter = '0128000000020mOAAQ'; //WM Synergy
        } else if (prog == 'PS Cornerstone') {
        filter = '0128000000020mTAAQ'; //PS Cornerstone
          } else if (prog == 'CB Ascend') {
        filter = '0128000000020mVAAQ'; //CB Ascend
        } else {
        filter = ''; 
        }
        LoadData();        
    }
     


    private void LoadData() { 
        Contacts = new List<multiRowContact>();
        for (List<erp_data__c> cs : [SELECT name, Account__c ,Acct_RT_Name__c, Chain__c,Id, Program__c, RecordTypeId , updatetowhat__c 
               FROM ERP_Data__c  
               WHERE Chain__c = :chainname and RecordTypeId = :filter limit 25]) {
               
                for (erp_data__c c : cs) {
                    multiRowContact MRC = new multiRowContact();
                    MRC.ID = c.ID;
                    MRC.Checked = true;
                    MRC.Name = c.Name;
                    MRC.Program = c.Program__c;
                    MRC.account = c.Account__c ;
                    MRC.updatetowhat = prog;
                    Contacts.add(MRC);
            }
        }
    }
    public PageReference Save() {
        for (multiRowContact MRC : Contacts) {
        MRC.Save();
        }
        //LoadData();
        return new PageReference('/'+idx);
    } 

    private class multiRowContact {
    String prog = ApexPages.currentPage().getParameters().get('pg') ;
    String idx = ApexPages.currentPage().getParameters().get('idx') ;
        public String ID { get; set; }
        public String Name { get; set; }
        public String Account { get; set; }
        public String updatetowhat{ get; set; }
        public String Program { get; set; }
        public Boolean Checked { get; set; }
        List<Participating_Branch_Locations__c > updatedList = new List<Participating_Branch_Locations__c >();
        List<erp_data__c > updatedList_erp = new List<erp_data__c >();
       
        public void Save() {
           

            if (Checked) {
            
            //select account__c  from Participating_Branch_Locations__c where Distributor_Program__c = idx
            
            list <Participating_Branch_Locations__c > ids = [select account__c  from Participating_Branch_Locations__c where Distributor_Program__c = :idx];
            
                if( 1 == 2){
            
                } else {
            
                    System.debug('Saving...ID: ' + ID);
                    erp_data__c c = [SELECT c.updatetowhat__c FROM erp_data__c c WHERE c.ID = :ID LIMIT 1];
                    c.updatetowhat__c = prog;
                    updatedList_erp.add(c);
                    
                    Participating_Branch_Locations__c newpbl = new Participating_Branch_Locations__c (Account__c = Account ,Distributor_Program__c = idx);
                   
                    updatedList.add(newpbl);
            
            
            
                }
            
            
            
            }
            insert updatedList;
            update updatedList_erp;

        }

    }

}

 

 

 

still learning and getting better but why is the if statment  not working in this controller? ( know that data is the same, just need it to work at all . i get Error: MultiRow Compile Error: expecting right curly bracket, found 'if' at line 16 column 2

 

public class MultiRow {
    public List<multiRowContact> Contacts { get; set; }
 
         String chainname = ApexPages.currentPage().getParameters().get('name') ;
         String prog = ApexPages.currentPage().getParameters().get('pg') ;
      
      


    public MultiRow() {
        LoadData();        
    }
     


  if(prog == 'WM Synergy'){
  string   filter = '0128000000020mOAAQ'; //'WM Synergy
  } else {
  string   filter = '0128000000020mOAAQ'; //'WM Synergy
  } 
 
    public PageReference Save() {
        for (multiRowContact MRC : Contacts) {
            MRC.Save();
        }
        LoadData();
        return null;
    }
    private void LoadData() {
    

  
        Contacts = new List<multiRowContact>();
        for (List<erp_data__c> cs : [SELECT name, Account__c ,Acct_RT_Name__c, Chain__c,Id, Program__c, RecordTypeId ,updatechain__c , updatetowhat__c 
               FROM ERP_Data__c  
               WHERE Chain__c = :chainname and RecordTypeId = :filter limit 125]) {
               
                for (erp_data__c c : cs) {
                    multiRowContact MRC = new multiRowContact();
                    MRC.ID = c.ID;
                    MRC.Checked = true;
                    MRC.Name = c.Name;
                    MRC.Program = c.Program__c;
                    MRC.account = c.Account__c ;
                    MRC.updatetowhat = c.updatetowhat__c;
                    Contacts.add(MRC);
            }
        }
    }
 
    private class multiRowContact {
    String prog = ApexPages.currentPage().getParameters().get('pg') ;
    String idx = ApexPages.currentPage().getParameters().get('idx') ;
        public String ID { get; set; }
        public String Name { get; set; }
        public String Account { get; set; }
        public String updatetowhat{ get; set; }
        public String Program { get; set; }
        public Boolean Checked { get; set; }
        public void Save() {
            if (Checked) {
                System.debug('Saving...ID: ' + ID);
                erp_data__c c = [SELECT c.updatetowhat__c FROM erp_data__c c WHERE c.ID = :ID LIMIT 1];
                c.updatetowhat__c = prog;
                update c;
                
                Participating_Branch_Locations__c newpbl = new Participating_Branch_Locations__c (Account__c = Account ,Distributor_Program__c = idx);
                try {
                   insert newpbl;
                } catch (DmlException e) {
                // Process exception here
                }
            }
        }
    }
}