• Tony Tannous
  • NEWBIE
  • 490 Points
  • Member since 2014
  • EI-Technologies


  • Chatter
    Feed
  • 16
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 92
    Replies
I tried updated the Secuity code for the account.  We are binding to "https://www.salesforce.com/services/Soap/u/25.0" that has not changed.  We are using TLS 1.2 or 1.1 ..  The password and account name is correct.  What else could be wrong.  It literally happened after she changed the domain.  
 
I am reading Map<String, String> values on visualforce page inside javascript function but i am getting no values


var myVal = new Array();

function refreshfilterfieldmap(){
    <apex:repeat value="{!map_types}" var="key">
       <apex:repeat value="{!map_types[key]}" var="map">
           myVal['{!key}'] = '{!map}';
       </apex:repeat>
    </apex:repeat>
  }


can anyone help me how loop map in javascript function for all values of map.
I would like to ask you, the below SOQL query why is non-selective query?

SELECT Id, Name, E_mail__c, E_mail_2__c, Phone, mobilephone__c, Telefhone_3__c, Description, OwnerId, Owner.UserRole.Name
FROM Account
WHERE EXT_ID__c = '1' AND (E_mail__c = :var1 OR E_mail_2__c = :var1)

The total count of Accounts is 101000.
The count of Accounts where ext_id__c = '1' is 99000.
The count of Accounts where ext_id__c = '2' is 2000.
The EXT_ID__c is external id, not requied and not unique.
The var1 is not nullable.

If I filter ext_id__c to '1', it throws QueryException, but if '2' not throw.

Apex trigger Web2Lead caused an unexpected exception, contact your administrator: Web2Lead: execution of BeforeInsert caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Class.Web2LeadHandler.RealtedAccount: line 190, column 1
Hi,

I need to create an Event each time a contact had answered Yes to be contacted on a survey.
When the survey is created, the trigger should create an event for the Account Owner.

But I have an issue with the owner Id , someone can help me to correct it?

trigger EventForCustomerToContact on Amcor_Surveys__c (After insert ) {
For (Amcor_Surveys__c ams : trigger.new){
If(ams.Q6_NeedAmcorToContactYou__c == 'Yes'){
System.debug('Creating event record');
//create an event record
Event ev = new Event();
ev.RecordTypeId='012g00000004ajF';//'Visit Report VOC';
ev.Type ='VOC';

ev.Ownerid = ams.Account_ID__r.Owner.Id;

ev.whoId =ams.Contact_ID__c;
ev.Subject ='VOC Survey - Contact customer' ;
ev.objective__c = 'Improve Relationship';
//System.debug('************ ' + system.today().format());
//System.debug('************ ' + system.today());Date startDate = system.today();
ev.ActivityDate = startDate;Date endDate = startDate.adddays(5);
ev.RecurrenceStartDateTime = Datetime.newInstanceGmt(startDate.year(), startDate.month(), startDate.day(), 0, 0, 0);
ev.RecurrenceEndDateOnly = endDate;
System.debug('Attempting to insert...');
try{
insert ev;
}
catch(Exception e)
{  
 System.debug(e.getMessage()); 
 }}}}

When I create a survey I get this error message on my survey form :
Error: Invalid Data.
Review all error messages below to correct your data.
Please select a value

And In my debug log : INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId]

