• Forcepower
  • SMARTIE
  • 1165 Points
  • Member since 2011

  • Chatter
    Feed
  • 36
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 394
    Replies

 

Hoping someone can point me in the right direction - I'm bumping against what I think is a logic issue here but can't see my way out of it.

 

I'm trying to create a map of accounts and domain names associated with the account.  The Domains field is a long text field and may have multiple domains listed separated by commas, i.e. bankofamerica.com, boa.com, bankamerica.com etc.

 

When a lead comes into the system, the email domain is parsed out and compared to the domains listed for each account and if a match is found, the lead type is set based on some values of the the account found.  I can get it working perfectly if there is only one domain listed, but as soon as there are multiple domains listed, I can't get the match to work.  

 

I have tried it using a SOSL query, however, I bump up against governor limits very quickly which is a problem when loading lists of leads. 

 

The lastest iteration takes a list of accounts with domains listed and puts them into a map<String, Account>. If there is more than one domain listed in the field, I'm parsing the domains into a list so I can put each domain in as a separate key for the account they belong to, however, I can't get the account to match up to the second domain when I loop through and am instead getting a null value for the account.  I have verified that the domain names are parsing out correctly and that the account remains in scope and the code loops through the generated list of domains for the account the right number of times, however, I can't get the account to go into the map the second time. 

 

My code is below - any suggestions/thoughts would be greatly appreciated!

 

public class setLeadType{

   public static void setLeadAccountType(Lead[] newLeads){
   	   List<String> typeValues = new List<String>();
       List<Account> accts = [SELECT Id, Name, Type, Partner_Status__c, Domains__c, Active_Subscription__c, 
                               		First_Subscription__c, Active_Funnel__c,Customer_Type_Subscription__c,Target_Category__c,
                                    Closed_Amount__c, Website, Closed_Subscription_Transactions__c
                               FROM Account 
                               WHERE Domains__c != NULL];
        map<String, Account> acctDomains = new Map<String,Account>();
       
 
        for(Account a : accts){
            if(a.Domains__c.containsNone(',')){
        		acctDomains.put(a.Domains__c, a);
            } else {
               	List<String> doms = a.Domains__c.split(',');
					for(String s : doms){
                 	   acctDomains.put(s, a);
//HERE IS WHERE I'M HAVING AN ISSUE - THE FIRST DOMAIN/ACCOUNT PAIR IS PUT INTO THE MAP, BUT THE SECOND IS NOT
               	}
           	}
         }
       
        for(Lead ls : newLeads){
            ls.Type_of_Lead__c = NULL;
            Account acct = new Account();
            acct = acctDomains.get(ls.Domain__c);
        	if(acct!=NULL){
                if(acct.Type == 'Partner' && string.isNotEmpty(acct.Partner_Status__c))
                    if(acct.Partner_Status__c != 'Prospect' || acct.Partner_Status__c  != 'Rejected' || 
                    acct.Partner_Status__c  != 'Terminated'){
                    typeValues.add('Existing Partner');
                }
                if(acct.Active_Subscription__c != False && acct.Closed_Subscription_Transactions__c>0){
                    typeValues.add('Active Subscription Customer');
                }    
            if(acct.Active_Funnel__c > 0){
                typeValues.add('Active Funnel');
            }
            if(acct.Active_Subscription__c == False && acct.Closed_Subscription_Transactions__c > 0){
                    typeValues.add('Previous Subscription Customer');
                } 
                if(acct.Closed_Amount__c > 0 && 
                   acct.Active_Subscription__c == False && 
                   acct.Closed_Subscription_Transactions__c == 0){
                    typeValues.add('Non-Subscription Purchase');
                } 
                if(string.isNotEmpty(acct.Target_Category__c) && acct.Target_Category__c == 'Data Warehouse'){
                    typeValues.add('Data Warehouse');
                } 
                if(string.isNotEmpty(acct.Target_Category__c)&& acct.Target_Category__c == 'Fortune/Forbes/Global'){
                     typeValues.add('Fortune/Global');
                }
            String lsType = string.join(typeValues, ';');
            ls.Type_of_Lead__c = lsType;
			
        	}
        }
    }
    public static void setLeadPersonalLeadType(Lead[] ignoreLeads){
        for(Lead l : ignoreLeads){
            l.Type_of_Lead__c = NULL;
        }
    }    
}

 

Thanks!

Good Morning:

 

I have the following Apex Class which converts records froma temporary staging custom object over to new records in another custom object. I am having issues getting the class set up to schedule this run. Any help is appreciated.

 

The issue in the scheduleble class is in 

 

Penetration_Summary__c convertBatch = new Penetration_Summary__c(query);

 

 

 

Hampton

global class PenetrationSummaryConversion implements Database.Batchable<sObject>{

public string Query;

public Penetration_Summary__c penSum;

public List<Penetration_Summary__c> insertPenSumList = new List<Penetration_Summary__c>();

List<Group> QueueList = new List <Group>();

Map<String,Id> QueueMap = new Map<String,Id>();

List<Penetration_Staging_Records__c> addStagingList = new List<Penetration_Staging_Records__c>();

List<Penetration_Staging_Records__c> deleteStagingList = new List<Penetration_Staging_Records__c>();

global Database.querylocator start(Database.BatchableContext BC) {

    Query = 'Select Name, Id, OwnerId, LastModifiedDate, Release__c, CBW_Rev__c, CBW_Subs__c, Copper_CBAD_Rev__c, Copper_CBAD_Subs__c,'+
            'Copper_Voice_Rev__c, Copper_Voice_Subs__c, DSL_Rev__c, DSL_Subs__c, Fiber_CBAD_Rev__c,'+
            'Fiber_CBAD_Subs__c, Fiber_Internet_Rev__c, Fiber_Internet_Subs__c, Fiber_Voice_Rev__c, Fiber_Voice_Subs__c,'+
            'Premium_Speed_Rev__c, Premium_Speed_Subs__c, Units__c, Video_Subs__c, Video_Rev__c,'+
            ' From Penetration_Staging_Records__c' + ' Where Batch_Processed__c=false';
     return Database.getQueryLocator(Query);
}

global void execute(Database.BatchableContext BC, List<sObject> scope) {
    QueueList=[Select Id, Name, DeveloperName, Type from Group where Type = 'Queue'];
    for(Group qObj:QueueList){
        QueueMap.put( qobj.Name, qobj.Id);
    }    
       
        for(sObject s: scope) {
            Penetration_Staging_Records__c tempPenRecords = (Penetration_Staging_Records__c)s;
            if(tempPenRecords.LastModifiedDate < System.now() || Test.isRunningTest())
            
           addStagingList.add(tempPenRecords);
 
         }
        for(Penetration_Staging_Records__c tempRecord : addStagingList){
            penSum = new Penetration_Summary__c();
            penSum.Copper_Voice_Subs__c = tempRecord.Copper_Voice_Subs__c;
            penSum.Copper_CBAD_Subs__c = tempRecord.Copper_CBAD_Subs__c;
            penSum.DSL_Subs__c = tempRecord.DSL_Subs__c;
            penSum.Premium_Speed_Subs__c = tempRecord.Premium_Speed_Subs__c;
            penSum.Fiber_Voice_Subs__c = tempRecord.Fiber_Voice_Subs__c;
            penSum.Fiber_CBAD_Subs__c = tempRecord.Fiber_CBAD_Subs__c;
            penSum.Fiber_Internet_Subs__c = tempRecord.Fiber_Internet_Subs__c;
            penSum.Video_Subs__c = tempRecord.Video_Subs__c;
            penSum.CBW_Subs__c = tempRecord.CBW_Subs__c;
            penSum.Copper_Voice_Rev__c = tempRecord.Copper_Voice_Rev__c;
            penSum.Copper_CBAD_Rev__c = tempRecord.Copper_CBAD_Rev__c;
            penSum.DSL_Rev__c = tempRecord.DSL_Rev__c;
            penSum.Premium_Speed_Rev__c = tempRecord.Premium_Speed_Rev__c;
            penSum.Fiber_Voice_Rev__c = tempRecord.Fiber_Voice_Rev__c;
            penSum.Fiber_CBAD_Rev__c = tempRecord.Fiber_CBAD_Rev__c;
            penSum.Fiber_Internet_Rev__c = tempRecord.Fiber_Internet_Rev__c;
            penSum.Video_Rev__c = tempRecord.Video_Rev__c;
            penSum.CBW_Rev__c = tempRecord.CBW_Rev__c;
            penSum.Units__c = tempRecord.Units__c;
            penSum.Name = tempRecord.Release__c;

            
            insertPenSumList .add(penSum);
            deleteStagingList.add(tempRecord);
            
        } 
        insert insertPenSumList;
        delete deleteStagingList;
}

 global void finish(Database.BatchableContext BC) {  
        
     
    }
    }

 

