• 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

 

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.

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

 

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?