• Anu-SFDC
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 33
    Questions
  • 40
    Replies

Hi,

 

I have a strange problem..

 

I have a class where I'm inserting the records to an object from that class.

Lets say the object is Data__c..

 

I have all records in one list variable. Suppose i have 5 records in that list..

 

so., if i wrote

 insert data;(data is a list variable) all 5 records are inserted successfuly.. But I have a trigger on that object(before insert)..

 

For five records trigger is firing only once.. That trigger is firing only for the last record..

 

How to do an insert in which for all the records trigger will fire one by one..

 

Thanks

Anu

Hi,

 

 

Here is my part of code..

 

 

 schema.describefieldresult dfield;

Map <String, Schema.SObjectField> fieldMap = Schema.SObjectType.Opportunity.fields.getMap();
for(Schema.SObjectField sfield : fieldMap.Values()){
dfield = sfield.getDescribe();
Pair field = new Pair();
field.key = dfield.getname();
field.label = dfield.getLabel();
field.fieldname = dfield.getname();
field.val = dfield.getDefaultValueFormula();
fields.add(field.label);

if(field.fieldname== 'npe01__Contact_Id_for_Role__c'){
field.val =contactId;
opt.put(field.fieldname,field.val);
}
}

 

 

But, I got too many field describes..

 

Can any one help me out..

 

Thanks

Anu

Hi,

 

I have a field which is filled automatically from webservices..The values of the field is like this.. First line of the field  shows the header of the excel and next lines are the corresponding table row values.

 

I want to read the info from this field and need to display it in a table in visualforce page.. I'm new to apex...

 

Can any one help me?

 

 

 

 

"CnPAID","sfContactID","FirstName","Lastname","Email","PaymentFor","NameOnCard","CreditCardNumber","Cvv","ExpirationDate","Amount","Periodicity","Installment#","FirstpaymentDate","RoutingNumber","AccountNumber","AccountType","CheckType","CheckNumber","VaultGUID","CampaignTracker","Tracker","Result","OrderNumber"
"6943","003E0000009YNsx","radha1","testmail","radha1@testmail987.com","Payment 1","John Smith","xxx...1111","123","12/14","10.01","Momtly","10","01/01/2012",,,,,,,"campagin","Tracker","Transaction processed sucessfully","1211033521724111"
"6943",,"radha1","testmail","radha1@testmail987.com","Donation 2","Ali Mashhod","xxx...1111","654","12/14","2.14","2 weeks","14","01/06/2012",,,,,,,,,"Transaction processed sucessfully","1211033525794111"
"6943","003E0000009YNsx","radha1","testmail","radha1@testmail987.com","Payment 3","Paul Robertson",,,,"51",,,,"123456789","987654321","Saving","Personal","852741963",,,,"Transaction declined","Internal error occured - "
"6943",,"radha1","testmail","radha1@testmail987.com","Payment 4","David","xxx...1111","654","12/14","32",,,,,,,,,,,,"Transaction processed sucessfully","1211033532554111"
"6943","003E0000009YNsx","radha1","testmail","radha1@testmail987.com","Payment 5","David",,,,"32",,,,,,,,,,"Campagin","Tracker","Payment method does not specified.",""

Hi

 

Here is my code.

 

 

  list<Contact> ContactMap1=[Select Id,Email from Contact where Email IN :EmailSet1];
       for(Contact k:ContactMap1){
          Map_Contact_To_Id.put(k.Email,k.Id);
        }
      list<Campaign> theCampaign = [SELECT Id, Name FROM Campaign WHERE Name IN :CampaignList OR Id IN :SfCampaignList];
      
      for (Campaign k:theCampaign) {
       Map_CampaignName_To_Id.put(k.Name,k.Id);
       Map_CampaignId_To_Id.put(k.Id,k.Id);
      }

      for (CnP_Transaction__c c : Trigger.new) {
      if(c.sf_Campaign__c == null)
          c.sf_Campaign__c=Map_CampaignName_To_Id.get(c.Campaign__c);
      }
 
      list<CampaignMember> ListMemebers=new list<CampaignMember>();
           CampaignMember CreateMem=new CampaignMember();

    for (CnP_Transaction__c c : Trigger.new) {
    
     campMembers(c.sf_Campaign__c);
     if((c.sf_Campaign__c!=null || c.Campaign__c!= null)&&Map_CamId_ConId.get(c.sf_Campaign__c)!=c.Contact__c){
        CreateMem = new CampaignMember(Campaignid=Map_CampaignId_To_Id.get(c.sf_Campaign__c), Contactid=c.Contact__c, Status='Received');
          Map_CamId_ConId.put(Map_CampaignId_To_Id.get(c.sf_Campaign__c),Map_Contact_To_Id.get(c.Email__c));
          ListMemebers.add(CreateMem);
     }
    }

     if(ListMemebers.size()>0){
       insert ListMemebers;       
       }
 
       public void campMembers(String CampaignId1){
 
 List<CampaignMember> campmem = [select contact.Email,Campaignid,Contactid from CampaignMember where CampaignId!=null];       
         for(CampaignMember cm :campmem){
         if(cm.CampaignId == CampaignId1)
            Map_CamId_ConId.put(cm.ContactId,cm.CampaignId);

         }

 

        

 

One of my client getting the following error because of my code:

 

Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CnP_PaaS.addCorresCont: execution of BeforeInsert

caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows)

 

