• Vijaya Kumar Reganti
  • NEWBIE
  • 350 Points
  • Member since 2012

  • Chatter
    Feed
  • 12
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 16
    Questions
  • 61
    Replies
trigger AssignCloseOppTeamMember on OpportunityTeamMember (after insert) {
List<Opportunity> OpportunityList = new List<Opportunity>();
Map<Id, Id> OppIdOppMemberIdMap = new Map<Id, Id>();

for(OpportunityTeamMember OpportunityTeamMemberObj: Trigger.New){
    if(OpportunityTeamMemberObj.TeamMemberRole =='Portfolio Developer')
    
        OppIdOppMemberIdMap.put(OpportunityTeamMemberObj.OpportunityId , OpportunityTeamMemberObj.Id);
}

for(Opportunity opportunityObj : [Select Id, LocalPortfolioDeveloper__c from Opportunity where Id IN: OppIdOppMemberIdMap.keyset()]){
    if(OppIdOppMemberIdMap.Containskey(opportunityObj.Id)){
        opportunityObj.LocalPortfolioDeveloper__c= OppIdOppMemberIdMap.get(opportunityObj.Id).User.Id;
        OpportunityList.add(opportunityObj);
        }
    }
update OpportunityList;

}
getting error - Compile Error: Initial term of field expression must be a concrete SObject: Id at line 13 column 95
This is my test class: 

@IsTest(SeeAllData=true) 
public with sharing class TestInsertDefaultLineItems {
    static testMethod void validateTrigger() {
       Account acc= new Account(Name = 'testAcc', Description='testdesc');
       insert acc;

        //Case record in Test method. 
        Contact conObj = new Contact();
        conObj.lastname = 'testcon';
        conObj.AccountId = acc.id;
        insert conObj;
 
        Opportunity opp1 = new Opportunity (AccountId = acc.Id, Name = 'testOpp', CloseDate = System.today());
            insert opp1;
        
       /* PricebookEntry priceBookEntryNew = new PricebookEntry ();
        Product2 product = new Product2 ();
        PriceBook2 pb2 = new PriceBook2 (Name='Standard priceBook', Description='test');
        insert pb2;      
       List pricebookList = [SELECT Id FROM PriceBook2 WHERE IsStandard = true ];*/
        
     PricebookEntry priceBookEntryNew = new PricebookEntry();
        Product2 product = new Product2(); 
        PriceBook2 pb2 = new PriceBook2 (Name='Standard priceBook',Description = 'test');
        insert pb2;
        List <PriceBook2> pricebookList = [SELECT Id FROM PriceBook2 WHERE IsStandard = true];
        PriceBook2 pricebooktest = new PriceBook2 ();
        if (pricebookList !=null && pricebookList.size()>0)
            pricebooktest = pricebookList.get(0);
        product.name = 'Test';
        insert product;
        
        priceBookEntryNew.Product2Id = product.Id;
        priceBookEntryNew.PriceBook2Id = pricebooktest.Id;
        priceBookEntryNew.UnitPrice = 20.00;
        priceBookEntryNew.UseStandardPrice = false;
        priceBookEntryNew.isactive = true; 
        insert priceBookEntryNew;

        OpportunityLineItem oli = new OpportunityLineItem
            (OpportunityId = opp1.Id,
             PricebookEntryId = priceBookEntryNew.Id,
             Quantity = 1,
             UnitPrice = priceBookEntryNew.UnitPrice,
             
             ServiceDate = System.today()
            );
        insert oli;
    }
}
How do I allow all users to use this apex? It's currently restricted to my community users.