I paste the result :

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
17:02:25.173 (173947493)|EXECUTION_STARTED
17:02:25.173 (173982146)|CODE_UNIT_STARTED|[EXTERNAL]|01qg00000008kvE|EventForCustomerToContact on Amcor_Surveys trigger event AfterInsert for [a0xg0000007OB0F]
17:02:25.175 (175163438)|SYSTEM_METHOD_ENTRY|[4]|LIST<Amcor_Surveys__c>.iterator()
17:02:25.175 (175345821)|SYSTEM_METHOD_EXIT|[4]|LIST<Amcor_Surveys__c>.iterator()
17:02:25.175 (175384554)|SYSTEM_METHOD_ENTRY|[4]|system.ListIterator.hasNext()
17:02:25.175 (175420796)|SYSTEM_METHOD_EXIT|[4]|system.ListIterator.hasNext()
17:02:25.175 (175550722)|SYSTEM_METHOD_ENTRY|[9]|System.debug(ANY)
17:02:25.175 (175578523)|USER_DEBUG|[9]|DEBUG|Creating event record
17:02:25.175 (175586115)|SYSTEM_METHOD_EXIT|[9]|System.debug(ANY)
17:02:25.178 (178295195)|SYSTEM_METHOD_ENTRY|[23]|System.today()
17:02:25.178 (178331688)|SYSTEM_METHOD_EXIT|[23]|System.today()
17:02:25.178 (178403191)|SYSTEM_METHOD_ENTRY|[27]|com.salesforce.api.interop.apex.bcl.DateMethods.addDays(Integer)
17:02:25.178 (178448078)|SYSTEM_METHOD_EXIT|[27]|com.salesforce.api.interop.apex.bcl.DateMethods.addDays(Integer)
17:02:25.178 (178465076)|SYSTEM_METHOD_ENTRY|[29]|com.salesforce.api.interop.apex.bcl.DateMethods.year()
17:02:25.178 (178487761)|SYSTEM_METHOD_EXIT|[29]|com.salesforce.api.interop.apex.bcl.DateMethods.year()
17:02:25.178 (178500453)|SYSTEM_METHOD_ENTRY|[29]|com.salesforce.api.interop.apex.bcl.DateMethods.month()
17:02:25.178 (178512317)|SYSTEM_METHOD_EXIT|[29]|com.salesforce.api.interop.apex.bcl.DateMethods.month()
17:02:25.178 (178523198)|SYSTEM_METHOD_ENTRY|[29]|com.salesforce.api.interop.apex.bcl.DateMethods.day()
17:02:25.178 (178539286)|SYSTEM_METHOD_EXIT|[29]|com.salesforce.api.interop.apex.bcl.DateMethods.day()
17:02:25.178 (178564852)|SYSTEM_METHOD_ENTRY|[29]|com.salesforce.api.interop.apex.bcl.DatetimeMethods.newInstanceGmt(Integer, Integer, Integer, Integer, Integer, Integer)
17:02:25.178 (178595978)|SYSTEM_METHOD_EXIT|[29]|com.salesforce.api.interop.apex.bcl.DatetimeMethods.newInstanceGmt(Integer, Integer, Integer, Integer, Integer, Integer)
17:02:25.178 (178665508)|SYSTEM_METHOD_ENTRY|[32]|System.debug(ANY)
17:02:25.178 (178687579)|USER_DEBUG|[32]|DEBUG|Attempting to insert...
17:02:25.178 (178694695)|SYSTEM_METHOD_EXIT|[32]|System.debug(ANY)
17:02:25.178 (178749289)|DML_BEGIN|[35]|Op:Insert|Type:Event|Rows:1
17:02:25.183 (183792416)|DML_END|[35]
17:02:25.183 (183935547)|EXCEPTION_THROWN|[35]|System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId]
17:02:25.185 (185534938)|SYSTEM_METHOD_ENTRY|[41]|System.DmlException.getMessage()
17:02:25.185 (185575133)|SYSTEM_METHOD_EXIT|[41]|System.DmlException.getMessage()
17:02:25.185 (185587600)|SYSTEM_METHOD_ENTRY|[41]|System.debug(ANY)
17:02:25.185 (185595912)|USER_DEBUG|[41]|DEBUG|Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId]
17:02:25.185 (185602578)|SYSTEM_METHOD_EXIT|[41]|System.debug(ANY)
17:02:25.185 (185616339)|SYSTEM_METHOD_ENTRY|[4]|system.ListIterator.hasNext()
17:02:25.185 (185631370)|SYSTEM_METHOD_EXIT|[4]|system.ListIterator.hasNext()
17:02:25.729 (185664470)|CUMULATIVE_LIMIT_USAGE
17:02:25.729|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 1 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 10
  Number of Mobile Apex push calls: 0 out of 10


Thanks!!

Hello All,

I know we can upload a CSV into Salesforce using various different ways. I'm conducting a POC in my company to upload a CSV file into Salesforce using a JAVA program. Can someone please guide or provide any reference links? 

Thanks, 
Shri

I have an apex column as below

<apex:column value="on {!wrkf.Last_Updated_Date__c} by  {!wrkf.Last_Updated_By__c}" />

But I want to print when     !wrkf.Last_Updated_Date__c != null    otherwise I want tp print nothing. Please help me


eg1..      On 23/01/2014 by John
eg2       (Nothing to be printed)
 Hi all ,

I'm writing a test class for a controller, And test class is like this.. 
Please note that hard coding values isn't good at all, but i'll change it later, this is just for the time being..

    myType__c  Obj= new myType__c();
          Obj.Name='Test  Object';
          Obj.ST_Ref__c='a2Ne0000000JAUo';
          Obj.A_Ref__c='001e000000HPgd1';
          insert Obj;