global class PenetrationSummaryConversionScheduled implements Schedulable{

    global void execute(SchedulableContext sc){

        String query = 'Select Name, Id, OwnerId, LastModifiedDate, Release__c, CBW_Rev__c, CBW_Subs__c, Copper_CBAD_Rev__c, Copper_CBAD_Subs__c,'+
            'Copper_Voice_Rev__c, Copper_Voice_Subs__c, DSL_Rev__c, DSL_Subs__c, Fiber_CBAD_Rev__c,'+
            'Fiber_CBAD_Subs__c, Fiber_Internet_Rev__c, Fiber_Internet_Subs__c, Fiber_Voice_Rev__c, Fiber_Voice_Subs__c,'+
            'Premium_Speed_Rev__c, Premium_Speed_Subs__c, Units__c, Video_Subs__c, Video_Rev__c,'+
            ' From Penetration_Staging_Records__c' + ' Where Batch_Processed__c=false';

        Penetration_Summary__c convertBatch = new Penetration_Summary__c(query);
        Id BatchProcessId = Database.ExecuteBatch(convertBatch);
    }
}

 

In my Account object I have id and refid that relates who referred a client

 

I need to display a referal list tree in a VisualForce page as follows: (Note I just need to display the Name the other fields are to show the relationships)

 

Name=Jim id = 99

     Name=MO, id=1, refid = 99

           Name=JA, id=2, refid=1

                Name=BA, id=3, refid=2

                Name=MA, id=4,refid=2

 

     Name=MB, id=5, refid=99

          Name=CB, id=6, refid=5

                SF id=7, refid =6

                      AA id=8, refid = 7

                 SB id=9, refid=6

 

So the start is Jim, and because of Jim, the following tree has been created based on who each person has referred.

 

Since SOQL doens't have a way of doing a CONNECT BY to bring back the data in the tree order, what are your suggestions for accomplishing this?

 

I assume we need a recursive loop approach but would love to see what you gurus come up with.

 

Thanks so much.

 

When running a report and if Account Teams are enabled you have an option to search "My Account Team and My Accounts". This returns accounts in which you are listed on the sales team or you are the account owner. Belwo is the SOQL and error I am recieving:

 

List<Account> acc = [SELECT Id FROM account WHERE Id IN (SELECT accountId FROM accountteammember WHERE UserId = :UserInfo.getUserId()) OR ownerid = :UserInfo.getUserId()];

 Error: Semi join sub-selects are not allowed with the 'OR' operator

 

Is this a dead end? Any ideas how this could be accomplished with SOQL....or maybe even without SOQL.

 

Thanks,

Jason

 

Dear Sir ,

            i want to calculate no. of the picklist values avaiable in the multiselect picklist of the Object and i want to show that counted value in the vf page

 

thanks u

Hi everyone,

Any help with this problem would be greatly appreciated.  I am currently trying to do a custom CSV import in order to automate the process of importing a CSV every day.  I have a VisualForce page that accepts the filename of the CSV file and calls my apex class to do the upload. (both are below) The CSV parser is working fine, after testing.  The problem I am having is with grabbing the related object ids for the import.  The error I am getting is "System.ListException: List index out of bounds: 17

Error is in expression '{!ReadFile}' in page fotaupload Class.FOTAuploader.ReadFile: line 116, column 1"

 

I think my problem is around the section with the comment "//create a list of the related zip code ids"

 

About my objects:

I have a zip code object that is a related list to my Activations object.

 

 

***********************************************************

FOTAuploader.cls

 

 

 