public without sharing class EventActions 
{
  public static void SetAccountUsedSessions(List<Event> events)
  {
    Set<Id> accountIds = new Set<Id>();
    for(Event event : events)
    {
      if(event.AccountId!=null && !accountIds.contains(event.AccountId)) accountIds.add(event.AccountId);
    }
    if(accountIds!=null&&accountIds.size()>0)
    {
      Map<Id, Account> accountsToUpdate = new Map<Id, Account>();
      AggregateResult[] countResults = [SELECT AccountId, count(Id)cnt FROM Event WHERE AccountId IN :accountIds  AND IsRecurrence=false AND Subject LIKE 'PT%' AND ActivityDate <= TODAY AND EVENT_STATUS1__C <> 'Cancelled WITH 24hr Notice' GROUP BY AccountId];
      if(countResults!=null&&countResults.size()>0)
      {
        for (AggregateResult ar : countResults)  {
          String accountId = String.ValueOf(ar.get('AccountId'));
          String usedSessions = String.ValueOf(ar.get('cnt'));
          if(accountId!=null&&accountId!=''&&usedSessions!=null&&usedSessions!='')
          {
            Account account = new Account(Id=accountId);
            account.Used_Sessions__c = integer.valueOf(usedSessions);
            accountsToUpdate.put(account.Id, account);
          }
        }    
      }
      for(Id accountId : accountIds)
      {
        if(!accountsToUpdate.containsKey(accountId))
        {
          Account account = new Account(Id=accountId);
          account.Used_Sessions__c = 0;
          accountsToUpdate.put(accountId, account);
        }
      }
      if(accountsToUpdate!=null&&accountsToUpdate.values().size()>0) update accountsToUpdate.values();
    }
  }
  
  public static testMethod void Test()
  {
    List<Event> events = [SELECT Id, WhatId, AccountId FROM Event WHERE AccountId<>null 
      AND IsRecurrence=true AND Subject LIKE 'PT%' LIMIT 10];
    Event events2 = [SELECT Id, WhatId, AccountId FROM Event WHERE AccountId<>null 
      AND IsRecurrence=false AND EndDateTime > :system.today().toStartOfWeek() LIMIT 1];
    
    Profile sysAdminProfile = [SELECT Id FROM Profile WHERE Name='Corporate' LIMIT 1];
    
    User u = [select Id from User where IsActive = true and UserType = 'Standard' 
      and ProfileId != :sysAdminProfile.Id limit 1];
    System.runAs(u) {
    
      SetAccountUsedSessions(events); 
      update events2;
      delete events2;
    }
    
  }
}
Unable to Pass Control Access to the Org in Data Security - I have meet all the requriement to pass the module but keep getting "The user's profile was not set to System Administrator". Below is what my user look it:
Name:  guestadmin guestadmin                    Role 
Alias:    ggues                                                User License:  Salesforce
Email:   guestadmin@tarjani.com                  Profile:   System Administrator
Username:  guestadmin@tarjani.com            Active: (Unchecked)
Nickname:   guestadmin77 
Link to Trailhead: https://trailhead.salesforce.com/trails/force_com_dev_beginner/modules/data_security/units/data_security_org
 
How to allow Community users to edit their related contact fields, but no one elses?
Hi!..I have a requirement. Before submitting a record into an approval process, I need to validate some information in others records..if the validation fails, I need to send a warning to the user…if it’s ok, the approval process is fired.
Any idea in order to achieve the requirement? I’m lost here, any kind of help is welcome.
More specifically, I want to create various individual SELECT queries in which I retrieve the first 1000 results of the object, than the next 1000 and so on.
Example:
SELECT Id, Name FROM Account WHERE rowIndex BETWEEN 1 AND 1000;
SELECT Id, Name FROM Account WHERE rowIndex BETWEEN 1001 AND 2000;
(...)

The thing is, the column "rowIndex" (or an equivelent one) does not exist in the object (column "Id" does not qualify). 

So, how can I retrieve only 1000 results each time of the query: "SELECT Id, Name FROM Account"?

Thank you.
Hi there,

For the last days I have been struggeling with Apex Triggers, I need to roll up a currency field from the (standard) 'Account' object to the custom 'CustomerGroups__c' object. I'd prefer avoiding Apex, but Sales Force does not allow me to make a parent for the Account object.

From the child 'Account', I'd like to roll up the currency field "Customer_OLB__c" and summarize those amounts in the parents object 'CustomerGroups__c' field 'Customer_Group_OLB__c'.

Adjusting one of the previously provided examples has lead me to to following code, where I get an problem in line 2: "unexpected token: ':' "  
 
trigger UpdateAccount on Account (after insert, after update, after delete, after undelete) {
  Map<Id,CustomerGroups__c> updateCustomerGroups = new Map<Id,CustomerGroups__c>;
  Set<Id> updateCustomerGroupsIds = new Map<Id,CustomerGroups__c>();
    if(Trigger.isInsert || Trigger.isUpdate || Trigger.isUndelete)
        for (Account account:Trigger.new)
        updateCustomerGroupsIds.add(account.CustomerGroups__c_Name);
    if(Trigger.isUpdate || Trigger.isDelete)
        for (Account account:Trigger.old) 
        updateCustomerGroupsIds.add(account.CustomerGroups__c_Name);
    updateCustomerGroupsIds.remove(null);
    
    for(Id CustomerGroupsId:updateCustomerGroupsIds)
        updateCustomerGroupsIds.put (CustomerGroupsId,new CustomerGroups (id=CustomerGroupsId,Accounts_Count=0);
        for Account account:[select id,CustomerGroups__c_Name from account where CustomerGroups__c_Name in :updateCustomerGroupsIds])
        
        updateCustomerGroups.get (account.CustomerGroups__c_Name).Accounts_Count++;
    Database.update(updateCustomerGroups.values());
)       
}
Any help would be much appreciated!