system.debug('Test SO area '+Obj.Service_Offering_Ref__r.id);   ----------------> But still this is null :(

In my controller class i've a code like

   String SOID=Obj.ST_Ref__r.id; and i do pass this SOID to a query

Currently query doesn't give any result , because SOID is null
But i've assigned 
Obj.ST_Ref__c='a2Ne0000000JAUo';

Whats wrong with this??

Please help me, Thanks a lot

To achieve this i am using two for loops which is a bad approch. can any one suggest me a better approch than this.

for example: if i compare slot[10] and slot[11] and i remove slot[11], i also have to compare slot[10] and slot[12] which is not happening in below code without  using extra for loop.

T
for(integer j=0;j<=repsid.size();j++)
    { 
    for(integer i=0;i<=slots.size()-2;i++)
    {
        if(slots[i].StartDateTime==slots[i+1].StartDateTime) 
        {
            if(slots[i].NumberofEvents==slots[i+1].NumberofEvents && slots[i].distance==slots[i+1].distance)
            {
                slots.remove(i+1);
            }
            else
            {
                if(slots[i].NumberofEvents==slots[i+1].NumberofEvents && slots[i].distance!=slots[i+1].distance && apptmin != 90)
                {
                    if(slots[i].distance<slots[i+1].distance)
                    {
                        slots.remove(i+1);                  
                    }
                    else
                    {
                        slots.remove(i); 
                    }
                }
                else
                {
                    if((slots[i].NumberofEvents!=slots[i+1].NumberofEvents && slots[i].distance>10 && slots[i+1].distance>10) || slots[i].NumberofEvents!=slots[i+1].NumberofEvents && apptmin==90)
                    {
                        if(slots[i].NumberofEvents<slots[i+1].NumberofEvents)
                        {
                            slots.remove(i+1);
                        }
                        else
                        {
                            slots.remove(i);
                        }
                    }
                    else
                    {
                        if(slots[i].distance < slots[i+1].distance)
                        {
                            slots.remove(i+1);
                        }
                        else
                        {
                            slots.remove(i);

                        }
                    }
                }
            }
        }
        }
    }

hanks for your help.
Hi all,

I've a custom controller and it has a code like this
I need to write a test class for this controller class but i'm stuck, please help me


public class myController{

...variables...

public myController(ApexPages.StandardController stdController) {

this.VR= (Vendor_Registration__c)stdController.getRecord();
this.section=getSection();

}

/*get section */

public String getSection(){

myObjectVR VRObj=My_CommonClass.getCurrentData(VR.id); --> which gives an error coz i don't know how to send a VR.id to My_CommonClass.getCurrentData method..


}
Suppose I have Object Parent1 and Child1. Child1 is having lookup to Parent1.
Parent1 is having Standard Page Layout (Not Visualforce). Now, I want that whenever the user click on Save, with creating new Record of Parent1 it should also create new Record for Child1.

By default it will create record of Parent1 only. But with Parent1 I also want 1 record of Child1 to be created.

I don't want to convert whole Page to Visualforce Page.

What will be the best way to achieve this?
Is Trigger is the best way?
What are the other ways?

For NEW button we can goto Visualforce page which can forward you to standard page but for SAVE this thing we cannot do? Like when we click on Save it will save record and goto one Visualforce Page which will do it's processing then return back to Created Record or any default Page.

We cannot provide functionality in Standard Page Layout only? By Declarative approach or anything?
I have done integration using SOAP API, from on SF org to another Org. I have coded one class in first Org1 to insert opportunity record as follows.
  //Webservices SFDC to SFDC
global class WsdlOpportunityCls{
  webService static void InsertOptRecord(String name,String Description){
    Opportunity op = new Opportunity();
    op.name = Name;
    op.Description= Description;
    op.StageName = 'Qualification';
    op.CloseDate = Date.today();
   
    insert op; 
 
  }

}

I have generated wsdl file for this class and partner wsdl of this org.

And I have parsed these two wsdls in another org to integrate. I successfully inserted records into Org2 when I try to insert records from Org2 thru SOAP API.

Below class to invoke the webservice method of above class.

public class Source_Opportuinity_Class{
  @future(callout = true)
  public static void Source_Invoke_Opt_Method(List<Id> listId){
 
     List<Opportunity> oppRec = new List<Opportunity>();
     oppRec = [Select Name, Description, Account.Name from Opportunity where Id IN : listId];
   
     Source_Partner_Cls3.Soap obj1 = new Source_Partner_Cls3.Soap();
     Source_Partner_Cls3.LoginResult lres = obj1.login( 'balakrishna.mandula@birlasoft.com', 'Jason123@vXoMT8HKsuG25xVuQDK4msfc');
    
     Target_Oppty_WSDL.WsdlOpportunityCls obj = new Target_Oppty_WSDL.WsdlOpportunityCls();
     obj.sessionHeader = new Target_Oppty_WSDL.sessionHeader_element();
     obj.sessionHeader.sessionId = lres.sessionId;
    
    // for( Opportunity oppt : oppRec){
      // obj.InsertOptRecord ( oppt.Name, oppt.Description);
    // }         
   
    for(opportunity opt :oppRec ) {
      obj.InsertOptRecord(opt.name, opt.description);
    }
   
         
 
  }
}

Trigger to invoke Source_Opportuinity_Class

trigger Oppt_to_Invoke_toIntegrate on Opportunity (after insert, after update) {
   List<id> listid = new List<Id>();
   for(Opportunity oppt : Trigger.new){
      listId.add(oppt.id);
   }
   Source_Opportuinity_Class.Source_Invoke_Opt_Method(listid);

}

When I try to create records in Org2 those records are being loaded into Org1 using SOAP API.

My requirement is to use Bulk API to load large amount of data.

Please help me how to do Bulk API?

Regards,
Balakrishna

Below is skipping the if  and else if condition line 25 and 29. and updating the zero records. any help will be much appriciated?

Note::Product_Subscriptions__c is a multi pick list field
  1. global class BatchAccountProductSubscriptions implements Database.Batchable<sobject>, Database.Stateful
  2. {
  3.     public String query;
  4.     global String error;
  5.     global database.queryLocator start(Database.BatchableContext BC)
  6.     {       String query = 'select AccountId, Id, Product_Family__c FROM Asset where Product_Family__c!=null limit 200';
  7.             return database.getQueryLocator(query);
  8.     }
  9.    
  10.     global void execute(Database.BatchableContext BC, List<sObject> scope)
  11.     {
  12.         List<asset> assetList =(List<Asset>)scope; 
  13.         set<id>acIDs=new set<Id>();
  14.         Map<Id,Set<String>> actPsubs = new Map<Id,Set<String>>();
  15.         Map<id,string> accProdFamily = new Map<id,string>();
  16.         Map<id,Asset> aidAssetMap = new Map<id,Asset>();
  17.         List<Account> updateAccountList = new List<Account>();
  18.         boolean isUpdate = false;
  19.         try
  20.         {   System.Debug('assetList ****'+assetList);
  21.             for(Asset a :assetList){aidAssetMap.put(a.AccountId,a);}
  22.             list<Account> act =[select Id, Product_Subscriptions__c FROM account where id in:aidAssetMap.keyset()];
  23.             for(Account ac:act){
  24.             string prodstring ='';
  25.             if(!ac.Product_Subscriptions__c.contains(aidAssetMap.get(ac.id).Product_Family__c) && (ac.Product_Subscriptions__c<>''|| ac.Product_Subscriptions__c!=null ))
  26.            {   System.Debug('Product_Subscriptions__c Match not Found ');
  27.                 prodstring=ac.Product_Subscriptions__c+';'+aidAssetMap.get(ac.id).Product_Family__c;
  28.             }
  29.             else if(!ac.Product_Subscriptions__c.contains(aidAssetMap.get(ac.id).Product_Family__c) && (ac.Product_Subscriptions__c=='' || ac.Product_Subscriptions__c==null))
  30.             {   System.Debug('Product_Subscriptions__c Match Found ');
  31.                 prodstring=aidAssetMap.get(ac.id).Product_Family__c;
  32.             }
  33.             updateAccountList.add(new Account(Id = ac.id, Product_Subscriptions__c = prodstring));
  34.             }
  35.              System.Debug('updateAccountList ****'+updateAccountList);
  36.             if(updateAccountList.size() != 0){
  37.                Database.SaveResult[] srList = Database.update(updateAccountList, false);
  38.                         for(Database.SaveResult sr : srList)
  39.                         {
  40.                             for(Database.Error e : sr.getErrors())
  41.                             error += '\n ' + e.getMessage();
  42.                         }
  43.                     }
  44.             }
  45.         catch(Exception e)
  46.         {
  47.             error += e.getMessage();
  48.         }
  49.     }
  50.     global void finish(Database.BatchableContext BC)
  51.     {
  52.         AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email from AsyncApexJob where Id =: BC.getJobId()];
  53.         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
  54.         String[] toEmailAddresses = new String[] {'XXXXXXXXXXXXXXXXXXXXX'};
  55.         mail.setToAddresses(toEmailAddresses);
  56.         mail.setSubject('BatchJob Status' + a.Status);
  57.         mail.setHTMLBody
  58.         ('Total No of Batch Apex job processed ' + a.TotalJobItems +
  59.         ' batches with '+ a.NumberOfErrors + ' failures.');
  60.         Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
  61.     }
  62. }
I have to do something like this:

Object__c obj;    //Initiated in Constructor
List<String> fieldNames=new List<String>{'Field1__c, Field2__c, Field3__c};

for (String str: fieldNames) {
obj.<str>=null
}
update obj;

So, it will be obj.Field1__c=null; obj.Field2__c=null ...

Can we do this in Salesforce Apex?
Hi all,

global class ContactsGeoLocationBatch implements Database.Batchable<Sobject>, Database.AllowsCallouts{

    global Database.QueryLocator start(database.batchablecontext BC){
           String Query =  'Select id, LastName,Latitude__c,Longitude__c from Contact where Primary_City__c!=null and Primary_Country__c!=null and Primary_State__c!=null and LastModifiedDate>=LAST_N_DAYS:8 order by LastmodifiedDate DESC Limit 2';     
       return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, List<Contact> scope){
    for(Contact c : scope){
        if(c.id!=null)
            ContactsGeoLocationBulk.getGeoLocation(c.Id);
    }   
}  

global void finish(Database.BatchableContext BC){
//unable to get the code coverage for the below
   if(BC.getJobId()!=null)
   {
   AsyncApexJob a = [SELECT Id, Status, NumberOfErrors, JobItemsProcessed,
      TotalJobItems, CreatedBy.Email
      FROM AsyncApexJob WHERE Id =
      :BC.getJobId()];*/
       if(a!=null)
       {
   // Send an email to the Apex job's submitter notifying of job completion.
   Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
   String[] toAddresses = new String[] {'XXXXXXXX@gmail.com'};//a.CreatedBy.Email
   mail.setToAddresses(toAddresses);
   mail.setSubject('Apex process has completed'+ a.Status);
   // # records were updated.
   mail.setHtmlBody('Hi,<br><br>Geocodes have been updated for all contact records modified within the last 7 days on Salesforce.com. ' + a.TotalJobItems +' records were updated.there are '+ a.NumberOfErrors + ' failures.<br><br>Thanks,<br>Ramesh.');
  Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
   }
   }
}
}

@isTest(SeeAllData = true) 
private class ContactsGeoLocationBatch_TC{
    @isTest static void testContactsGeoLocationBatch() {
      
    Test.startTest();
        Test.setMock(HttpCalloutMock.class, new ContactsMockHttpResponseGenerator_TC());          
        Database.QueryLocator QL;
        Database.BatchableContext BC;    
        List<Contact> Conlist=[Select id, LastName,Latitude__c,Longitude__c from Contact where Primary_City__c!=null 
                               and Primary_Country__c!=null and Primary_State__c!=null and LastModifiedDate>=LAST_N_DAYS:8
                               order by LastmodifiedDate DESC Limit 1];
        ContactsGeoLocationBatch c = new ContactsGeoLocationBatch();
        QL = c.start(BC);
        c.execute(BC,Conlist);
        c.finish(BC);
    Test.stopTest();
    }
}

thanks,
Ramesh
Hi,

I would like to know if there is any  way  to pass values to another VF page  other than  passing it from Query String parameters?

If we want to pass a list of records then passing each field through query string parameters won't be a right way

Thanks,
Neha Patil
trigger updateday on case_obj__c (before insert){
for(case_obj__c a :trigger.new)
{
Date dt = a.case_dt__c;
String dayOfWeek=dt.format('EEEE');
a.day__c=dayOfWeek;
}
}
I tried this code but i am gethhing this error:Error: Compile Error: Method does not exist or incorrect signature: [Date].format(String)
whats is the problem?
Dears,

In summer 14, we have a new feature to add a VF page to the Home page, and this is nice feature.

But in case in the VF page you are adding contains  a grid  and some of these fields are relations to other object.

once the cursor pass on this field you will be able to see the popup(mini page layout) but inside an iframe ,and this will cause that data will not appear correctly.

Thank you in advance,
 
I tried updated the Secuity code for the account.  We are binding to "https://www.salesforce.com/services/Soap/u/25.0" that has not changed.  We are using TLS 1.2 or 1.1 ..  The password and account name is correct.  What else could be wrong.  It literally happened after she changed the domain.  
 

Hello~

I want to update records after an email with csv attachment is recived. The attachement is passed in the function in UpdateAvailableCGUnite class through a trigger. The for loop does not iterate, and I don't know why. Also, 

public class UpdateAvailableCGUnit {

    /*
      public PageReference UpdateCG() {
        PageReference pageRef = new PageReference('/apex/UpdateAvailableCGUnit');
        return null;
    }


    public Blob csvFileBody{get;set;}
    public string csvAsString{get;set;}
    public String[] csvFileLines{get;set;}
    //public String[] notification{get;set;}
    public List<ECS__Supplier_Product__c> updatelist{get;set;}
   
    
    public UpdateAvailableCGUnit(){
        csvFileLines = new String[]{};
        updatelist = New List<ECS__Supplier_Product__c>();
    }
 */   
     
  public static void importCSVFile(Attachment a){
       
      	List<ECS__Supplier_Product__c> updatelist ;
      	List<ECS__Supplier_Product__c> unupdatelist ;
      
     if(a != null){ 	
      	Blob csvFileBody = a.body;
        string csvAsString = csvFileBody.toString();
        

        String[] csvFileLines = csvAsString.split('\n');
      	String[] SKU = new string[]{''};
     	integer count = csvFileLines.size();
      
      
      //Query existing CG SKU, Qty, and price to existingCG list
		List<ECS__Supplier_Product__c> existingCG = [SELECT Name, ECS__Available_Units__c, ECS__Supplier_SKU__c  FROM ECS__Supplier_Product__c];
        ECS__Supplier_Product__c supp = new ECS__Supplier_Product__c(); 
         
         
      //map csv col. and add to updatelist 
        system.debug(count);
      	
      	for(Integer i=1; i<count; i++){
			system.debug(count);
            string[] csvRecordData = csvFileLines[i].split(',');
            supp.ECS__Supplier_SKU__c = csvRecordData[0];
      		supp.ECS__Available_Units__c = Integer.valueOf(csvRecordData[1].trim());
            
            if(existingCG[i].ECS__Supplier_SKU__c == csvRecordData[0]){
                updatelist.add(supp);
            }
            else{
                unupdatelist.add(supp);
            }
             system.debug(unupdatelist);
      		 system.debug(updatelist);
   			
          }
     
      }
    	
      try{
      	update updatelist;
      }
      catch(Exception e){
      	system.debug(e);
      }
	}
}

[45]|i|1
Then the loop is not looping and seems to go back to trigger and recalled the function again.

09:47:11:242 FATAL_ERROR System.NullPointerException: Attempt to de-reference a null object
User-added image

 

I am fetching a picture from an object and want to store in a apex variable , in which data type we can store that image and how ?
On my site page i have bind field using sboject field but my some fields(lookup, picklist) are not visible on site page. On site page profield i have given object level permission of that object and field visibility checkbox is checkd of that field in field level security.

in visulaforce page i have used like that 

<apex:inputField value="{!map_sobj[Rec.Id][Rec.Field_API_Name__c]}" rendered="{!Rec.Question_Type__c == 'Lookup'}" />

can anyonehelp me why field are not visible on site page.

 
I have 83% of test coverage when I run 'run All' test. But when I try to upload a pckage from same org it failes saying 73%. What could be the possible reason of this fall of 10%

Regards
Gaurav
My question, I have the following objects that I’m trying to query on and get the results.

Request__c ,Request_item__c have a master detail relation and Catalog_item__c has a look up to the Request_item__c.

The query below  would run just fine if I pass a request ID value in developer console.

I have a VF page that would render the output with an id again.

However when placed this in a class constructor and give it the ID from trigger.new it would fail to retrieve any rows.

Any help in this regard is appreciated.

select Name,Request__r.Name,
             Request__r.Contact__c,
            Request__r.Lead__c,
             Catalog_item__r.Name,
             Request__r.Request_Details_rtf__c,
             quantity__c,
             Catalog_item__r.cost_center__c,
             Catalog_item__r.sizeoptions__c,
             request__r.Send_to_Company__c,
             request__r.Send_to_Contact__c,
             request__r.Request_Shipping_Street__c,
             request__r.Request_Shipping_City__c,
             request__r.Request_Shipping_State__c,
             request__r.Request_Shipping_Postal_Code__c,
             request__r.Request_Shipping_Country__c,
             request__r.Phone__c
             from request_item__c where Request__r.Id=:reqId1
Hi,
I developed the following code in Winter 14 (sandbox) and it works correctly.
But when I deployed it to Summer 14 (production environment), I could not update the "Status__c" data.
Please help me to resolve this issue...

********** Visualforce Code************

<apex:form id="theForm">
    <apex:pageblock id="theBlock" tabstyle="Bulk_Edit__tab" mode="maindetail">
        <!-- ============================== -->
        <!-- Command Buttons                -->
        <!-- ============================== -->
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Edit" action="{!editBulk}" rendered="{!!isBulkEdit}"/>
            <apex:commandButton value="Save" action="{!saveBulk}" rendered="{!isBulkEdit}"/>
            <apex:commandButton value="Cancel" action="{!cancelBulk}" rendered="{!isBulkEdit}"/>
        </apex:pageBlockButtons>
        <apex:outputPanel >
            <apex:inputHidden value="{!tableHeight}" id="tableHeight" />
        </apex:outputPanel>
              
        <apex:outputPanel layout="block" id="refTablePanel" style="width:100%">
            <apex:outputPanel >
                <div class="hideCurrDate">
                <div id="listTableDiv" class="superTablesDiv" style="width:1500px; height:{!tableHeight}px;">
                    <table id="listTable" width="95%">
                    <!--======================-->
                    <!-- HEADER                               -->
                    <!--======================-->                       
                        <tr>
                            <!--★Column1-->
                            <th><span style="width:70px; overflow: hidden; white-space: nowrap; text-overflow: string; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; display:block; ">
                                <apex:outputText value="Column1"/>
                                </span>
                            </th>
                            <!--★Column2-->
                            <th><span style="width:70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; display:block;">
                                <apex:outputText value="Column2"/>     
                                </span>
                            </th>
                            <!--★Status-->
                            <th><span style="width:600px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; display:block;">
                                <apex:outputText value="Status"/>     
                                </span>
                            </th>
                        </tr>
                   <!--======================-->
                   <!-- DATA                                    -->
                   <!--======================-->
                        <apex:repeat value="{!reportItemList}" var="objItem">
                            <apex:variable value="{!1}" var="rowNum"/>
                            <apex:repeat value="{!objItem.itemData}" var="i" >
                                <tr onmouseover="mover(this);"  onmouseout="mout(this);">
                                    <!--★Column1-->
                                    <td class="{!if(rowNum==1,'show','hidden')}" rowspan="{!objItem.itemData.size}">
                                        <span style="white-space: normal; overflow:hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; word-wrap:break-word; display:block;">
                                            <apex:outputField value="{!objItem.mer.name}" rendered="{!if(rowNum==1,true,false)}"/>
                                        </span>
                                    </td>
                                   
                                    <!--★Column2-->
                                    <td><span style="overflow: hidden; white-space: normal; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; word-wrap:break-word; display:block;">
                                        <apex:outputField value="{!i.Column2__c}"/>
                                        </span>
                                    </td>
                                  
                                    <!--★Status-->
                                    <td class="{!if(rowNum==1,'show','hidden')}" rowspan="{!objItem.itemData.size}">
                                        <span style="overflow: hidden; white-space: normal; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; word-wrap:break-word; display:block;">
                                            <apex:outputField value="{!objItem.mer.Status__c}" rendered="{!if(rowNum==1,true,false)&&!isBulkEdit}"/>
                                            <apex:inputField value="{!objItem.mer.Status__c}" rendered="{!if(rowNum==1,true,false)&&isBulkEdit}" style="width:90%;"/>
                                        </span>
                                    </td>
                                </tr>
                                <apex:variable var="rowNum" value="{!rowNum + 1}"/>
                            </apex:repeat>
                        </apex:repeat>
                    </table>
                </div>
                </div>
            </apex:outputPanel>
        </apex:outputPanel>
   </apex:pageBlock>
</apex:form>


********** Apex Class Code************

public class MER_Bulk_Ext {
    //==========================================================
    // Public Fields
    //==========================================================
    public List<ReportItem> reportItemList{get; set;}
    public Boolean isBulkEdit{get; set;}
    public Integer tableHeight {get; set;}
    //==========================================================
    // Private Fields
    //==========================================================
    //Property for Paging
    @TestVisible private ApexPages.StandardSetController stdSetCntrl {get;set;}
    private Integer totalId;
   
    //================================================================
    // Constructor
    //================================================================
    public MER_Bulk_Ext(ApexPages.StandardController controller) {

        List<MER__c> merList = new List<MER__c>();
            merList = [SELECT m.name,
                         m.Status__c,
                         (SELECT i.Column2__c
                            FROM MER_Itemized_Status__r i) itemData
                     FROM MER__c m
                 ORDER BY m.name
                 ];
           
        for(MER__c m: merList){
            ReportItem objItem = new ReportItem();
            objItem.mer = m;
            objItem.itemData = m.MER_Itemized_Status__r;
        }

        this.stdSetCntrl = new ApexPages.StandardSetController(merList);
        this.stdSetCntrl.setPageSize(100);
        this.reportItemList = this.generateMERList();
        this.tableHeight =615;
    }
  
    // Inner Class Definition
    public Class ReportItem {
        public MER__c mer {get; set;}
        public List<MER_Itemized_Status__c> itemData {get; set;}
    }
   
    //---------------------------------------------------------------
    // [save] Button in Page[MER_BulkEdit]
    //---------------------------------------------------------------
    public PageReference saveBulk(){
        List<MER__c> updateMer = new List<MER__c>();
        List<MER_Itemized_Status__c> updateItem = new List<MER_Itemized_Status__c>();
        for (ReportItem mer : this.reportItemList) {
            updateMer.add(mer.mer);
            for(MER_Itemized_Status__c i:mer.mer.MER_Itemized_Status__r){
                updateItem.add(i);
            }
        }
        try {
            if (updateMer.size() > 0) {
                update updateMer;
                ★I can not get the input data from VF. Status__c is not updated.★
            }
            if (updateItem.size() > 0) {
                update updateItem;
            }
        } catch (DMLException e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getDMLMessage(0)));
            return null;
        }
        isBulkEdit=false;
        PageReference pgr = Page.MER_BulkEdit;
        pgr.setRedirect(true);
        return pgr;
    }
   
    //---------------------------------------------------------------
    // [Edit] Button in Page[MER_BulkEdit]
    //---------------------------------------------------------------
    public PageReference editBulk(){
        PageReference pgr = new PageReference('/apex/MER_BulkEdit');
        isBulkEdit=true;
        return pgr;
    }
   
    //---------------------------------------------------------------
    // [Cancel] Button in Page[MER_BulkEdit]
    //---------------------------------------------------------------
    public PageReference cancelBulk(){
        PageReference pgr = new PageReference('/apex/MER_BulkEdit');
        isBulkEdit=false;
        return pgr;
    }
   

   
    //==========================================================
    // Private Method
    //==========================================================
    public List <ReportItem> generateMERList() {
        List<ReportItem> customList = new List<ReportItem>();
       
        for (MER__c mer : (List<MER__c>)this.stdSetCntrl.getRecords()) {
            ReportItem merItem = new ReportItem();
            merItem.mer = mer;
            merItem.itemData = mer.MER_Itemized_Status__r;
            customList.add(merItem);
        }
        return customList;
    }
}
************************************************************************:
Thank you in advance for your help!
I have created a picklist having value "none,Yes,NO".i want use this in my visualforce page for pdf formate like 