public with sharing class FOTAuploader {

 

    public string nameFile{get;set;}

    public Blob contentFile{get;set;}

    public Integer rowCount{get;set;}

    public Integer colCount{get;set;}

    List<Activations__c> actvstoupload;

    public Zip_Code_Master__c tempZip;

   

 

// taken from stackoverflow.com/questions/10425925/how-to-parse-a-csv-in-salesforce

    public static List<List<String>> parseCSV(String contents,Boolean skipHeaders) {

List<List<String>> allFields = new List<List<String>>();

 

// replace instances where a double quote begins a field containing a comma

// in this case you get a double quote followed by a doubled double quote

// do this for beginning and end of a field

contents = contents.replaceAll(',"""',',"DBLQT').replaceall('""",','DBLQT",');

// now replace all remaining double quotes - we do this so that we can reconstruct

// fields with commas inside assuming they begin and end with a double quote

contents = contents.replaceAll('""','DBLQT');

// we are not attempting to handle fields with a newline inside of them

// so, split on newline to get the spreadsheet rows

List<String> lines = new List<String>();

try {

lines = contents.split('\n');

} catch (System.ListException e) {

System.debug('Limits exceeded?' + e.getMessage());

}

Integer num = 0;

for(String line : lines) {

// check for blank CSV lines (only commas)

if (line.replaceAll(',','').trim().length() == 0) break;

 

List<String> fields = line.split(',');        

List<String> cleanFields = new List<String>();

String compositeField;

Boolean makeCompositeField = false;

for(String field : fields) {

if (field.startsWith('"') && field.endsWith('"')) {

cleanFields.add(field.replaceAll('DBLQT','"'));

} else if (field.startsWith('"')) {

makeCompositeField = true;

compositeField = field;

} else if (field.endsWith('"')) {

compositeField += ',' + field;

cleanFields.add(compositeField.replaceAll('DBLQT','"'));

makeCompositeField = false;

} else if (makeCompositeField) {

compositeField +=  ',' + field;

} else {

cleanFields.add(field.replaceAll('DBLQT','"'));

}

}

 

allFields.add(cleanFields);

}

if (skipHeaders) allFields.remove(0);

return allFields;                

}

 

 

   

    public Pagereference ReadFile()

    {                  

            //create a restore point incase the upload fails it can back out everything.

            Savepoint sp = Database.setSavepoint();

            

        actvstoupload = new List<Activations__c>();      

        List<List<String>> parsedCSV = new List<List<String>>();

        List<String> zips = new List<String>();

       

        //fill up the parsedCSV table

        rowCount = 0;

        colCount = 0;

        if (contentFile != null){

            String fileString = contentFile.toString();

            parsedCSV = parseCSV(fileString, false);

            rowCount = parsedCSV.size();

            for (List<String> row : parsedCSV){

                if (row.size() > colCount){

                    colCount = row.size();

                }

            }

         }

        

      //create a list of the related zip code ids

 

        for (Integer i=1;i<parsedCSV.size();i++)

        {

        zips[i] = parsedCSV[i][6].replaceAll('\"','');

        }

        List<Zip_Code_Master__c> zipList= [select id from Zip_Code_Master__c where name =:zips];

       

       

       

        for (Integer i=1;i<parsedCSV.size();i++)

        {

           

            Activations__c a = new Activations__c();

           

            a.Zip_Code_of_Activation__c = zipList[i].id;

           

           //process quantity field

            a.ActQty__c = Double.valueOf(parsedCSV[i][18].replaceAll('\"',''));    

 

                

                     //process date field  -- filter out the hour and minutes from the Date field.

                     Date dT = date.parse(parsedCSV[i][0].replaceAll('\"','').trim().substringBefore(' '));

            a.Date_entry__c = dT;  //get date from visualforce page 

 

 

            actvstoupload.add(a);

        }

        try{

        insert actvstoupload;

        }

        catch (Exception e)

        {

            Database.rollback(sp);

            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');

            ApexPages.addMessage(errormsg);

        }   

        return null;

    }

   

    public List<Activations__c> getuploadedActivations()

    {

        if (actvstoupload!= NULL)

            if (actvstoupload.size() > 0)

                return actvstoupload;

            else

                return null;                   

        else

            return null;

    }           

}

 

**********************************************************************************

 

FOTAupload.page

 

<apex:page sidebar="false" controller="FOTAuploader">
<apex:form >
<apex:sectionHeader title="Upload FOTA data from CSV file"/>
<apex:pagemessages />
<apex:pageBlock >
<center>
<apex:inputFile value="{!contentFile}" filename="{!nameFile}" /> <apex:commandButton action="{!ReadFile}" value="Upload File" id="theButton" style="width:70px;"/>
<br/> <br/> <font color="red"> <b>Note: Please use the standard .CSV file from the Retail Activations Portal. </b> </font>
</center>


<apex:pageblocktable value="{!uploadedActivations}" var="actv" rendered="{!NOT(ISNULL(uploadedActivations))}">
<apex:column headerValue="Actv Date">
<apex:outputField value="{!actv.Date_entry__c}"/>
</apex:column>
<apex:column headerValue="Zip">
<apex:outputField value="{!actv.Zip_Code_of_Activation__c}"/>
</apex:column>
<apex:column headerValue="Qty">
<apex:outputField value="{!actv.ActQty__c}"/>
</apex:column>
<apex:column headerValue="City-State">
<apex:outputField value="{!actv.City_State_Concatenation__c}"/>
</apex:column>
</apex:pageblocktable>

</apex:pageBlock>
</apex:form>
</apex:page>

 

I'm having trouble with a trigger I'm trying to write. When new accounts are loaded into my org the owner field is sometimes defaulted to a placeholder user 'x x'. There is another field on the account called market assignment which is a forumula that pulls the market assignment on the market assignment custom object. Also on the market assignement custom object is the manager which should also be the account owner. The trigger is trying to update accounts where owner = 'x x' with the manager from the corresponding market assignement. Any help would be much appreciated. Thanks!!

 

Trigger

 

Trigger marketassignmenttrigger on Account (before Insert, before Update) {
    
    Map<String, Market_Assignments__c> junctionMap = new Map<String, Market_Assignments__c>{};
    
    for (Account a : Trigger.new)
    {
        if (a.owner != null && 
        (Trigger.isInsert || (Trigger.isUpdate && Trigger.oldMap.get(a.id).Market_assignment_copy__c == a.Market_assignment_copy__c)))
        {            
            //Ignore casing in the map
            junctionMap.put(a.Market_assignment_copy__c.toLowerCase(), null);            
        }
    }
    
    if (!junctionMap.isEmpty())
    {    
        
        for (Market_Assignments__c item : [ select Id, market_manager__c, name from Market_Assignments__c where market_manager__c IN :junctionMap.keySet()] )
        {
            junctionMap.put(item.name.toLowerCase(), item);
        }
                        
        for (Account a : Trigger.new)
        {
            if (a.ownerid == '00560000001267d')
            {
               Market_Assignments__c m = junctionMap.get(a.market_assignment_copy__c.toLowerCase());
                
                
                {
                    a.ownerid = m.market_manager__c;                
                }
                
            }
        }
    }    
}

 

Hello:

 

I have the following code which is designed to insert multiple child recods (Assigned_Address__c) when a parent is created (New_Door_Assigned__c).

 

What I need to do is after the child records are inserted, update a field on the child record with a value from the parent record, dependent upon what the index/integer value of the row is.

 

For example, if there are 100 child records, I would want the first 50 to have a Rep__c value = New_Door_Assignment__c.Sales_Rep_One__c, the second 50 to New_Door_Assignment__c.Sales_Rep_Two__c, etc until all child records have a Rep_Name__c value.

 

The code to create the child records works and I have written test class for it. I am now attempting to add in the logic around this starting with 

List<Assigned_Address__c> assigned = new List<Assigned_Address__c>(newAssignment);
assigned.sort(Address__c);

 

Attached is my full code. Any guidance is appreciated.

 

Thanks, 

 

Hampton

 