Kind regards,

Thijs
 
Dear All,

I was trying to write test class for my trigger, but it it giving me error like below
'FATAL_ERROR System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, restrictCase: execution of BeforeInsert' , 'FATAL_ERROR caused by: System.NullPointerException: Attempt to de-reference a null object'

heres my trigger
trigger restrictCase on Case(before insert)
{
MaxCase__c mxx = MaxCase__c.getInstance('MaxValue');    
Integer mvv = Integer.valueOf(mxx.Max__c);
    system.debug('int value' + mvv);

Set<Id> userIds = new Set<Id>();

    
for (case cc : Trigger.new)  
{
userIds.add(cc.ownerId);
} 
 
List<User> userss = [Select Id, Name from User where Id in :userIds];  
Map<Id, Integer> userCases = new Map<Id,Integer>(); 
    
for (user u : userss)
{
 integer countCase = [Select count() from Case where ownerId=:u.Id AND createdDate = This_Month];
 userCases.put(u.id, countCase); 
 system.Debug('user and case' + u.Name + ' . ' + countcase);
}
  
for (case c : trigger.new)    
{

Integer countc = userCases.get(c.OwnerId);    
system.debug('current user case count' + countc);    
    if (countc > mvv)
    {
        c.addError('Too many cases created this month for user' + c.owner.Name + '(' + c.OwnerId + ')' + ':' + mvv);
    }
    
}   
    
    
    
}

and heres the test class I've written
 
@isTest

public class testRestrictCase {

 static testMethod void caseCreation1 ()
 {
          MaxCase__c maxi = new MaxCase__c();
     maxi.Name = 'newMax';
     maxi.Max__c = 80;
     insert maxi;
     
     system.debug('maxi custom setting' + maxi.Name);
     Integer maxiInt = Integer.valueOf(maxi.Max__c);
      system.debug('max value' + maxiInt);
     
     
  Account acct = new Account(Name='anamika');   
  insert acct;
     system.debug('account inserted' + acct.name);
 Contact con = new Contact(FirstName='aa', LastName='bb', AccountId=acct.Id, email='abc@g.com');
  insert con;
     system.debug('contact inserted' + con.name);

 List<Case> casess = new List<Case>();
     for(integer i = 0; i<maxiInt ; i++)
     {
    Case TestC = new Case(Subject='Test Controller Acct Case'+ i, accountId=acct.id, status='New', origin ='Email', contactId=con.id, priority='Medium', type='Mechanical', reason='Installation');
     casess.add(Testc); 
system.debug('testC .i.' + TestC.Subject);
 }
   insert casess;
     system.debug('cases size' + casess.size());
     
     Case TestC1 = new Case(Subject='Test Controller Acct Case new', accountId=acct.id, status='New', origin ='Email', contactId=con.id, priority='Medium', type='Mechanical', reason='Installation');

     try{
         insert TestC1;
     }
 catch(DMLException ex)
 {
   system.debug('max cases inserted');  
 }
 
 }
}

​Please help me finding the issue.

Thanks a lot in advance.
I want to transfer some of the field data from Contract to Service TimeCard (Custom object) field.

The same field in both the object. Once the contract is created and under that when the service timecard record is generated the (Daily rate and Daily rate offset) data will automatically transfer from Contract to my custom object field.

I had applied the below code.


trigger servicecontract on Contract (after insert) 
{
    
 Set<Id> Ids= new Set<Id>();
    for (Contract member : Trigger.new)
    {
       Ids.add(member.Id);       
    }

 List <Contract> memberList = new List <Contract> ([Select Id, Daily_Rate__c, Daily_Rate_Offsite__c from Contract where Id in :Ids]);    

    for(Contract cont : memberList)

    {
  
       SFDC_Service_Timecard__c member = new SFDC_Service_Timecard__c();
    
        member.Daily_Rate__c = cont.Daily_Rate__c;
        member.Offsite_Daily_Rate__c = cont.Daily_Rate_Offsite__c;
       insert member;
    }
 }
