• Chinmay Bhusari
  • 90 Points
  • Member since 2014
  • Salesforce Developer

  • Chatter
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
  • 39
Hey all!

I have two custom objects that I created.  I have a 'date' field in one of them and want to add the value of that date field to the 2nd custom object.

However, when I try to reference that object (new schools) to the 2nd object field, I get a field error.  This is what my formula looks like:


Any help would be much appreciated!! 

What is the efficient way to create poistive and negative tests? How to create dummy data in seperate class without the need of testing the dummy data class? 
I am confused on how much knowledge of javascript is required to develop efficient visual force pages and while doing visualforce coding how much percentage of the code should be controlled by javascript (according to the requirement)?
Hi All,
    I have two Custom Objects A and B with Master Detail Relationship.We have written one trigger with Before Insert and Before update Trigger for auto populating A field in B Object based on Five conditions .Trigger is working fine.But when we Upload Bulk records of Achievements through Data Loader nearly 40 k Records some are updating the Target Field and some of them are not updating.Some records won't match the conditions thats is fine but some records of Achievements if i update manually it is populating.We checked by reducing the Batch Size also still not resolved.Can any one help on this issue as soon as possible.I am posting the code as well can anyone help me on this trigger to make work for bulk Records also...

trigger populateAfield on ObjectB(before insert,before Update) 
   set<id> userids =new set<id>();
   set<id> accids =new set<id>();
   set<string> plant=new set<string>();
   set<string>rgn=new set<string>();
   set<string> compont=new set<string>();
   set<integer> Month =new set<integer>();
   set<Decimal> invceamt = new set<Decimal>();
   Map<id,ObjectA> mpA = new map<id,ObjectA>();
     forObjectB ac :trigger.new)
  List<ObjectA>A = [select id,OwnerId,Name,Account__c,Component__c,Plant__c,Region__c,
        Target_Amount__c,Target_Date__c,User_Name__c from A Where Region__c IN:rgn  AND CALENDAR_MONTH(Invoice_Date__c) IN :month AND 
                   Account__c IN:accids AND Component__c IN:compont AND Plant__c
                   IN :plant   
                  //AND User_Name__c IN :userids
              for(ObjectA  t:A )
                   mpA .put(t.Account__c,t); 
        if((mpA .Size()>0))
        for(ObjectB ach:Trigger.New)
              if(mpA .get(ach.Account__c)!=Null)
         Integer acmonth=ach.Invoice_Date__c.Month();
          Integer tarmonth=mpA .get(ach.Account__c).Invoice_Date__c.Month();
               if((ach.Account__c==mpA .get(ach.Account__c).Account__c)&&(ach.Component__c==mpA .get(ach.Account__c).Component__c)&&
                  (ach.Region__c==mpA .get(ach.Account__c).Region__c)&&(acmonth==tarmonth)&&
                  (ach.Plant__c==mpA .get(ach.Account__c).Plant__c))                       
                   ach.Target__c = mpA .get(ach.Account__c).id;  

Thanks in advance...!!!

I need to build a functionality in a VF page, wherein I can have a lookup field on an Object A to an object B
Now my requirement is to map some of the fields from object B to A and then save it. 


Hi ,

I have a requirement where I need to hide fields based on a picklist field value on a standard page layout.
Is there a way to achieve this without a VF page?

What is standardset controller and where we use standardset controller?


Anil Kumar
I have a string value that gets dispalyed in Visualforce 2011-10-18 02:29:54
I want to convert this into date.

I tried using outputText but i'm geetting the below error:
The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.

Psuedo Code:
<apex:outputText value="{0, date, MMMM d','  yyyy}">
<apex:param value="{!dateTimeVal}"/>

Converting it into time format in the apex controller is NOT a viable option in my case.
So please help the string to get it formatted in the VF page itself.

Any pointers/help is much appreciated.
Many thanks in advance!
I am using Map<string, sObject> now i want to bind these value with radio button how can i do this.

I am using Wrapper class Map<string,Wrapper> concept but the problem is in this case checkbox is working but Radio button is not working
and in map values coming as
WrapperMapping:[sObje=Account:{Name=GenePoint, Phone=(650) 867-3450, AccountNumber=CC978213, Fax=(650) 867-9895, Id=0019000000ySnxzAAC}, selected=null, selectedR=false, status=null]
Now i want to access only ID column in VF how can i do this Please help


I couldn't find an answer for this.

I'm trying to extend the PersonAccount objects with a custom object called "Attendance Logs", this "Attendance Logs" object is a collection of  N "Attendance".
I want to be able to view the details of the Attendances in the PersonAccount page layout.
No matter what I've tried, I can't seem to be able to get those details on a related list at the PersonAccount level.

I've tried different combinations, the closest to work seems to be:

"Attendance" has a Master-Details relationship to "Attendance Log"
That allows "Attendance Log" to have a related list where I can view the details of each "Attendance".

"Attendance Log" is then related to an Account as Master-Details or Lookup, the related list generated only has details at the "Attendance Log" level, is not possible to view the details for each "Attendance"...

What is the setup required to display a related list 2 levels down?
e.g. PersonAccount -> Attendance Log -> Attendances
so the PersonAccount can show details for the Attendances.

If you want an example of something similar, the iContact integration is using "iContact Sent Message" and "iContact Message Statistic".

Many Thanks

I am working on a module which will de-duplicate contact records on insert/update but I am hitting into Apex CPU time limit exceeded error. I understand that to overcome it we need to optimize code a little but in the following code block there seems very little scope of optimizing it. Any help will be appreciated.

On Account we have a mulipicklist from where we can select the fields based on which the uniqueness of the contacts under this account will be defined. It can be different for difference account. The following code is a part of a handler class for trigger in which we have a map of old contact list with account Id as key (mapOfAccountIdWithItsContact) and a map with new contact list and account as key (newContactWithAccountMap) we iterate over these maps based on set of account whose contacts we have get in triiger. We have a map to stroe Lisst of fields to be used for contact uniqueness for each account (mapOfAccountWithFilters).

Here is the code snippet:

for(String accountId : accountIdSet){
            if(newContactWithAccountMap.get(accountId) != null){
                for(Contact newContact : newContactWithAccountMap.get(accountId)){
                    for(Contact oldContact : mapOfAccountIdWithItsContact.get(accountId)){
                        //Check for duplication only in the respective account, also this should not apply on insertion of Office contact
                        matchingContactFound = false;
                        if(oldContact.id != newContact.id){  //while insert, newContact's id will be null and while update it will verify that it is not matching itself with its old record. 
                            for(String filterFieldName : mapOfAccountWithFilters.get(accountId)){
                                if(oldContact.get(filterFieldName) == newContact.get(filterFieldName)){
                                    matchingContactFound = true;
                                    //If match is found update last de duplication date to today on old contact
                                    oldContact.Last_De_Duplication_Date__c = System.Today();
                                    matchingContactFound = false;
                                    break; //get another "old contact"

                            //stop it from being inserted
                            //newContact.addError('Contact cannot be inserted because a contact is already present based on the Master Target Identifier at client level.');
                            break; //get another "new contact"


Any help in avoiding 4 loops or an alternate approach will be greatly appreciated. Thanks in advance.
Every unit test example for APEX code retrieves the Profile using the following SOQL:
SELECT Id FROM Profile WHERE Name = 'System Administrator'
When I am deploying my unit tests to another Org, which has set another language (e.g. German), this SOQL won't work. The Profile.Name is always returned localized, in German it says "Systemadministrator".

How can I retrieve a profile from the database without being dependant of the user's language? Is there a default System.Label for standard profile names?

So below is the test class created to test my credit card trigger. I keep getting a assert error but looking at it im wondering if im doing way more then needed in the test. Below is the test class 

 public class Test_CreditCardTrigger{
    public static void testCreateCreditCard(){
        Account a = new Account(Name = 'Test MainContactTrigger');
        insert a;
        Contact c = new Contact(AccountId = a.id, firstName = 'Test MainContactTrigger', lastName = 'Tester');
        insert c;
        authnet_credit_card__c cc = new authnet_credit_card__c( Contact__c = c.id);
        insert cc;
        c = [select AccountId,Account.Name from Contact where id = :c.id limit 1];
           System.assertEquals('Test MainContactTrigger', c.Account.Name);
           System.assertEquals(a.id, c.AccountId);

Hey all!

I have two custom objects that I created.  I have a 'date' field in one of them and want to add the value of that date field to the 2nd custom object.

However, when I try to reference that object (new schools) to the 2nd object field, I get a field error.  This is what my formula looks like:


Any help would be much appreciated!! 

Hi folks ,

can anyone help me  on this requirement.i shall appreciate your help.


When PROFILE  name with "Application users"  creates a case ,then the Assigned agent name should be the username who is creating ,
Profile names other than Application Users  creates a case ,then the Assigned agent name should be the  moved into Unassigned queue who is creating.
How can i achevie this through configuration??

Thanks in Advance
  • August 04, 2014
  • Like
  • 0
I'm trying to write a lead assignment rule base on lead creation time.
I wrote the following formula:

if(and (VALUE( MID( TEXT( CreatedDate ), 12, 2 ) )>=4 ,
VALUE( MID( TEXT( CreatedDate ), 12, 2 ) )<14),true,false)

sadly there something wrong with it and i dont know what...
Is there something i'm missing ?

Thanks in advance.

I need to customize the layout for Visitor details of chatlet in Live agent . I want to add another field in layout.. i have given all the permissions but the customfield  which i have created is not visible in Live Agent console. 

Please can any one find solution for this