Consider an index filter.

 

My doubt is they are getting the error because of that query(which is in bold).

 

How can I solve that??

 

Please help

 

Thanks

Anu

Hi

 

I have this page.

<apex:pageBlockTable value="{!Results}" var="transaction" rendered="{!resultvalue}">

<apex:inputhidden value="{!transaction.tranId}" id="transactid" />

  <apex:column headerValue="Date Last Used" value="{!transaction.tDate2}" />
    <apex:column headerValue="Last 4 digits" value="{!transaction.cardnum}"/>
    <apex:column headerValue="Expiration Date" value="{!transaction.cardexp}"/>
  <apex:column headerValue="Card Type" value="{!transaction.cardname}"/>
    <apex:column >
    <apex:commandLink action="{!Vterminal}" value="Virtual Terminal"  target="_self" styleClass="btn" >
               <apex:param name="para" value="{!transaction.tranId}" assignTo="{!para}"></apex:param>
               <apex:param name="expired" value="{!transaction.cardexp}" assignTo="{!expired}"></apex:param>                                             
     </apex:commandLink>
    </apex:column>
</apex:pageBlockTable>

 

 

Controller:

 

 

public PageReference Vterminal()
    {
           
   
    if(expired!=''){
    expmonth = Integer.valueOf(expired.substring(0,2));
    expyear = Integer.valueOf(expired.substring(3,7));
    expmonthdate = Date.newInstance(expyear, expmonth,31 );
    System.debug('expired monthdate valueeee'+para);
      p=new PageReference('/apex/VirtualTerminal?id='+para);
        return p;
        }

 

 

But When I click on the command Link of Virtual Terminal, I got the visualforce page but without header information., i mean tabs etc.

 

How can I get>?

Hi

 

I have a step in the code.

 

public String custom{get;set;}

 

public void GlobalController(){

 custom = ApexPages.currentPage().getURL();

}

 

 

How to write the test coverage for this getURL()  method???

 

Thanks

Anu

Hi

 

I want to read the url parameters(which are unknown to me) in the constructor..

 

For example..: If i know the url parameter let's say &t i can read like this.

 

     amount = ApexPages.currentPage().getParameters().get('t'));
        

But My requirement is i want to read all the parameters which are coming in url and i want to pass those values in to the URL of an iframe

 

Can anybody help me??

 

Thanks

Anu

Hi,

 

Our Company have two managed packages in appexchange listing..Let's suppose Pack-A, Pack-B.

 

Pack-B is dependant on Pack-A. Pack-A is the core basic package.

 

I want to release another package which is Reporting package.

 

Currently i have done the reporting service for Pack-A. But in this same pack of reporting service., I want to write the reporting service for Pack-B also.

 

Means, i need to do a managed package of reporting service which contains both packages reports., but users have a choice of accessing both..

 

Can anyone suggest me please.

 

Anu



Hi,

 

Our Company have two managed packages in appexchange listing..Let's suppose Pack-A, Pack-B.

 

Pack-B is dependant on Pack-A. Pack-A is the core basic package.

 

I want to release another package which is Reporting package.

 

Currently i have done the reporting service for Pack-A. But in this same pack of reporting service., I want to write the reporting service for Pack-B also.

 

Means, i need to do a managed package of reporting service which contains both packages reports., but users have a choice of accessing both..

 

Can anyone suggest me please.

 

Anu

Hi,

 

I have a problem with Person account fields.. I know we cannot associate person account fields with package.. So I wrote a general trigger regarding my project and I wrote another trigger for person accounts. My plan is to give the trigger to the users who wants to use person accounts along with my application..

 

But., I have faced one problem. In my general trigger i'm calling the xml field from data__c object. Through that xml tags I'm updating different objects., while inserting xml data into account object., I wrote another code for person accounts.

 

General trigger:

 


  for(CnPData__c cpdata:Trigger.new){
         dataxml=cpdata.DataXML__c;
         cpordnum = cpdata.OrderNumber__c;
   }

 

 XmlStreamReader reader= new XmlStreamReader(dataxml);

 

Contact con= parseContact(reader);


      contacts.add(con);

          Account a = new Account();
                a.Name = firstname+' '+lastname;
                a.BillingStreet = add2;
                a.BillingCity = city;
                a.BillingState= state;
                a.BillingCountry = country;
                a.BillingPostalCode= postalcode;
                a.ShippingStreet = shipadd2;
                a.ShippingCity = shipcity;
                      
                acc.add(a);     
                if(!acc.isEmpty()&&( xmlvalue[0].Accounts__c == true ||xmlvalue[0].Person_Accounts__c == true) ){

                insert acc;
                }

 

 