trigger AddressAssignment on New_Door_Assignment__c (before update) {

Set<String> releaseName = new Set<String>(); 

for (New_Door_Assignment__c newDoor: Trigger.new) {
    if(newDoor.Assigned__c = TRUE){
    {releaseName.add(newDoor.Name);} }

Map<String, Address__c> addressMap = new Map<String, Address__c>();
for(Address__c address1 : [Select ID, Name, Unparsed_Address__c, Release__c from Address__c where Release__c in : releaseName]){
    addressMap.put(address1.Release__c, address1);

List<Assigned_Address__c> newAssignment = new List<Assigned_Address__c>();

    for(New_Door_Assignment__c newRelease : trigger.new) {
        if(addressMap.containsKey(newRelease.Name))
    newAssignment.add(new Assigned_Address__c(
    Address__c = addressMap.get(newRelease.Name).Unparsed_Address__c,
    New_Door_Assignment__c = newRelease.ID));
    Date_Assigned__c = newRelease.Date_Released__c,
    }

List<Assigned_Address__c> assigned = new List<Assigned_Address__c>(newAssignment);
assigned.sort(Address__c);

List<Integer> int = new List<Integer>(assigned);
     if(integer i < newRelease.Doors_Per_Rep__c){
         assigned.Rep__c = newRelease.Sales_Rep_One__c
    else {
    if(integer i < (2*newRelease.Doors_Per_Rep__c)){ 
         assigned.Rep__c = newRelease.Sales_Rep_Two__c
   else {
         assigned.Rep__c = newRelease.Sales_Rep_Three__c;
}
}
}
update newAssignment;

insert newAssignment;
  }
 } 
}

 

Hello:

 

I am getting the above error at Line 15 of the below code. 

 

Here is what I am looking for:

 

(1) Address__c has a field called Release__c

 

(2) There will be multiple Address__c records where Address__c.Release__c.Name = New_Door_Assignment__c.Name

 

(3) Assigned_Address__c is a child to both Address__c and New_Door_Assignment__c

 

(4) What I am trying to do is upon creation of a New_Door_Assignment__c record, to create the multiple child records (Assigned_Address__c) related to both New_Door_Assignment__c and Address__c

 

Here is what I have started and am getting the error above. Any help is moe than appreciated.

 

trigger AddressAssignment on New_Door_Assignment__c (after insert) {

Set<String> releaseName = new Set<String>(); 

for (Release__c release : Trigger.new) {
    {releaseName.add(release.Name);}

Map<String, Address__c> addressMap = new Map<String, Address__c>();
for(Address__c address1 : [Select Name, Unparsed_Address_Formula__c, Release__c from Address__c where Release__c in : releaseName]){
    addressMap.put(address1.Release__c, address1);

List<Assigned_Address__c> newAssignment = new List<Assigned_Address__c>();

    for(New_Door_Assignment__c newRelease : trigger.new) {
        if(addressMap.containsKey.(newRelease.Name))
    newAssignment.add(new Assigned_Address__c(
    Date_Assigned__c = newRelease.Date_Released__c,
    New_Door_Assignment__c = newRelease.ID,
    Rep__c = newRelease.Reps__c));
    }
insert newAssignment;
  }
 } 
} 

 

Thanks,

 

Hampton

I'm writing a trigger and need to get the Opportunity Name from from OpportunityLineItem. Any help would be appreciated!

Error: 554 System.SObjectException: Invalid field FirstName  for Account  Class.myHandler.handleInboundEmail

 

I am parsing CSV in email service. My CSV has four columns 

 

FirstName  LastName Type AnnualRevenue Test  AccountWaa GPO 1000

 

Below is my code snippet 

 

global class myHandler implements Messaging.InboundEmailHandler {
    
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
    Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
    
    System.Debug('Debug :: Mail Checking' + email);
    Messaging.InboundEmail.TextAttachment[] tAttachments = email.textAttachments;
    
    list<Account> lstAccount = new List<Account>(); // list of accounts.
    
    String csvbody='';
    
    List<List<String>> allFields = new List<List<String>>(); // list of rows in csv
    List<String> lines = new List<String>(); // Rows of csv
    list<String> headers = new List<String>();    // field names   
    List<String> fields = new List<String>(); // list of fields 
    
    if(tAttachments !=null){
        for(Messaging.InboundEmail.TextAttachment btt :tAttachments){
            if(btt.filename.endsWith('.csv')){
                csvbody = btt.body;
                // process csv body here
                System.Debug('Debug ::: CSV as a string' + csvbody);
                try {
                    lines = csvbody.split('\n');
                    System.Debug('Debug ::: Split csv ' + lines);
                    System.Debug('Debug ::: Split csv size' + lines.size());
                } catch (System.ListException e) {
                    System.debug('Limits exceeded?' + e.getMessage());
                }
            }
        
        }
        
        integer rowNumber = 0;
        
       
        for(String line : lines) {
        // check for blank CSV lines (only commas) 
            if (line.replaceAll(',','').trim().length() == 0) break;
            
            fields = line.split(',', -1);
       
            
            
            System.Debug('Debug ::: line after replace :: ' + line);
            System.Debug('Debug ::: fields csv ' + fields );
            System.Debug('Debug ::: fields csv size' + fields.size() );
            
            allFields.add(fields);
            if(rowNumber == 0)
            {
                // for getting the field names. 
                for(list<String> rows : allFields){    
                    for(String header : rows){
                        headers.add(header);
                    }
                 break;
                }
               
                rowNumber++;
                continue;
            }
        
        }
        
        System.Debug('Debug ::: before removing all fields ' + allFields);
        System.Debug('Debug ::: after removing all fields ' + allFields);
        System.Debug('Debug ::: all fields size' + allFields.size());
        
        
        
        System.Debug('Debug :: Check account' + headers);
        System.Debug('Debug :: Check account' + lstAccount);
       
        
        for(Integer i = 1 ; i < lines.size() ; i++){
            Account a = new Account();
            
            System.Debug('Debug :: first header value ' + headers.get(0));
            
            System.debug('Debug :: Field Name ::' + headers[0]);
            System.debug('Debug :: Field Value ::' + allFields[i][0]);
            //Schema.Account.Name
            
            a.put(headers[0] , allFields[i][0]);
            a.put(headers[1] , allFields[i][1]);
            a.put(headers[2] , allFields[i][2]);
            a.put(headers[3] , allFields[i][3]);
            
            lstAccount.add(a);
        }
            
       
        System.Debug('Debug :: Check account' + lstAccount);
        insert lstAccount;
        
    }
    
    return result;
      }
  }

 

 a.put(headers[0] , allFields[i][0]); // I am getting invalid field 'FirstName' error on this line of code  although debug log is showing correct value.
 

a.put('FirstName', all Fields[i][0]); // this is working perfect

Hi,

I' have following code, however it always pulls the first cases account value of [0],  and always updating opportunities of that account on all the cases. in the setcaseid.

 

How do i get account from their respective cases from setcaseid instead of it pulling always first [0].

 

Thanks

 

 

lstCase = [Select Id, AccountId,Status from Case where Id = :setCaseId];

if(lstCase[0].AccountId != null){
accId = lstCase[0].AccountId;
lstOppty = [Select Id, Name, Probability, Amount from Opportunity
where AccountId =: accId
AND StageName IN ('Qualification','Prospecting')
AND CloseDate = THIS_QUARTER
AND CloseDate <= NEXT_QUARTER];
}

CountOpportunity = lstOppty.size();

for(Opportunity opp: lstOppty){

if(opp.Amount != null){
SLic += opp.Amount*conRate;
}

}