if picklist is "none and No", its false means not display in my pdf
if yes it will be display in pdf

i have written visulaforce page 

<table>
   <apex:outputPanel rendered="{!IF(Quote__c.Substrate_Details__c==null, Quote__c.Substrate_Details__c== No,false,true)}">
  <colgroup width="300"> <tr>
   <td><b>Substrate Details</b></td> <td>:{!Quote__c.Substrate_Details__c} </td>
  </tr>
 but its throwing error like 'standardcontroller.No' not exist

is there any solution
I have a Visualforce page with a flow embedded. When the flow finishes I need to pass some flow variables into a new VF page.

When I do, I get the error:

"Invalid Page Redirection The page you attempted to access.....etc"
I've narrowed it down to fields that have spaces or symbols such as a plus sign
i.e phone number:
+49 894 5560519

I am using the function urlEncode, and it is encoding the url as such:
phone number-

PhoneFcmCustomers=%252B49%2B894%2B5560519

Works fine when it's not using special characters. :
        

Here is a section of the code:

PageReference prRef = new PageReference('/apex/NISUpdateAccountContact?');
string test = EncodingUtil.urlEncode(flowITDB_Please_provide_the_phone_number_FCm_customers,'UTF-8');
              prRef.getParameters().put('PhoneFcmCustomers',test);

prRef.setRedirect(false);
return prRef;

We are integrating with SFDC for our Australia Customer -  Innercircle Consulting  

 

We are facing the following issue in integration

 

Details given below

 

API:  Project_Milestones__c

 

Columns : Client_Acceptance_Rcv_d__c, Date_Accepted__c 

 

Issue Description: Not receiving the correct flag for client acceptance i.e even when the check box is ticked we are receiving false flag and date accepted though entered in coming as null for certain projects

 

Kindly help us in resolving this issue

 

Adderror method doesn't display error message, i tried the following Trigger.New[0].name.adderror('Duplicate entry found. There already exists an entry for the same Record. Please update the old one');