Contact parseContact(XmlStreamReader reader1){
 
     Contact contact = new Contact();

 

 while(reader1.hasNext()) {
       if ('Patron' == reader.getLocalName() && reader.getEventType() == XmlTag.END_ELEMENT) {
           break;
        }
        else if('BillingFirstName' == reader.getLocalName() && reader.getEventType() == XmlTag.START_ELEMENT){
          reader.next();                  
          if(reader.getEventType() == XmlTag.CHARACTERS) {
            contact.FirstName = reader.getText();
            firstname = contact.FirstName;
           }
        }
        else if('BillingLastName' == reader.getLocalName()&& reader.getEventType() == XmlTag.START_ELEMENT){
          reader.next();                  
          if(reader.getEventType() == XmlTag.CHARACTERS) {
            contact.LastName = reader.getText();
            lastname = contact.LastName;
           }
        } 

}

 

 

My Account Trigger:

 

 

for(Account a :Trigger.new){
     if(xmlvalue[0].Person_Accounts__c == true && !rt.isEmpty()){
                a.firstname = firstname;
                a.lastname = lastname;
                a.RecordTypeId =rt[0].Id;
               a.PersonEmail =email;
     }
  }   

 

 

If I give static values for firstname and lastname it is working.. But, how to give the values dynamically.,coming from the xml..

 

First general trigger works on CnPData__c before insert... second one works on Account after insert.

 

Thanks in Advance..

 

Anu

 



Hi

 

Here is my code and i'm new to sf test classes.

 

Can you help in covering the test coverage for this class?

 

public with sharing class SaveClass{
 private ApexPages.StandardController controller;
 public String retURL {get; set;}
 public String saveNewURL {get; set;}
 public String rType {get; set;}
 public String cancelURL {get; set;}
 public String ent {get; set;}
 public String confirmationToken {get; set;}
 Schema.RecordTypeInfo rtByName;
 public SaveClass() {}
 public SaveClass(ApexPages.StandardController controller) {
 
  this.controller = controller;
  rType = ApexPages.currentPage().getParameters().get('RecordType');
  RecordType rt = [select id,name from RecordType where id=:rType limit 1];
  Schema.DescribeSObjectResult d = Schema.SObjectType.CnP_Transaction__c; 
  Map<String,Schema.RecordTypeInfo> rtMapByName = d.getRecordTypeInfosByName();
  rtByName =  rtMapByName.get(rt.name);
  retURL = ApexPages.currentPage().getParameters().get('retURL');
  cancelURL = ApexPages.currentPage().getParameters().get('cancelURL');
  ent = ApexPages.currentPage().getParameters().get('ent');
  confirmationToken = ApexPages.currentPage().getParameters().get('_CONFIRMATIONTOKEN');
  saveNewURL = ApexPages.currentPage().getParameters().get('save_new_url');
 }
 
 public PageReference redirect(){
  PageReference returnURL;
  String rname = rtByName.getName();

  if(rname == 'Virtual Terminal') {
   returnURL = new PageReference('/apex/VirtualTerminal');
  }
  else if(rname == 'Manual Payment'){
 
   returnURL = new PageReference('/apex/transactionnew');
  }
  returnURL.getParameters().put('retURL', retURL);
  returnURL.getParameters().put('RecordType', rType);
  returnURL.getParameters().put('cancelURL', cancelURL);
  //returnURL.getParameters().put('ent', ent);
  //returnURL.getParameters().put('_CONFIRMATIONTOKEN', confirmationToken);
 // returnURL.getParameters().put('save_new_url', saveNewURL);
//  returnURL.getParameters().put('nooverride', '1');
  returnURL.setRedirect(true);
  return returnURL;
 }
 public PageReference cancel() {
          PageReference pr = new PageReference('/006/o');
          pr.setRedirect(true);
          return pr;
     }

}

Thanks

Anu

 

Hi, I have a managed package in my instance.. I have created a trigger in my sandbox instance.. But When I run the test classes it is showing too many scriot statements error.. Here is my code: trigger dateConvert on CnP__CnP_Transaction__c (before insert) { for(CnP__CnP_Transaction__c c:Trigger.new){ c.CnP__bSource__c = Integer.valueOf(c.CnP__bSource__c); if(c.CnP__bSource__c == 2 ){ String delimslash = '/'; String[] DDate; Datetime myDate; String tdate = c.Dummy_Field__c; if(tdate!=null){ String[] splitdate = tdate.split(' '); DDate = splitdate.get(0).split('/'); String TTime = splitdate.get(1); String month = DDate.get(0); String day = DDate.get(1); String year = DDate.get(2); String hour = TTime.split(':').get(0); String minute = TTime.split(':').get(1); String second = '00'; myDate = datetime.newInstance(integer.ValueOf(year),integer.ValueOf(month), integer.ValueOf(day), integer.ValueOf(hour), integer.ValueOf(minute), integer.ValueOf(second)); c.CnP__TransactionDate__c = myDate; c.CnP__TransactionTimeZone__c = myDate; } } } } Help me Regarding this. Anu

Hi

 

I want to parse the csv file with column names..

 

Here is my code.

 

public class Test_ReadExcel_Cls{

public string nameFile{get;set;}
string[] filelines=new String[]{};
public Blob contentFile{get;set;}

public Test_ReadExcel_Cls(){}

public Pagereference ReadFile(){

nameFile=contentFile.toString();
 filelines = nameFile.split('\n');

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

 

 

Here i am calling the values with integers like inputvalues[0], inputvalues[1] etc...

 

But I need to call them with Column names.. like name, address etc..

 

How can I?

 

Plz suggest me

 

Hi,

 

I have deployed a package.. For most of the users it is working fine.., but one of my customer having this problem

 

 

Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CnP.addCorresCont: 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)

 

 

Before the release it is working fine,.

 

Here is the code that i changed in this release..

 

 

 

  set<String> EmailSet1= new set<String>();
     set<String> CampaignList = new set<String>();
     set<String> SfCampaignList = new set<String>();
     map<String, String> CampaignMap = new map<String, String>();
     map<String, String> SfCampaignMap = new map<String, String>();
     map<String, Id> Map_Contact_To_Id = new map<String, Id>();
     map<String, ID> Map_CampaignName_To_Id = new map<String, ID>();
     map<Id,Id>  Map_CampaignId_To_Id = new map<Id,Id>();    
    
     for (CnP_Transaction__c c : Trigger.new) {
         CampaignList.add(c.Campaign__c);
         SfCampaignList.add(c.sf_Campaign__c);
         CampaignMap.put(c.Campaign__c,c.Campaign__c);
         SfCampaignMap.put(c.sf_Campaign__c,c.sf_Campaign__c);
         EmailSet1.add(c.Email__c);
     }
      list<Contact> ContactMap1=[Select Id,Email,npo02__Household__c from Contact where Email IN :EmailSet1];
       for(Contact k:ContactMap1){
          Map_Contact_To_Id.put(k.Email,k.Id);
        }
      list<Campaign> theCampaign = [SELECT Id, Name FROM Campaign WHERE Name IN :CampaignList OR Id IN :SfCampaignList];
     
      for (Campaign k:theCampaign) {
       Map_CampaignName_To_Id.put(k.Name,k.Id);
       Map_CampaignId_To_Id.put(k.Id,k.Id);
      }

      for (CnP_Transaction__c c : Trigger.new) {
      if(c.sf_Campaign__c == null)
          c.sf_Campaign__c=Map_CampaignName_To_Id.get(c.Campaign__c);
      }
      list<CampaignMember> CheckCamMem=[select contact.Email,Campaignid,Contactid from CampaignMember];
      Map<ID,ID> Map_CamId_ConId=new map<ID,ID>();
    
      for(CampaignMember m : CheckCamMem){
         Map_CamId_ConId.put(m.Campaignid,m.Contactid);
      }
      list<CampaignMember> ListMemebers=new list<CampaignMember>();
           CampaignMember CreateMem=new CampaignMember();
 
    for (CnP_Transaction__c c : Trigger.new) {
     if((c.sf_Campaign__c!=null || c.Campaign__c!= null)&&Map_CamId_ConId.get(c.sf_Campaign__c)!=c.Contact__c){
        CreateMem = new CampaignMember(Campaignid=Map_CampaignId_To_Id.get(c.sf_Campaign__c), Contactid=c.Contact__c, Status='Received');
          Map_CamId_ConId.put(Map_CampaignId_To_Id.get(c.sf_Campaign__c),Map_Contact_To_Id.get(c.Email__c));
          ListMemebers.add(CreateMem);
     }
    }

     if(ListMemebers.size()>0){
       insert ListMemebers;      
       }
    
  }

 

 

Plz help me

 

 

 

 

Hi I have a visualforce page which is only using custom controller... I want to add that page to VIEW link of my object.. For that I have written a redirect visualforce page in which in action function i redirect to my required page.. But when i click back button in the browser, it redirect to middle redirect page and coming back to same view page which i wrote custom controller. I need the back functionality in this case. Thanks in Advance Anu

Hi,

 

I have to add the contacts to campaign members..

 

Here is my code.

 

public PageReference camprollup(){

       list<CnP_Transaction__c> listtransactions = [selectName,Contact__c,sf_Campaign__c,Email__c,Donation_Name__c,Campaign__c  fromCnP_Transaction__c where sf_Campaign__c!=null OR Campaign__c!=null];

    for(CnP_Transaction__c lst : listtransactions){ 

      Map_Camp_To_Contact_Id.put(lst.Id, lst.sf_Campaign__c);   

    CampaignList.add(lst.sf_Campaign__c);

        EmailSet1.add(lst.Email__c);   

        OrdnumSet.add(lst.Id);   

       }   

try{ 

  if(!listtransactions.isEmpty()){ 

       list<Campaign> listcampaign     = [SELECT Id, Name FROM Campaign WHERE Id IN :CampaignList];           for(Campaign cn :listcampaign){   

         Map_Camp_Id.put(cn.Id, cn.Id);   

       }

         List<CampaignMember> campmem = [select contact.Email,Campaignid,Contactid from CampaignMember where CampaignId!=null and CampaignId = :CampaignList]; 

       for(CampaignMember cm :campmem){ 

          Map_CamId_ConId.put(cm.CampaignId,cm.ContactId); 

       }
       list<Contact> ContactMap1=[Select Id,Email,npo02__Household__c from Contact where Email IN :EmailSet1];       for(Contact k:ContactMap1){ 

        Map_Contact_To_Id.put(k.Email,k.Id);   

    }   

 CampaignMember CreateMem=new CampaignMember();  

   for(Integer i = 0;i<listtransactions.size();i++){ 

if(listtransactions[i].sf_Campaign__c!=null && Map_Contact_To_Id.get(listtransactions[i].Email__c)!=null && Map_CamId_ConId.get(Map_Camp_Id.get(listtransactions[i].sf_Campaign__c))!=Map_Contact_To_Id.get(listtransactions[i].Email__c)  ){


        CreateMem = new CampaignMember(Campaignid=Map_Camp_Id.get(listtransactions[i].sf_Campaign__c), Contactid=Map_Contact_To_Id.get(listtransactions[i].Email__c), Status='Received');         Map_CamId_ConId.put(Map_Camp_Id.get(listtransactions[i].sf_Campaign__c), Map_Contact_To_Id.get(listtransactions[i].Email__c));//listtransactions[i].Contact__c);             campmember.add(CreateMem); 
     } 
      }   

if(!campmember.isEmpty()){   

     insert campmember;   

   }

 

 

Here when I'm getting Duplicate value of an entity error..

 

Can any one of you plz help me on this plz...

 

 

Anu.

 

 

Hi

 

This is my visualforce page:

 

<apex:commandButton value="Save" action="{!Saveacc}"/>

<apex:pageblockTable value="{!fields}" var="fls">
        <apex:column value="{!fls.name}" headerValue="Label"/>
        <apex:column value="{!fls.key}" headerValue="Key"/>
        <apex:column >
         <apex:selectList value="{!selectedvalue}" size="1">
       <apex:selectOptions value="{!TagField}" id="fval" />

        </apex:selectList>

</apex:column>

</apex:pageblockTable>

 

This is my controller..

 

 

public PageReference Saveacc(){
System.debug('selected valueeeeeeeeeeee'+selectedvalue);
    Saveaccount();
    return null;
 
}

 

public SObject Saveaccount(){
    System.debug('field valueeeeeeee'+selectedvalue);
   
    List<Mandatory_Object__c> rec= new List<Mandatory_Object__c>();
    Set<string> MoNameSet=new Set<string>();
   
    for(Integer i=0; i<fields.size();i++){
        MoNameSet.add(fields[i].Name);
    }
    List<Mandatory_Object__c> insrec = [select Id,Name,Value__c,Type__c,Name__c from Mandatory_Object__c where Id!=null and Type__c =:selectedobject and Name__c = :MoNameSet];

     for(Integer i=0; i<fields.size();i++){
     Mandatory_Object__c mo = new Mandatory_Object__c();
     mo.Name__c=fields[i].name;
 
   // mo.Value__c =fields[i].val;
System.debug('field valueeeeeeee'+selectedvalue);
     mo.Value__c = selectedvalue;
     mo.Type__c = fields[i].ftype;
     rec.add(mo);
   }
   if(!rec.isEmpty()&&insrec.isEmpty()){
 insert rec;
 }
 else{
 
     update insrec;
   
 }

return null;
}

 

 

My show stopper is  I have several values in my picklist (selectedvalue).For example I have these 3 values in my picklist.

 

BillingFirstName

BillingLastName

BillingMI

 

But when ever i changed the value and trying to save the code i'm always getting first value(BillingFirstName) only.

 

 

I have geter and setter methods also for this variables.

 

 

How can I get the selected picklist values in selectedvalue attribute?

 

Anu.

Hi

 

I have an issue and dont know how to solve

 

I have xml files coming from external system. As far as xml is coming, it will update all the objects like account/contact/opportunities etc. through a trigger.

 

But my problem is the column names in the xml file is varied. so we have to map xml column names with salesforce.com field names..

 

I have an import functionality also in my system..

 

Can anybody suggest me how do I proceed?

 

Thanks

Anu

Hi

 

I have the following section in my xml..

 

 

 

<Patron>
<BillingInformation><BillingFirstName>john</BillingFirstName>
<BillingMI></BillingMI>
<BillingLastName>fulcher</BillingLastName>
<BillingEmail>vaboycc90@gmail.com</BillingEmail>
<BillingPhone>8669992542</BillingPhone>
</BillingInformation>
<BillingAddress><BillingAddress1>2200 Kraft Drive Ste 1175</BillingAddress1>
<BillingAddress2></BillingAddress2>
<BillingAddress3></BillingAddress3>
<BillingCity>Blacksburg</BillingCity>
<BillingStateProvince>Virginia</BillingStateProvince>
<BillingPostalCode>24060</BillingPostalCode>
<BillingCountryName>United States of America</BillingCountryName>
</BillingAddress>

</patron>

 

 

I want to get all the nodes of patron in picklist(select options)

 

 

Can anybody help me

Hi

 

I want to give the  default values for mandatory fields.. For example, I have sample__c field in account object in my instance, wehre another user has another field. I want to get those fields dynamically.

 

Plz look at my code:

 

public DefaultCont() { 

objectNames = initObjNames(); 

  fields = new List<Pair>();

  }

 

 

public void showFields() {//fields.clear();

Map <String, Schema.SObjectField> fieldMap = Schema.sObjectType.Account.fields.getMap();

for(Schema.SObjectField sfield : fieldMap.Values()){

   schema.describefieldresult dfield = sfield.getDescribe();

Pair field = new Pair(); 

  field.key = dfield.isNillable();

   field.name = dfield.getname();   // field.val= dfield.getValue();

    if(field.key == false && field.name !='Name' ){ 

     fields.add(field);    

     }   

}

}

public class Pair { 

  public Boolean key {get; set;} 

  public String val {get; set;}   

public String name {get; set;}   

public String label{get;set;}

}

public SObject Saveaccount(){  

rec= new Account();

System.debug('fieldsssss'+fields[0].val); 

   System.debug('fieldsssssname'+fields[0].name); 

   rec.CnP__Sample__c = fields[0].val;

        rec.Name = 'sample'; 

    rec.fields[0].name = fields[0].val;  

  insert rec;   

 return rec;

}
public PageReference Saveacc(){    Saveaccount();        return null;    }
}

 

See the bold lines.. Above that I can get two system.debug statements in that 

fieldsssssname is Sample__c..

 

But when I want to save this controller it shows the error like

 

Invalid field fields for SObject Account at line 63 column 6

 

 

Plz help me.

 

Anuradha

Hi

 

This is my visualforce page:

 

<apex:commandButton value="Save" action="{!Saveacc}"/>

<apex:pageblockTable value="{!fields}" var="fls">
        <apex:column value="{!fls.name}" headerValue="Label"/>
        <apex:column value="{!fls.key}" headerValue="Key"/>
        <apex:column >
         <apex:selectList value="{!selectedvalue}" size="1">
       <apex:selectOptions value="{!TagField}" id="fval" />

        </apex:selectList>

</apex:column>

</apex:pageblockTable>

 

This is my controller..

 

 

public PageReference Saveacc(){
System.debug('selected valueeeeeeeeeeee'+selectedvalue);
    Saveaccount();
    return null;
 
}

 

public SObject Saveaccount(){
    System.debug('field valueeeeeeee'+selectedvalue);
   
    List<Mandatory_Object__c> rec= new List<Mandatory_Object__c>();
    Set<string> MoNameSet=new Set<string>();
   
    for(Integer i=0; i<fields.size();i++){
        MoNameSet.add(fields[i].Name);
    }
    List<Mandatory_Object__c> insrec = [select Id,Name,Value__c,Type__c,Name__c from Mandatory_Object__c where Id!=null and Type__c =:selectedobject and Name__c = :MoNameSet];

     for(Integer i=0; i<fields.size();i++){
     Mandatory_Object__c mo = new Mandatory_Object__c();
     mo.Name__c=fields[i].name;
 
   // mo.Value__c =fields[i].val;
System.debug('field valueeeeeeee'+selectedvalue);
     mo.Value__c = selectedvalue;
     mo.Type__c = fields[i].ftype;
     rec.add(mo);
   }
   if(!rec.isEmpty()&&insrec.isEmpty()){
 insert rec;
 }
 else{
 
     update insrec;
   
 }

return null;
}

 

 

My show stopper is  I have several values in my picklist (selectedvalue).For example I have these 3 values in my picklist.

 

BillingFirstName

BillingLastName

BillingMI

 

But when ever i changed the value and trying to save the code i'm always getting first value(BillingFirstName) only.

 

 

I have geter and setter methods also for this variables.

 

 

How can I get the selected picklist values in selectedvalue attribute?

 

Anu.

Hi,

 

I have a strange problem..

 

I have a class where I'm inserting the records to an object from that class.

Lets say the object is Data__c..

 

I have all records in one list variable. Suppose i have 5 records in that list..

 

so., if i wrote

 insert data;(data is a list variable) all 5 records are inserted successfuly.. But I have a trigger on that object(before insert)..

 

For five records trigger is firing only once.. That trigger is firing only for the last record..

 

How to do an insert in which for all the records trigger will fire one by one..

 

Thanks

Anu

Hi,

 

 

Here is my part of code..

 

 

 schema.describefieldresult dfield;

Map <String, Schema.SObjectField> fieldMap = Schema.SObjectType.Opportunity.fields.getMap();
for(Schema.SObjectField sfield : fieldMap.Values()){
dfield = sfield.getDescribe();
Pair field = new Pair();
field.key = dfield.getname();
field.label = dfield.getLabel();
field.fieldname = dfield.getname();
field.val = dfield.getDefaultValueFormula();
fields.add(field.label);

if(field.fieldname== 'npe01__Contact_Id_for_Role__c'){
field.val =contactId;
opt.put(field.fieldname,field.val);
}
}

 

 

But, I got too many field describes..

 

Can any one help me out..

 

Thanks

Anu

Hi,

 

I have a field which is filled automatically from webservices..The values of the field is like this.. First line of the field  shows the header of the excel and next lines are the corresponding table row values.

 

I want to read the info from this field and need to display it in a table in visualforce page.. I'm new to apex...

 

Can any one help me?

 

 

 

 

"CnPAID","sfContactID","FirstName","Lastname","Email","PaymentFor","NameOnCard","CreditCardNumber","Cvv","ExpirationDate","Amount","Periodicity","Installment#","FirstpaymentDate","RoutingNumber","AccountNumber","AccountType","CheckType","CheckNumber","VaultGUID","CampaignTracker","Tracker","Result","OrderNumber"
"6943","003E0000009YNsx","radha1","testmail","radha1@testmail987.com","Payment 1","John Smith","xxx...1111","123","12/14","10.01","Momtly","10","01/01/2012",,,,,,,"campagin","Tracker","Transaction processed sucessfully","1211033521724111"
"6943",,"radha1","testmail","radha1@testmail987.com","Donation 2","Ali Mashhod","xxx...1111","654","12/14","2.14","2 weeks","14","01/06/2012",,,,,,,,,"Transaction processed sucessfully","1211033525794111"
"6943","003E0000009YNsx","radha1","testmail","radha1@testmail987.com","Payment 3","Paul Robertson",,,,"51",,,,"123456789","987654321","Saving","Personal","852741963",,,,"Transaction declined","Internal error occured - "
"6943",,"radha1","testmail","radha1@testmail987.com","Payment 4","David","xxx...1111","654","12/14","32",,,,,,,,,,,,"Transaction processed sucessfully","1211033532554111"
"6943","003E0000009YNsx","radha1","testmail","radha1@testmail987.com","Payment 5","David",,,,"32",,,,,,,,,,"Campagin","Tracker","Payment method does not specified.",""

Hi

 

I have this page.

<apex:pageBlockTable value="{!Results}" var="transaction" rendered="{!resultvalue}">

<apex:inputhidden value="{!transaction.tranId}" id="transactid" />

  <apex:column headerValue="Date Last Used" value="{!transaction.tDate2}" />
    <apex:column headerValue="Last 4 digits" value="{!transaction.cardnum}"/>
    <apex:column headerValue="Expiration Date" value="{!transaction.cardexp}"/>
  <apex:column headerValue="Card Type" value="{!transaction.cardname}"/>
    <apex:column >
    <apex:commandLink action="{!Vterminal}" value="Virtual Terminal"  target="_self" styleClass="btn" >
               <apex:param name="para" value="{!transaction.tranId}" assignTo="{!para}"></apex:param>
               <apex:param name="expired" value="{!transaction.cardexp}" assignTo="{!expired}"></apex:param>                                             
     </apex:commandLink>
    </apex:column>
</apex:pageBlockTable>

 

 

Controller:

 

 

public PageReference Vterminal()
    {
           
   
    if(expired!=''){
    expmonth = Integer.valueOf(expired.substring(0,2));
    expyear = Integer.valueOf(expired.substring(3,7));
    expmonthdate = Date.newInstance(expyear, expmonth,31 );
    System.debug('expired monthdate valueeee'+para);
      p=new PageReference('/apex/VirtualTerminal?id='+para);
        return p;
        }

 

 

But When I click on the command Link of Virtual Terminal, I got the visualforce page but without header information., i mean tabs etc.

 

How can I get>?

Hi, I have a managed package in my instance.. I have created a trigger in my sandbox instance.. But When I run the test classes it is showing too many scriot statements error.. Here is my code: trigger dateConvert on CnP__CnP_Transaction__c (before insert) { for(CnP__CnP_Transaction__c c:Trigger.new){ c.CnP__bSource__c = Integer.valueOf(c.CnP__bSource__c); if(c.CnP__bSource__c == 2 ){ String delimslash = '/'; String[] DDate; Datetime myDate; String tdate = c.Dummy_Field__c; if(tdate!=null){ String[] splitdate = tdate.split(' '); DDate = splitdate.get(0).split('/'); String TTime = splitdate.get(1); String month = DDate.get(0); String day = DDate.get(1); String year = DDate.get(2); String hour = TTime.split(':').get(0); String minute = TTime.split(':').get(1); String second = '00'; myDate = datetime.newInstance(integer.ValueOf(year),integer.ValueOf(month), integer.ValueOf(day), integer.ValueOf(hour), integer.ValueOf(minute), integer.ValueOf(second)); c.CnP__TransactionDate__c = myDate; c.CnP__TransactionTimeZone__c = myDate; } } } } Help me Regarding this. Anu

Hi,

 

I have deployed a package.. For most of the users it is working fine.., but one of my customer having this problem

 

 

Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CnP.addCorresCont: 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)

 

 

Before the release it is working fine,.

 

Here is the code that i changed in this release..

 

 

 

  set<String> EmailSet1= new set<String>();
     set<String> CampaignList = new set<String>();
     set<String> SfCampaignList = new set<String>();
     map<String, String> CampaignMap = new map<String, String>();
     map<String, String> SfCampaignMap = new map<String, String>();
     map<String, Id> Map_Contact_To_Id = new map<String, Id>();
     map<String, ID> Map_CampaignName_To_Id = new map<String, ID>();
     map<Id,Id>  Map_CampaignId_To_Id = new map<Id,Id>();    
    
     for (CnP_Transaction__c c : Trigger.new) {
         CampaignList.add(c.Campaign__c);
         SfCampaignList.add(c.sf_Campaign__c);
         CampaignMap.put(c.Campaign__c,c.Campaign__c);
         SfCampaignMap.put(c.sf_Campaign__c,c.sf_Campaign__c);
         EmailSet1.add(c.Email__c);
     }
      list<Contact> ContactMap1=[Select Id,Email,npo02__Household__c from Contact where Email IN :EmailSet1];
       for(Contact k:ContactMap1){
          Map_Contact_To_Id.put(k.Email,k.Id);
        }
      list<Campaign> theCampaign = [SELECT Id, Name FROM Campaign WHERE Name IN :CampaignList OR Id IN :SfCampaignList];
     
      for (Campaign k:theCampaign) {
       Map_CampaignName_To_Id.put(k.Name,k.Id);
       Map_CampaignId_To_Id.put(k.Id,k.Id);
      }

      for (CnP_Transaction__c c : Trigger.new) {
      if(c.sf_Campaign__c == null)
          c.sf_Campaign__c=Map_CampaignName_To_Id.get(c.Campaign__c);
      }
      list<CampaignMember> CheckCamMem=[select contact.Email,Campaignid,Contactid from CampaignMember];
      Map<ID,ID> Map_CamId_ConId=new map<ID,ID>();
    
      for(CampaignMember m : CheckCamMem){
         Map_CamId_ConId.put(m.Campaignid,m.Contactid);
      }
      list<CampaignMember> ListMemebers=new list<CampaignMember>();
           CampaignMember CreateMem=new CampaignMember();
 
    for (CnP_Transaction__c c : Trigger.new) {
     if((c.sf_Campaign__c!=null || c.Campaign__c!= null)&&Map_CamId_ConId.get(c.sf_Campaign__c)!=c.Contact__c){
        CreateMem = new CampaignMember(Campaignid=Map_CampaignId_To_Id.get(c.sf_Campaign__c), Contactid=c.Contact__c, Status='Received');
          Map_CamId_ConId.put(Map_CampaignId_To_Id.get(c.sf_Campaign__c),Map_Contact_To_Id.get(c.Email__c));
          ListMemebers.add(CreateMem);
     }
    }

     if(ListMemebers.size()>0){
       insert ListMemebers;      
       }
    
  }

 

 

Plz help me

 

 

 

 

From the API, you can do a getUserInfo() request, and the result contains a property for orgDefaultCurrencyIsoCode. This is the value of the currency for the organization in a single-currency org.

 

Any idea how I can get this value from Apex? The UserInfo system method does not have the same method, and UserInfo.getDefaultCurrency() returns null in a single-currency org.

  • August 04, 2011
  • Like
  • 0
Hi I have a visualforce page which is only using custom controller... I want to add that page to VIEW link of my object.. For that I have written a redirect visualforce page in which in action function i redirect to my required page.. But when i click back button in the browser, it redirect to middle redirect page and coming back to same view page which i wrote custom controller. I need the back functionality in this case. Thanks in Advance Anu

Friends,

 

Can report be migrated from onse salesforce instance to other ?

(assuming the object schema / structure is same in both organization.)

 

Also, is it possible to migrate reports within Sandboxs of organization?

Will appreciate your hrelp.

Hi,

 

How to redirect to the previous page from current page(the page which has got by clicking a button/link in the previous page) through javascript.

 

I tried by using window.location(-1) and history.goback(-1). These are not working..

 

I don't want to specify the path of previous page in the action back button/link. Because the same page is used by two different roles and thier previous pages are different.

 

please help me.........

Hi developers,

 

How to create a back button which takes to the previous visualforce page?

 

I tried using :

 

<apex:commandbutton value="back" onclick="window.location(-1);">

and

<apex:commandbutton value="back" onclick="history.goback(-1);">

 

by above tags the same page is loaded once again.

 

help me......

 

 

Hi,

 

I have written trigger which does some functionality upon inserting the records.When I am trying to load the data the trigger executes and giving me the error Too many script statements: 20001.

 

None of theSOQL queries are inside the for loop.I have used collections like list and map.

 

Can anyone please help me how  can I resolve this issue.

 

Thanks,

Srilakshmi B

As an ISV, say you introduce references to Person Account fields in your Apex code in a managed package.

 

Does this imply that any customer wishing to install your package needs to enable Person Accounts??  If so, what are the best practices or workarounds for this?  Obviously we cannot assume that all potential customers will want to enable Person Accounts in their orgs...

 

Thanks.


Dave

 

  • June 17, 2010
  • Like
  • 0

We're using core.apexpages.devmode.url=1 in an application intended for packaging on the AppExchange.

 

Will using this setting expose an app to Cross Site Scripting attacks? Will the AppExchange security team reject any apps using this request parameter?

 

Thanks!

 

-Mike

 

 

We are currently facing the following  error in the visualforce page:
System.Exception: Too many fields describes: 11
I assume this  is because
Schema.SObjectType.Features__c.fields.getMap(); is getting called multiple times and exceeding the VF limit.
I tried using  Describeresult instead of getMap.
For Example: Schema.DescribeFieldResult F = Account.AccountNumber.getDescribe(); 

But the Object and the field name has to be dynamic in our case.  I need to know if theres any way where we can pass the object and field dynamically in the DescribeFieldResult statement .

So could anyone suggest some solution to this problem?
  • April 21, 2009
  • Like
  • 0