Hi.
I have two custom objects Our_va__c and Cancellation__c. cancellation has Lookup to Our VA.

I need to fetch all cancellation records for the purticular Our va. I have written query like..
 
///***** Cosider All our_va__c ids are in Ovaids

List<our__va__c> ova= new list<our_va__c>();

ova=[select id,name, (select name from cancellation__r) from our_va__c where id IN : Ovaids]

I got the error didn't Understand the relationship...

Anyone help plz??
I know this question has been asked before. The question was never satisfactorily answered. 

I have changed the configuration of the Case Owner field in the Case layout to read-only, but the "change" is still active.

Is there a way to override this behaviour to remove this link, or by making this Case Owner really read-only?

or  as workaround I have created a new formula field : Owner:User.FirstName + " " +  Owner:User.LastName. However this only works (shows the owner) after the case is saved. Is there a way to make the Owner apear when the Case is created just like the real Owner field?

maybe have two layouts 1) one with the owner field when the case is created, 2) in edit mode, the case owner is replaced with my custom field.

or, programmically swich fields with a trigger when the case is saved.
Is there a time zone setting that can be set once and will automatically be adjusted when the time changes from Daylight to Standard time? All timestamps were behind by an hour after this past weekend. I changed default settings form Central Standard Time to Central Daylight Time. I would like it to be automatically adjusted to accomodate the change. Kind of like you don't have change your phone clock, it just happens!

Any ideas?
All,
I need to make my sales summary code more efficient. Once we hit 9,000 trades on a single Account, the system hits the CPU Limit governor limit, even in a batch job. Anybody have any ideas on the code below? Perhaps moving each calculation in the For loop under each  corresponding map? I'm not sure the best way to change this code, but any help would be greatly appreciated.

Debug log shows errors at random at lines 73, 79, or 92 in the Class and every time on line 4 in the trigger.
CPU Time varies on the number of trades inserted at a time, but even at 1 trade I can get up to 25000 out of 10000 (more than double).

Class:
public class Account_RollupTrades {
    public Static Account_Setting__c setting = Account_Setting__c.getInstance();
    public Static boolean inprog = false;