List<Case> cs = new List<Case>();
if (!setCaseId.ISEMPTY()){
for(Case c: lstcase){
if(c.Status !=null){

c.SumLicence__c = SLic;
c.Total_opp__c = CountOpportunity;
//c.Status = 'Working';
cs.add(c);
}

}
Update cs;

Please help, I am new to developing / Apex code and am trying to set up a trigger to update a picklist field (on an Activity)based on a different Object's picklist entry (User) - the ultimate aim is to set colours in a dashboard the same in two different objects - Activities and Opportunities...

 

I am getting the following error:

Error: Compile Error: Invalid bind expression type of SOBJECT:User for column of type String at line 3 column 92

 

And honestly I have no clue what I need to do to fix this...!

 

Here is my first attempt:

 

trigger UpdateDepartmentPicklist on Task (before update){
        for(Task tsk : Trigger.new){
        List<User> listUse = [Select Department_picklist__c from User where Owner_ID__c =: tsk.CreatedBy];  for
    (User use : listUse){
       Tsk.Owner_Department_Picklist__c = Use.Department_picklist__c;
            }
    update listUse;
     }  
}       

 

 

Many thanks for any assistance or tips!

Cheers,

Kelly

 

In the following trigger I am taking the multi-value field named Subsidiaries_On_Contract__c and creating a new child record for each value within it. That is working fine. However, I am attempting to populate the lookup Subsidiaries_and_Brands field which is a lookup to the Subsidiary and Brands object with the name of the corresponding name from Subsdiaries_On_Contract and it is only working for the first new record which is being created each time. 

 

Here is the code. The portion in red is the part which is where I am attempting to somehow use the Map method to to connect the name to the corresponding Subsidiaries and Brands object.

trigger AutoCreateSubsServOnContrOv on Contract_Overview__c (after insert, after update) 
{
   List<Subs_Serviced_On_Contract__c> subs = new List<Subs_Serviced_On_Contract__c>();

   // get the full list of sub account names for all records being processed by the trigger

   List<String> subAccNames=new List<String>();

   for (Contract_Overview__c newCont : Trigger.New) 
   {
      if (newCont.Subsidiaries_On_Contract__c != '[]') 
      {
         // split out the multi-select picklist using a comma delimiter
         System.debug('Subsidiaries_On_Contract__c ' + newCont.Subsidiaries_On_Contract__c);

         String temp = newCont.Subsidiaries_On_Contract__c;
         temp = temp.replace(']','');
         temp = temp.replace('[','');
         String[] all = temp.split(',');
         subAccNames.addAll(all);
      }
   }

   // get the ids for all sub accounts and store in a map keyed by name
   Map<String, Id> subAccIdsByName=new Map<String, Id>();
   for (SubsidiariesAndBrands__c subAcc : [select id, Name from SubsidiariesAndBrands__c where Name in :subAccNames]) 
           {
              subAccIdsByName.put(subAcc.Name, subAcc.id);
           }
 System.debug('SubsidiariesAndBrands ************ ' + subAccIdsByName);
   //For each position processed by the trigger, add a new  

   //Subs_Serviced_On_Contract record for the specified Subsidiaries_On_Contract__c.  

   //Note that Trigger.New is a list of all the new positions  

   //that are being created.  

   for (Contract_Overview__c newContract : Trigger.New) 
   {
      if (newContract.Subsidiaries_On_Contract__c != '[]') 
      {
         // split out the multi-select picklist using a comma delimiter
         System.debug('Subsidiaries_On_Contract__c ' + newContract.Subsidiaries_On_Contract__c);

         String temp = newContract.Subsidiaries_On_Contract__c;
         temp = temp.replace(']','');
         temp = temp.replace('[','');
         String[] all = temp.split(',');

         for(String subsoncontract: all)
         {
         
         
         
            subsoncontract = subsoncontract.normalizeSpace();
            //for(String subsoncontract: newContract.Subsidiaries_On_Contract__c.split(',')){
            
            Subs_Serviced_On_Contract__c ssoc = new Subs_Serviced_On_Contract__c(
                    Name = subsoncontract,
                    Contract_Overview__c = newContract.Id,
                    Account__c = newContract.Account__c,
                    Subsidiaries_and_Brands__c = subAccIdsByName.get(subsoncontract),  // GET THE SUB ACCOUNT ID BASED ON NAME
                    Contract_and_Sub__c = newContract.Name + '~' + subsoncontract,
                    Contract_Start_Date__c = newContract.Contract_Start_Date__c,
                    Contract_End_Date__c = newContract.Contract_End_Date__c,
                    Logo_Usage_Allowed__c = 'Yes');

            subs.add(ssoc);
         }
      } 
   }

   upsert subs Contract_and_Sub__c;
}

 

Since it is only working for the first value I am assuming I somehow have to reposition that portion of the code within the loop which is creating the records and somehow maybe use a Get to retrieve the individual values, but I can't figure out where\how exactly that should be done.

 

If you can give me any input I was love it.

 

Thank you very much. 

  • April 30, 2013
  • Like
  • 0

I am attempting to build a select option list out of two different strings which refer to two separate multi-value fields. Here is the (non-functioning) code which I have right now. 

 

if(selectedMulPickKeyTech==null)
        {
            options.add(new SelectOption('',''));
            return options;
        }
        else
        {
            picklistlines = selectedMulPickKeyTech.split('\n');
            for (Integer i=0;i<picklistlines.size();i++)
            {
                String[] inputvalues = new String[]{};
                inputvalues=picklistlines[i].split(',');
                for(Integer j=0;j<inputvalues.size();j++)
                {
                  if(!selectedItems.contains(inputvalue))
                  options.add(new SelectOption(inputvalues[j],inputvalues[j] ));
                }
            }

        return options;
        }
    } 

 

selectedMultiPickKeyTech is a string which I got back from a query referring to another record's multi-value field.

 

selectedItems is a string which refers to a multi-value field on the current record.

 

As you can see in the bold\underlined lines, I was trying to use Contains as a way to get it but that wouldn't work with a string value.

 

I would like to have the select options only be the values which are not already in selectedItems.

 

Does anybody know the proper way to achieve this ? 

 

Thank you very much for your help.

 

  • April 29, 2013
  • Like
  • 0

 