    public static void execute (Set<Id> accountIds, List<Account> accountsList) {
        Map<Id, Account> accounts = new Map<Id, Account> (AccountsList);
        system.debug ('execute');
        if(setting.Disable_RollupTrades__c != true) {
            //Map<Id, Account> accounts = new Map<Id, Account>();
            for(Id accountId:accountIds) {
                system.debug(accountid);
                accounts.put(accountId,
                   new Account(
                       Id=accountId,
                       /**YTD_NIOR_I_Sales__c = 0,         YTD_NIOR_I_Shares__c = 0,         QTD_NIOR_I_Sales__c = 0,         QTD_NIOR_I_Shares__c = 0,
                       MTD_NIOR_I_Sales__c = 0,         MTD_NIOR_I_Shares__c = 0,         PY_NIOR_I_Sales__c = 0,          PY_NIOR_I_Shares__c = 0,
                       Total_NIOR_I_Sales__c = 0,       Total_NIOR_I_Shares__c = 0,       YTD_NS_Income_Sales__c = 0,      YTD_NS_Income_Shares__c = 0,
                       QTD_NS_Income_Sales__c = 0,      QTD_NS_Income_Shares__c = 0,      MTD_NS_Income_Sales__c = 0,      MTD_NS_Income_Shares__c = 0,
                       PY_NS_Income_Sales__c = 0,       PY_NS_Income_Shares__c = 0,       Total_NS_Income_Sales__c = 0,    Total_NS_Income_Shares__c = 0,**/
                       Total_NS_HI_Sales__c = 0,       Total_NS_HI_Shares__c = 0,       YTD_NS_HI_Sales__c = 0,         YTD_NS_HI_Shares__c = 0,
                       QTD_NS_HI_Sales__c = 0,         QTD_NS_HI_Shares__c = 0,         MTD_NS_HI_Sales__c = 0,         MTD_NS_HI_Shares__c = 0,
                       PY_NS_HI_Sales__c = 0,          PY_NS_HI_Shares__c = 0,          Total_NS_Income_II_Sales__c = 0, Total_NS_Income_II_Shares__c = 0,
                       YTD_NS_Income_II_Sales__c = 0,   YTD_NS_Income_II_Shares__c = 0,   QTD_NS_Income_II_Sales__c = 0,   QTD_NS_Income_II_Shares__c = 0,
                       MTD_NS_Income_II_Sales__c = 0,   MTD_NS_Income_II_Shares__c = 0,   PY_NS_Income_II_Sales__c = 0,    PY_NS_Income_II_Shares__c = 0,
                       Rollup_Trades__c = DateTime.now()
                   )
                            );
            }
            Map<String, SObjectField[]>
                ytd = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.YTD_NIOR_I_Sales__c , account.YTD_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.YTD_NS_Income_Sales__c , account.YTD_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.YTD_NS_HI_Sales__c , account.YTD_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.YTD_NS_Income_II_Sales__c , account.YTD_NS_Income_II_Shares__c }    
                },
                qtd = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.QTD_NIOR_I_Sales__c , account.QTD_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.QTD_NS_Income_Sales__c , account.QTD_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.QTD_NS_HI_Sales__c , account.QTD_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.QTD_NS_Income_II_Sales__c , account.QTD_NS_Income_II_Shares__c }
                },
                mtd = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.MTD_NIOR_I_Sales__c , account.MTD_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.MTD_NS_Income_Sales__c , account.MTD_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.MTD_NS_HI_Sales__c , account.MTD_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.MTD_NS_Income_II_Sales__c , account.MTD_NS_Income_II_Shares__c }
                },
                py = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.PY_NIOR_I_Sales__c , account.PY_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.PY_NS_Income_Sales__c , account.PY_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.PY_NS_HI_Sales__c , account.PY_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.PY_NS_Income_II_Sales__c , account.PY_NS_Income_II_Shares__c }
                },
                total = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.Total_NIOR_I_Sales__c , account.Total_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.Total_NS_Income_Sales__c , account.Total_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.Total_NS_HI_Sales__c , account.Total_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.Total_NS_Income_II_Sales__c , account.Total_NS_Income_II_Shares__c }
                };
    
    // We make the select in a "for" so instead of selecting to many records at once hitting the heap size limit the for it will take only 200 records to work with at each iteration.
    for(Trades__c[] tradesList : [select Dollar_Amount_of_the_transaction__c, Fund_Number__c, Number_of_Shares_of_the_transaction__c, Resolved_Firm_Trading_ID__c, Resolved_Firm_Trading_IDs__c, Trade_Date__c from Trades__c where Resolved_Firm_Trading_ID__c in :accountIds and Fund_Number__c in (/**'3910', '3911',**/ '3912', '3915') and Dollar_Amount_of_the_transaction__c != null and Number_of_Shares_of_the_transaction__c != null and Trade_Date__c != null and Dollar_Amount_of_the_transaction__c >= 0 and Number_of_Shares_of_the_transaction__c >= 0 FOR UPDATE]){
        for(trades__c trade: tradesList) {
            
            if(date.today().year() == trade.trade_date__c.year()) {
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(ytd.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(ytd.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(ytd.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(ytd.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                //system.debug(ytd);
                //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
                
                //( (date.ValueOf(date.today().month()).divide(3, 0) == date.ValueOf(trade.trade_date__c.month()).divide(3, 0)) )
                if((((date.today().month() - 1) / 3) + 1) == (((trade.Trade_Date__c.month() - 1) / 3) + 1))   {
                    accounts.get(trade.Resolved_Firm_Trading_ID__c).put(qtd.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(qtd.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                    accounts.get(trade.Resolved_Firm_Trading_ID__c).put(qtd.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(qtd.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                    //system.debug(qtd);
                    //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
                    
                    if(date.today().month()==trade.trade_date__c.month()) {
                        accounts.get(trade.Resolved_Firm_Trading_ID__c).put(mtd.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(mtd.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                        accounts.get(trade.Resolved_Firm_Trading_ID__c).put(mtd.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(mtd.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                        //system.debug(mtd);
                        //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
                    }
                }
            } 
            else if(date.today().year()-1==trade.trade_date__c.year()) {
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(py.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(py.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(py.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(py.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                //system.debug(py);
                //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
            }
            accounts.get(trade.Resolved_Firm_Trading_ID__c).put(total.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(total.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
            accounts.get(trade.Resolved_Firm_Trading_ID__c).put(total.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(total.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
            //system.debug(total);
            //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
        }
            }
        }
        inprog = true;
        update accounts.values();
        inprog = false;
    }
}
Trigger:
trigger Account_RollupTrades on Account (after update) {
    if(Account_RollupTrades.inprog == false) {
        //set<ID> sID = new set<ID> (trigger.newMap.keySet());
        Account_RollupTrades.execute(trigger.newMap.keySet(), trigger.new);
    }
}



 
Hi,

I'm writing a delete trigger and that is bulkify too. I'm not getting the way to prevent valid data of being delete. like for example if I have 10 record to delete and 2 of them are valid or supposed not to be deleted by anyone. so my use case is those 2 recoreds should will not be deleted . and rest all (8) can be deleted easily.

so if anyone knows about it then please let me know. thanks in advance.

Advaanz Knowledge Systems comes up with data synchronization solutions by developing integration between MySQL and Salesforce and also for data migration using Informatica Cloud
We have successfully completed integration between MySQL and Salesforce CRM for synchronizing the data.

Salient features of this Integration are as follows:
- Through Informatica Cloud we can perform data insertion, updating and deletion.

- Using the CSV files we can do successful data migration.

- It’s not possible to use data loader in professional edition of Salesforce CRM.

- Using Informatica Cloud we can transfer data to Professional edition of Salesforce CRM.

Your search for Data Migration and Integration assistance ends here; please don't hesitate to contact us for assisting on your business needs.

Website - www.advaanz.com.

Email - info@advaanz.com / pradeep.p@advaanz.com

Skype - advaanz / dskvap

Anyone knows what is causing "Login rate exceeded" exception for an (integration) user?
 

Haven't foundnd any reference/answer in "Help" or manual.

 

Can anyone provide me some more information abou this error, because it's really a blocker.

hi friends,

i am using visualforce page and apex class to create standard user and to view user record as well as for edit functionality...

 

i haven't used <apex:detail/> to view record of any particular user...because by using this i am going to standard look and feel...

insted of using detail i have used simple vf  and in that used outputfield to dislay users record

 

here is my code..

 

 

i want to use a command button for reset password ,i haven't written any code in method(reset) of extension ...

how method will be written in extension (say method in extesnion  is reset)

<apex:page standardController="User" tabStyle="MyAdmin__tab" extensions="StaffandUserDetailPageExtension" >  <!--  <apex:detail title="false" relatedList="false"/> -->
    <apex:form >
        <apex:pageBlock mode="edit">
        <apex:pageMessages />
            <apex:pageBlockButtons >
                   
                    <apex:commandButton action="/apex/EditStaffAndUser?id={!id}" value="Edit"/>
                    <apex:commandButton action="/apex/AdminListView?intFocus=5" value="List View"></apex:commandButton>
                <!--    <apex:commandButton action="{!resetpassword}" value="Reset Password"/> -->
                    
                 </apex:pageBlockButtons>
              
              <apex:pageBlockSection title="User Information" columns="2" collapsible="false"> 
             
           
                 <apex:outputField value="{!User.User_Types__c}"/> 
                  <apex:pageBlockSectionItem >
                         <apex:outputLabel value="Active"/>
                         <apex:outputfield value="{!User.IsActive}"/>
                  </apex:pageBlockSectionItem> 
                
                  <apex:outputField value="{!User.ProfileId}"/>
                  <apex:outputField value="{!User.FirstName}"/>
                  <apex:outputField value="{!User.Username}"/>
                  <apex:outputField value="{!User.LastName}"/>
                  <apex:outputField value="{!User.Email}"/>
                  <apex:outputField value="{!User.alias}"/>
                  <apex:outputField value="{!User.CommunityNickName}"/>
     
                  
                 
                  </apex:pageBlockSection>
        
            
           
            

          
                    
                    
            <apex:pageBlockSection >

                  
                   
                   <apex:outputField value="{!User.Phone}"/>
                   <apex:outputField value="{!User.Extension}"/>
                   <apex:outputField value="{!User.Fax}"/>
           
                   <apex:outputField value="{!User.Title}"/>
                   <apex:outputField value="{!User.CompanyName}"/>
          
                   <apex:outputField value="{!User.Department}"/>
                   

         
                   
          
                   </apex:pageBlocksection>
              
              
            
      
      
          
            <!-- 
               <apex:pageBlockSection title="Other Information" columns="1" collapsible="false">
                   <apex:outputField value="{!User.EmailEncodingKey}"/>
                   <apex:outputField value="{!User.TimeZoneSidKey}"/> 
                   <apex:outputField value="{!User.LocaleSidKey}"/>
                   <apex:outputField value="{!User.LanguageLocaleKey}"/>
               </apex:pageBlockSection>
             --> 
               
        
            
              </apex:pageBlock>
              </apex:form>
   
  
 
 
 


   
</apex:page>

 Thanks in advance