trigger TriggerOnLead on Lead (before insert) {
 
    Map<String, Lead> mapLead1 = new Map<String, Lead>();
    SYSTEM.DEBUG('!!!!!!!!!!mapLead1!!!!!!!!!!!'+mapLead1);
    Map<String, Lead> mapLead2 = new Map<String, Lead>();
    SYSTEM.DEBUG('+++++++++++mapLead2 +++++++++++++++'+mapLead2 );

    for (Lead lead : System.Trigger.new) {
          mapLead1.put(lead.concatinate_name_and_email__c.TOLOWERCASE().TRIM(), lead);
          mapLead2.put(lead.concatinate_name_and_phone__c.TOLOWERCASE().TRIM(), lead);
    }
     list<lead> lead1=[SELECT Id,Name,Email,Phone,concatinate_name_and_email__c FROM Lead WHERE concatinate_name_and_email__c  IN :mapLead1.KeySet()];
   
    list<lead> lead2=[SELECT Id,Name,Email,Phone,concatinate_name_and_phone__c FROM Lead WHERE concatinate_name_and_phone__c IN :mapLead2.KeySet()];
    for (Lead lead4 : System.Trigger.new) {
      if(lead4.Any_way_save_record__c!=true)
      {
  
    if(lead1.size()>0)               /*at this line error is coming. */
    {
     for (Lead lead :lead1){
      Lead newLead = mapLead1.get(lead.concatinate_name_and_email__c.TOLOWERCASE().TRIM());
       SYSTEM.DEBUG('*************mapLead1************************'+mapLead1);
         SYSTEM.DEBUG('@@@@@@@@@newLead@@@@@@@@@@@@@@@'+newLead);
        newLead.addError('already exists<a style=color:GREEN href=/apex/leaderror?id='+LEAD.ID+'>'+  lead.name + '</a>');
    }}else if(lead2.size()>0){
    for (Lead lead :lead2 ) {
      Lead newLead1 = mapLead2.get(lead.concatinate_name_and_phone__c.TOLOWERCASE().TRIM());
      SYSTEM.DEBUG('%%%%%%%%%%%%newLead1%%%%%%%%%%%%%%%%%%'+newLead1);
      
        
       newLead1.addError('already existse<a style=color:GREEN href=/apex/leaderror?id='+LEAD.ID+'>'+  lead.name + '</a>');

  
    }
    
   }
}
}
}

 TR: Sandbox: Developer script exception : TriggerOnLead : TriggerOnLead: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.TriggerOnLead: line 22, column 1

Hi All,

I am trying to get the count() of a particular set of accounts based on the search criteria. In the controller everything looks good and also in the debug logs , I am getting the desired outputs. The problem is when I try fetching the aggregate result in the page, I am getting the following error : Unknown property 'String.inti'

 

I am posting my code hereby,

 

page:

<apex:page controller="accountSearch">
<script>
function information()
{
method1();
alert('ddd');
var pbs1=true;
alert(pbs1);
}
</script>
<apex:form >
<apex:pageBlock >
<apex:outputLabel value="Enter your search text:" >
<apex:inputText value="{!searchVar}">
</apex:inputText>
</apex:outputLabel>
<apex:commandLink value="Search" action="{!getAccounts}" />


<apex:pageBlockTable value="{!accList}" var="acc" rendered="{!IF(count,true,false)}" >
<apex:column headerValue="Account Name">
<apex:commandLink action="{!getID}" value="{!acc.name}">
<apex:param name="var1" value="{!acc.id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>

<apex:dataTable value="{!wrapList}" var="wrp" rendered="{!IF(count,true,false)}" border="1" >
<apex:column >
<apex:facet name="header">Count:</apex:facet>
<apex:outputText value="{!wrp.inti}"></apex:outputText>
</apex:column>
</apex:dataTable>

<apex:actionFunction name="method1" action="{!method1Action}"/>

<apex:pageBlockSection title="Account Information" rendered="{!IF(op1,true,false)}" collapsible="false" onclick="information()">
<apex:outputPanel rendered="{!IF(pbs1,true,false)}">
<apex:repeat value="{!selectedAccount}" var="selectedAcc" >
<td>
<tr>
<apex:pageBlockSection >
<apex:outputField value="{!selectedAcc.Name}"></apex:outputField>
</apex:pageBlockSection>
</tr>
</td>
</apex:repeat>

</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Controller :

public with sharing class accountSearch {


public String olId { get; set; }
public String searchVar { get; set; }
public String var;
public String var1{get;set;}
public Account selectedAccount{get;set;}
public list<Account> accList = new list<Account>();
public boolean op1=false;
public boolean pbs1=false;
public boolean count=false;
public list<wrapClass>wrapList = new list<wrapClass>();
public list<AggregateResult> agr = new list<AggregateResult>();

public PageReference getAccounts() {
var='%'+searchVar+'%';
system.debug('aaaaaaaaaaaa'+var);
accList = [Select id,name,NumberOfEmployees from account where name LIKE:var ];
system.debug('vvvvv'+accList);
count=true;
getResult();
system.debug('ddddddddddddddddd');
return null;
}

public list<wrapClass> getResult()
{
agr=[Select name,Count(id) quantity from Account where id IN : accList GROUP BY name ];
system.debug('ccccccccccc'+agr);
String str='';
for(AggregateResult a:agr)
{
str +=a.get('quantity');
system.debug('nnnnnnnn'+str);
wrapList.add(new wrapClass(str)); ---here I am adding string to the wrapper class list
}
system.debug('rrrrrrrrrrr'+wrapList);
return wrapList;
}

public list<Account> getAccList(){
return accList;
}
public String getID()
{
String strId = apexpages.currentpage().getparameters().get('var1');
system.debug('lllllllllll'+strId);
selectedAccount=[Select name,OwnerId,Site,AccountSource,AnnualRevenue,NumberOfEmployees,Fax,Industry,Ownership,Phone,Rating,Type from Account
where id=:strId];
op1=true;
pbs1=false;
return null ;
}
public String getWrapList() {
return null ;
}

public String getWrp(){
return null;
}


public Boolean getOp1()
{
return op1;
}

public void setOp1(Boolean abc)
{
this.op1=abc;
}
public Boolean getPbs1()
{
return pbs1;
}

public void setPbs1(Boolean abc)
{
this.pbs1=abc;
}
public void method1Action()
{
pbs1=true;
}
public Boolean getCount()
{
return count;
}

public void setcount(Boolean abc)
{
this.count=abc;
}

public class wrapClass{
public wrapClass wrp{get;set;}
public String inti{get;set;}
public wrapClass(String agg
{
inti=agg;
system.debug('ssssssssss'+inti);
}
}
}

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

I am not sure as of why I am getting this error :  Unknown property 'String.inti' . Am I missing something?

 

 

 

Please help.

 

Cheers!!

  • April 28, 2013
  • Like
  • 0

Hi All, I am having a custom button "convert" on my custom object, whencilck the convert button it must create a new account, contact and opportunity.Before it convert it into Account,Contact and Opportunity it must check the all Account name in "Account" tab. If the Account Name is exist means it must display the error message"Account Name exist" . Other wise it must create new Account, Contact and Opportunity. For "convert " i am using Apex code and VF page. I tried using a checkbox for this but when uncheck the checkbox it is creating a new account in the same name, that is same account name which is already exist. Kindly tell me now to resolve this

 

Apex code:

public class Convert {

public PageReference RedirecttoLead()
{
String currentLead = '/' + siteObj.Id;
PageReference pageRef = new PageReference(currentLead);
return pageRef;
}

private Site__c siteObj;
//public ID Cus_Account_ID, Cus_obj_Record_ID;
// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public Convert(ApexPages.StandardController stdController)
{
System.debug('******Voltum******');
siteObj = (Site__c)stdController.getRecord();
// Cus_obj_Record_ID=siteObj.Id;
}

public void convertbutton(){

Account acc = new Account();
acc.Name = siteObj.Company_Name__c;
acc.BillingStreet = siteObj.Company_Address__c;
acc.BillingCity = siteObj.Company_City__c;
acc.BillingState= siteObj.Company_State__c;
acc.BillingPostalCode = siteObj.Company_Postal_Code__c;
acc.Phone = siteObj.Company_Phone__c;
acc.Website = siteObj.Company_Email__c;
acc.Fax = siteObj.Company_Fax__c;
// acc.CurrencyIsoCode = siteObj.CurrencyIsoCode;

try
{
insert acc;
}
Catch (Exception ex1)
{
ex1.getmessage();
}
Contact cc = new Contact();
cc.LastName = siteObj.Contact_Name__c;
cc.Email = siteObj.Contact_Email__c;
cc.Phone = siteObj.Contact_Mobile__c;
cc.AccountId = acc.Id;
//temp_siteObj = [select AccountId from Contact where Id ='Cus_obj_Record_ID'];
//Cus_Account_ID = temp_siteObj.AccountId;

//Id accountId = [select AccountId from Contact where Id = {ID}][0].AccountId;
//System.Debug(accountId);

try
{
insert cc;
}
Catch (Exception ex2)
{

ex2.getmessage();
}

Opportunity opp = new Opportunity();
opp.Name = siteObj.Opp_Name__c;
opp.AccountId= acc.Id;
opp.CloseDate = siteObj.Opp_CloseDate__c;
opp.StageName = siteObj.Opp_stage__c;

try
{
insert opp;
}
Catch (Exception ex3)
{

ex3.getmessage();
}




// try
// {
// Delete siteObj;
//}
//catch(Exception ex4)
// {
// ex4.getmessage();
// }

}

}

 

VF Page Code:

<apex:page standardController="Site__c" cache="true" action="{!convertbutton}" extensions="Convert" >
<br/><br/>
<apex:messages style="color:red; font-weight:bold; text-align:center;"/>
<apex:form >
<center>

<apex:outputField value="{!Site__c.Company_Name__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Company_Address__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Company_City__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Company_State__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Company_Postal_Code__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Company_Phone__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Company_Email__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Company_Fax__c}" rendered="false"/>

<apex:outputField value="{!Site__c.Contact_Name__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Contact_Email__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Contact_Mobile__c}" rendered="false"/>

<!--<apex:outputField value="{!Site__c.CurrencyIsoCode}" rendered="false"/>-->
<apex:outputField value="{!Site__c.ConvertedSite__c}" rendered="false"/>

<apex:outputField value="{!Site__c.Opp_Name__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Opp_CloseDate__c}" rendered="false"/>
<apex:outputField value="{!Site__c.Opp_stage__c}" rendered="false"/>
<apex:commandLink value="Redirect to Lead" style="color:blue; font-weight:bold;" action="{!RedirecttoLead}"/>

</center>

</apex:form>
</apex:page>

I'm reposting this because I never got a response - sorry.

 

I've set up 3 charts with 3 seperate controllers on a visual force page, however the information on all of the charts is being rendered the same for all three based on the last extension being used in the VF order. 

 

Initially I thought it was the data variable being consistent through each controller, but no matter how I changed or manipulated it, it didn't work. I figure that regardless of the data variable it should be different per each controller. 

 

Any insight would be greatly appreciated, thank you!

 

VF:

 

<apex:tab label="Gauge Party" rendered="{!Events__c.Meeting_Type__c <> 'Argyle Conversation'}" name="GaugeParty" id="tabGauges">
<apex:pageBlock title="{!$ObjectType.Events__c.label} Gauge">
<apex:pageBlockSection showHeader="true" title="Attendee Goal" columns="2">
<apex:page standardController="Events__c" extensions="GaugeChartController">
<apex:chart name="MyChart" height="300" width="450" animate="true" data="{!data}">
<apex:axis type="Gauge" position="gauge" title="Attendee Goal" minimum="0" maximum="{!Events__c.Attendee_Number_Goal__c}" steps="5"/>
<apex:gaugeSeries dataField="size" donut="50" colorSet="#78c953,#ddd"/>
</apex:chart>
<script>
MyChart.on('beforeconfig', function(config) {
config.axes[0].margin=-10;
});
</script>
</apex:page>
</apex:pageBlockSection>
<apex:pageBlockSection showHeader="true" title="Attended" columns="2">
<apex:page standardController="Events__c" extensions="GaugeChartController2">
<apex:chart name="MyChart2" height="300" width="450" animate="true" data="{!data}">
<apex:axis type="Gauge" position="gauge" title="Attended" minimum="0" maximum="{!Events__c.Attendee_Number_Goal__c}" steps="5"/>
<apex:gaugeSeries dataField="size" donut="50" colorSet="#78c953,#ddd"/>
</apex:chart>
<script>
MyChart2.on('beforeconfig', function(config) {
config.axes[0].margin=-10;
});
</script>
</apex:page>
</apex:pageBlockSection>
<apex:pageBlockSection showHeader="true" title="Confirmed" columns="2">
<apex:page standardController="Events__c" extensions="GaugeChartController3">
<apex:chart name="MyChart3" height="300" width="450" animate="true" data="{!data}">
<apex:axis type="Gauge" position="gauge" title="Confirmed" minimum="0" maximum="{!Events__c.Attendee_Number_Goal__c}" steps="5"/>
<apex:gaugeSeries dataField="size" donut="50" colorSet="#78c953,#ddd"/>
</apex:chart>
<script>
MyChart3.on('beforeconfig', function(config) {
config.axes[0].margin=-10;
});
</script>
</apex:page>
</apex:pageBlockSection>
</apex:pageBlock>

  • April 26, 2013
  • Like
  • 0

Hi All,wheni upload a csv it must create account, contact, opportunity.

In my custom lead i am having custom field

company name,

company street,

company city, 

comapny state,

company postal code.

 

when i upload csv file,this fields must be mapped to "Billing Address" field on "Account". How this can be done. i didn't how to map this fileds.

Apex code:

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

public PageReference fileAccess() {
return null;
}

public FileUploaderAll(){
}
public string nameFile{get;set;}
public Blob contentFile{get;set;}
String[] filelines = new String[]{};
List<Account> accstoupload;
List<Contact> contoupload;
List<Opportunity> opptoupload;
List<CustomLead__c> custtoupload;
List<String> acctNames;

List<Account> newAccts = new List<Account>();
public Pagereference ReadFile()
{
nameFile=contentFile.toString();
filelines = nameFile.split('\n');
accstoupload = new List<Account>();
contoupload = new List<Contact>();
opptoupload = new List<Opportunity>();
custtoupload = new List<CustomLead__c>();
acctNames = new List<String>();
List<Account> existingAccts =new List<Account>();
for (Integer i=1;i<filelines.size();i++)
{
String[] inputvalues = new String[]{};
inputvalues = filelines[i].split(',');
Account a = new Account();
a.Name = inputvalues[0];
acctNames.add(a.Name);

accstoupload.add(a);
}


existingAccts = [SELECT Id, Name FROM Account where name in :acctNames];
//create a map with names as key
Map<String, Id> acctNamesIdMap = new Map<String, Id>();
// load the map - this will help you find out if an account name exists already
for (Account acct : existingAccts)
{
acctNamesIdMap.put(acct.Name, acct.Id);
System.debug('******Sai******');
}

for (Account acct : accstoupload)
{
//if account name does not exist in map, add it to list of new accounts
if (!acctNamesIdMap.containsKey(acct.Name))
//if (!acctNamesIdMap.containsKey(acct.Id))
{
newAccts.add(acct);

}

}

try
{

insert newAccts;
ApexPages.Message msg = new ApexPages.Message(ApexPages.severity.info,'AccountName with Account Id are the new Account created.Related Contact and Opportunity also created');
ApexPages.Message msg1 = new ApexPages.Message(ApexPages.severity.info,'AccountName without Account Id are the existing Accounts');
ApexPages.addMessage(msg);
ApexPages.addMessage(msg1);

}
catch (Exception e)
{

ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'Account Name already exist, change Account Name and try again');
ApexPages.addMessage(errormsg);

}


//return null;
for (Integer i=1;i<filelines.size();i++)
{
String[] inputconvalues = new String[]{};
inputconvalues = filelines[i].split(',');

Contact con = new Contact();
for(account a: accstoupload)
{
con.AccountId = accstoupload[i-1].id;
//con.AccountId = a.Id;
}
//con.Account= inputconvalues[0];
if(con.AccountId!= null){

con.Lastname = inputconvalues[1];
con.Lastname_lead__c = inputconvalues[2];

contoupload.add(con);
}}
try
{
insert contoupload;

I'm wondering if someone can point me to link/s to instructions on: 1. How the owner of an AppExchange job can stop it from accepting new applicants once they have selected a developer 2. How they can rate/review the selected developer. Thanks, Ram

Hi All,

This is Yamini Bathula from Brisbane, Australia. I have more than 5 years of experience in customer service in different types of companies. I am more interested in developing as I have done my graduation in Computer Science and Engineering and I have attended Dev 401 certification course 2 weeks back to change my career.I am now preparing for the Dev401 certification test. And also building my resume to apply for the jobs. Can anyone help me in building an entry level resume for me? Just give me some tips to build an impressive resume.

Thanks,
Yamini.

Need customizations starting with a tie-in to our shopping cart system.  Specifically list product items in SalesForce, allow the sales rep to enter selections and variants, then post to our shopping cart system via RESTful JSON.  More projects to follow.

You can be located anywhere and work at your own pace.
We are looking for a Developer who will be able to build our Community Site with the help of Visualforce.

It is an immediate one time project that includes building a customized community site for our company. Entry-Level Developers are welcome!
 
We recently upgraded to Salesforce Enterprise and got the Service Cloud Edition with it. We have deployed it internally and set it up. But we would like to have a nicer Community Site that the one that Salesforce Communities come with.  

More information available per email conversation or phone call. 

Hello,

I'm looking for a developer to create two advanced triggers for a complicated salesforce instance.  I have a certain amount of budgeted hours for creation, testing, & pushing to production.  I have a healthy rate that I'm looking to pay for a qualified individuals.  Will provide all documentation needed.  Will have to go through quick psudo-interview process and sign Subcontractors agreements.  Looking to kick this project off Wednesday Feb 5th.  Need to make a final decision by Monday Feb 3rd.  Need to be available for Skype and or GoToMeeting Requests.  Please reply to this post and I'll be in touch with next Steps.  Very High Priority!

Hi All,

 

I have created a force.com site.Now as the users try to login to this site, there are getting this SSL Certifiacte error.

 

If we click on "Procede Anyway", then the user will be allowed into the site.

 

How should I resolve this for the entire Organisatiion users.

 

Thanks,

Vijay

Hello,

 

I have created a force.com site and I have published it. During my internal testing I found that everything worked flawlessly. I tested the apex forms system with captcha on Chrome, Safari, Firefox and the latest versions of IE7 to IE10. Not a single glitch.

 

However as soon as I published the site, my call volume went from 30 calls a day to about 75 calls a day. The main problem, is that the captcha is not submitted the forms field for version of Internet explorer 8 to 9 that are not running the latest version. Since so many web visitors are not running the latest version, they call and complain. This was not an issue before I started using force.com sites. 

 

I have copied the steps at http://wiki.developerforce.com/page/Adding_CAPTCHA_to_Force.com_Sites.

 

Line 24 and line 29 always return null on IE 9.0.8112.16421. Therefore visitors cannot submit the captcha with success.

 

024             return ApexPages.currentPage().getParameters().get('recaptcha_challenge_field');
 
029             return ApexPages.currentPage().getParameters().get('recaptcha_response_field');


Would anyone know how to fix it?

I'm having trouble with a trigger I'm trying to write. When new accounts are loaded into my org the owner field is sometimes defaulted to a placeholder user 'x x'. There is another field on the account called market assignment which is a forumula that pulls the market assignment on the market assignment custom object. Also on the market assignement custom object is the manager which should also be the account owner. The trigger is trying to update accounts where owner = 'x x' with the manager from the corresponding market assignement. Any help would be much appreciated. Thanks!!

 

Trigger

 

Trigger marketassignmenttrigger on Account (before Insert, before Update) {
    
    Map<String, Market_Assignments__c> junctionMap = new Map<String, Market_Assignments__c>{};
    
    for (Account a : Trigger.new)
    {
        if (a.owner != null && 
        (Trigger.isInsert || (Trigger.isUpdate && Trigger.oldMap.get(a.id).Market_assignment_copy__c == a.Market_assignment_copy__c)))
        {            
            //Ignore casing in the map
            junctionMap.put(a.Market_assignment_copy__c.toLowerCase(), null);            
        }
    }
    
    if (!junctionMap.isEmpty())
    {    
        
        for (Market_Assignments__c item : [ select Id, market_manager__c, name from Market_Assignments__c where market_manager__c IN :junctionMap.keySet()] )
        {
            junctionMap.put(item.name.toLowerCase(), item);
        }
                        
        for (Account a : Trigger.new)
        {
            if (a.ownerid == '00560000001267d')
            {
               Market_Assignments__c m = junctionMap.get(a.market_assignment_copy__c.toLowerCase());
                
                
                {
                    a.ownerid = m.market_manager__c;                
                }
                
            }
        }
    }    
}

 

Hey, check me out!

 

public string getOrdinal(integer i){
        string num = string.valueof(i);
        string suffix = 'th';
        string ordinal = '';
        i = integer.valueof(num.right(2));
        if(10 < i && i < 14) {
            ordinal =  num + suffix;
        }else{
            string onesDigit = num.right(1);
            if(onesDigit == '1'){
                suffix = 'st';
            }else if(onesDigit == '2'){
                suffix = 'nd';
            }else if(onesDigit == '3'){
                suffix = 'rd';
            }
            ordinal = num+suffix;
        }
        return ordinal;
    }

 :D