• Lakis
  • NEWBIE
  • 20 Points
  • Member since 2015
  • CRM Manager
  • Beyond Luxury Media

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 11
    Replies
Hey guys!

I'm not sure if I'm not overcomplicating this but... here it is:

I have a picklist with hh:mm values to represent time difference such as -:1:00 or +1:00.

As a part of the improvement to countries selection (separate country from time difference), I'm trying to calculate "Current Time at Location" based on the picklist value.

So far, I'm converting picklist to TEXT, using formula field "UTC Time Picklist to TEXT" so that I can use it in my calculation. However, I'm strugling to convert "UTC Time Picklist to TEXT" into hh:mm using Date/Time formula field so that I can use it for time calculation.

Would it be possible at all? For the "Current Time at Location" calculation I'm using:

TIMENOW() + VALUE( TEXT(UTC_TEXT_to_TIME__c ))

Assisting secreenshot attached. Many thanks for any ideas!

Lakis

User-added image


 
  • February 12, 2018
  • Like
  • 0
Hey guys, I'm trying to put a validation rule on Contact to ensure that at least one of the three picklists have a value before saving.

Tried ISNULL, ISBLANK and no luck. Can anyone point me to the right direction please?

Thanks in advance,
​Lakis
  • January 12, 2016
  • Like
  • 0
I've got a working (Before update) trigger and a test class (with 77% pass). Before I move it to production I would like to:

1. Make sure that once trigger is moved into production, an email will be sent with error details to my account anytime error occurs.

2. Improve code coverage.

No idea how to do it... Can anyone help please? 

The trigger idea is pretty simple: If one of the picklist values on the Account with the specific record type 'Exhibitor'  is changed, corresponding picklists on related Contact records (Contact record type is called 'Exhibitor') must update.

Thanks in advance,
Lakis

***
trigger Contact_Importance_Update on Account (before update) {

    Id recTypeId = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Exhibitor').getRecordTypeId(); //using it like this you won't have problems to deploy (and it'll save you a query)
    
    List<Account> accountsToVerify = new List<Account>();

   for(account a : trigger.new){
       if(a.RecordTypeId == recTypeId  //checks if the account has the correct RecordType
          && (a.PURE_Importance__c != trigger.oldMap.get(a.Id).PURE_Importance__c
          || a.WAA_Importance__c != trigger.oldMap.get(a.Id).WAA_Importance__c
          || a.LE_Miami_Importance__c != trigger.oldMap.get(a.Id).LE_Miami_Importance__c
          || a.PURE_Agent__c != trigger.oldMap.get(a.Id).PURE_Agent__c
          || a.LE_Miami_agent__c != trigger.oldMap.get(a.Id).LE_Miami_agent__c
          || a.WAA_agent__c != trigger.oldMap.get(a.Id).WAA_agent__c)){ //checks if the picklist is changed
           accountsToVerify.add(a);
       }
   }

   if(!accountsToVerify.isEmpty()){ //will only process if there's a need to.
      List<Contact> contactsToUpdate = [SELECT Id, AccountId, FirstName FROM Contact WHERE AccountId IN :accountsToVerify];
      for(Contact c : contactsToUpdate){
          Account a = trigger.newMap.get(c.AccountId);

          c.PURE_Importance_contact__c=a.PURE_Importance__c;
          c.We_Are_Africa_Importance_contact__c=a.WAA_Importance__c;
          c.LE_Miami_Importance_contacts__c=a.LE_Miami_Importance__c;
          c.PURE_Agent__c=a.PURE_Agent__c;
          c.LE_Miami_agent__c=a.LE_Miami_agent__c;
          c.WAA_agent__c=a.WAA_agent__c;
       }
       update contactsToUpdate;
   }


}

***

@isTest
private class Contact_Update{
    static testMethod void Contact_Importance_Update(){

        //Query the record types by developername to get their Ids
        RecordType acctExhibitorRT = [Select Id From RecordType Where sObjectType = 'Account' And DeveloperName = 'Exhibitor'];

        RecordType contExhibitorRT = [Select Id From RecordType Where sObjectType = 'Contact' And DeveloperName = 'Exhibitor'];                        
                 
        Account acc = new Account(
            Name = 'testaccount'
            ,Street__c = 'teststreet'
            ,Country_area_code__c = 'Afghanistan (GMT +4:30; area code +93)'
            ,Region__c = 'Asia - South-Central (and India Sub-Cont.)'
            ,RecordTypeId = acctExhibitorRT.Id //Set this account to the exhibitor Record Type
        );
        insert acc;
                    
        Contact con = new Contact(
            AccountId = acc.id
            ,Lastname = 'testcontact'
            ,Firstname ='testdata1'
            ,Email = 'lakis@o2.pl'
            ,OwnerId = Userinfo.getUserid()
            ,Country__c = 'Afghanistan (GMT +4:30; area code +93)'
            ,Region__c = 'Asia - South-Central (and India Sub-Cont.)'
            ,RecordTypeId = contExhibitorRT.Id //Set this contact to the exhibitor record type
        );
        insert con;

        acc.PURE_Importance__c = 'Leader';
        acc.PURE_Agent__c = 'Name1';
        acc.LE_Miami_Importance__c = 'In Hand';
        acc.LE_Miami_Agent__c = 'Name2';
        acc.WAA_Importance__c = 'Suspect';
        acc.WAA_Agent__c = 'Name3';
              
        Test.startTest();
        update acc;
        Test.stopTest();

        //Requery the contact record and check to make sure it was updated.
        Contact result = 
            [Select
                PURE_Importance_Contact__c
                ,We_Are_Africa_Importance_Contact__c
                ,LE_Miami_Importance_Contacts__c
                ,PURE_Agent__c          
                ,LE_Miami_agent__c
                ,WAA_agent__c
            From
                Contact
            Where
                Id = :con.Id];

        System.assertEquals(acc.PURE_Importance__c,result.PURE_Importance_Contact__c);
        System.assertEquals(acc.WAA_Importance__c,result.We_Are_Africa_Importance_contact__c);
        System.assertEquals(acc.LE_Miami_Importance__c,result.LE_Miami_Importance_contacts__c);
        
        System.assertEquals(acc.PURE_Agent__c,result.PURE_Agent__c);
        System.assertEquals(acc.WAA_agent__c,result.WAA_Agent__c);
        System.assertEquals(acc.LE_Miami_agent__c,result.LE_Miami_agent__c);
        
    }
}
  • December 10, 2015
  • Like
  • 0
Hey everyone,

It's my first attempt to write a test class. I have the following trigger and I'm struggling to write a test big time. Can anyone assist?

The case is pretty simple... If one of the picklist values on the Account with the specific record type 'Exhibitor'  is changed, corresponding picklists on related Contact records (Contact record type is called 'Exhibitor') must update.

***
trigger Contact_Importance_Update on Account (before update) {

    Id recTypeId = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Exhibitor').getRecordTypeId(); //using it like this you won't have problems to deploy (and it'll save you a query)
    
    List<Account> accountsToVerify = new List<Account>();

   for(account a : trigger.new){
       if(a.RecordTypeId == recTypeId  //checks if the account has the correct RecordType
          && (a.PURE_Importance__c != trigger.oldMap.get(a.Id).PURE_Importance__c
          || a.WAA_Importance__c != trigger.oldMap.get(a.Id).WAA_Importance__c
          || a.LE_Miami_Importance__c != trigger.oldMap.get(a.Id).LE_Miami_Importance__c
          || a.PURE_Agent__c != trigger.oldMap.get(a.Id).PURE_Agent__c
          || a.LE_Miami_agent__c != trigger.oldMap.get(a.Id).LE_Miami_agent__c
          || a.WAA_agent__c != trigger.oldMap.get(a.Id).WAA_agent__c)){ //checks if the picklist is changed
           accountsToVerify.add(a);
       }
   }

   if(!accountsToVerify.isEmpty()){ //will only process if there's a need to.
      List<Contact> contactsToUpdate = [SELECT Id, AccountId, FirstName FROM Contact WHERE AccountId IN :accountsToVerify];
      for(Contact c : contactsToUpdate){
          Account a = trigger.newMap.get(c.AccountId);

          c.PURE_Importance_contact__c=a.PURE_Importance__c;
          c.We_Are_Africa_Importance_contact__c=a.WAA_Importance__c;
          c.LE_Miami_Importance_contacts__c=a.LE_Miami_Importance__c;
          c.PURE_Agent__c=a.PURE_Agent__c;
          c.LE_Miami_agent__c=a.LE_Miami_agent__c;
          c.WAA_agent__c=a.WAA_agent__c;
       }
       update contactsToUpdate;
   }


}
***

I got as far as this and I guess faaaaar away. Not sure how to relate records and how to make sure correct record type is called.

@isTest
                private class Contact_Update
                {
                     static testMethod void Contact_Importance_Update()
                  {
                                        
                    Account acc = new Account(name = 'testaccount',Street__c = 'teststreet', Country_area_code__c = 'Afghanistan (GMT +4:30; area code +93)', Region__c = 'Asia - South-Central (and India Sub-Cont.)');
                    insert acc;
                    
                    Contact con = new Contact(AccountId = acc.id,lastname = 'testcontact' , firstname ='testdata1',OwnerId = Userinfo.getUserid(), Country__c = 'Afghanistan (GMT +4:30; area code +93)', Region__c = 'Asia - South-Central (and India Sub-Cont.)');
                    insert con;
                  
                    Account a = new Account();
        
                    a.PURE_Importance__c = 'Leader';
                    a.PURE_Agent__c = 'Name1';
                    a.LE_Miami_Importance__c = 'In hand';
                    a.LE_Miami_Agent__c = 'Name2';
                    a.WAA_Importance__c = 'Suspect';
                    a.WAA_Agent__c = 'Name3';
        
                    update a;
                  
                   }
                   
      
           }
  • December 07, 2015
  • Like
  • 0
Having some trouble using the Force.com IDE in Eclipse Java Neon and wondering if anyone has seen something similar/can help.  Here is where I'm at:

I've installed Java JDK 1.8.0_101
I've installed Eclipse Neon IDE for Java Developers, as recommended here: https://developer.salesforce.com/page/Force.com_IDE_Installation
Upon opening Eclipse, I've followed the instructions to "Install New Software" and Added the Force.com IDE, and finished installation (it shows in the list in "Installation Details")

However, when I go to Window > Perspective > Open Perspective > Other, it does not show in the list.  I've repeated the above steps a few times and restarted, and still no luck.  Anyone have any ideas?
Hey everyone,

When trying to delete an Apex class via the Force IDE I'm getting the "Destination organization must be different from the Project organization" error. I found this article, which tells me to go to the ".settings" folder and set the endpointServer to a blank value.

Here is the tutorial picture provided by the article:

User-added image



The problem is that I don't see the ".settings" folder anywhere in my instance:

User-added image

I'm guessing the article was written for an older verion of Force IDE. Does anyone know where to find the ".settings" folder (and therefore the endpointServer attribute)?

Thanks!
-Greg
Want my soql query to find records with specific record types. OR stement returning error: expecting right square bracket, found 'OR'

Do I need to create additional soql queries to first obtain record types, then reference in existig soql?

Thanks!

Existing soql
List<AggregateResult> results = [SELECT Account__c, 
                                         SUM(X2_1_a_Total_of_jobs_Year_0__c) mysum0,
                                         FROM Form__c 
                                         WHERE Account__c IN:accountIds
                                         AND (RecordType.DeveloperName ='Baseline Report')
                                         OR  (RecordType.DeveloperName ='Annual Report')
                                         GROUP BY Account__c]  ;

 
Hey guys, I'm trying to put a validation rule on Contact to ensure that at least one of the three picklists have a value before saving.

Tried ISNULL, ISBLANK and no luck. Can anyone point me to the right direction please?

Thanks in advance,
​Lakis
  • January 12, 2016
  • Like
  • 0
I've got a working (Before update) trigger and a test class (with 77% pass). Before I move it to production I would like to:

1. Make sure that once trigger is moved into production, an email will be sent with error details to my account anytime error occurs.

2. Improve code coverage.

No idea how to do it... Can anyone help please? 

The trigger idea is pretty simple: If one of the picklist values on the Account with the specific record type 'Exhibitor'  is changed, corresponding picklists on related Contact records (Contact record type is called 'Exhibitor') must update.

Thanks in advance,
Lakis

***
trigger Contact_Importance_Update on Account (before update) {

    Id recTypeId = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Exhibitor').getRecordTypeId(); //using it like this you won't have problems to deploy (and it'll save you a query)
    
    List<Account> accountsToVerify = new List<Account>();

   for(account a : trigger.new){
       if(a.RecordTypeId == recTypeId  //checks if the account has the correct RecordType
          && (a.PURE_Importance__c != trigger.oldMap.get(a.Id).PURE_Importance__c
          || a.WAA_Importance__c != trigger.oldMap.get(a.Id).WAA_Importance__c
          || a.LE_Miami_Importance__c != trigger.oldMap.get(a.Id).LE_Miami_Importance__c
          || a.PURE_Agent__c != trigger.oldMap.get(a.Id).PURE_Agent__c
          || a.LE_Miami_agent__c != trigger.oldMap.get(a.Id).LE_Miami_agent__c
          || a.WAA_agent__c != trigger.oldMap.get(a.Id).WAA_agent__c)){ //checks if the picklist is changed
           accountsToVerify.add(a);
       }
   }

   if(!accountsToVerify.isEmpty()){ //will only process if there's a need to.
      List<Contact> contactsToUpdate = [SELECT Id, AccountId, FirstName FROM Contact WHERE AccountId IN :accountsToVerify];
      for(Contact c : contactsToUpdate){
          Account a = trigger.newMap.get(c.AccountId);

          c.PURE_Importance_contact__c=a.PURE_Importance__c;
          c.We_Are_Africa_Importance_contact__c=a.WAA_Importance__c;
          c.LE_Miami_Importance_contacts__c=a.LE_Miami_Importance__c;
          c.PURE_Agent__c=a.PURE_Agent__c;
          c.LE_Miami_agent__c=a.LE_Miami_agent__c;
          c.WAA_agent__c=a.WAA_agent__c;
       }
       update contactsToUpdate;
   }


}

***

@isTest
private class Contact_Update{
    static testMethod void Contact_Importance_Update(){

        //Query the record types by developername to get their Ids
        RecordType acctExhibitorRT = [Select Id From RecordType Where sObjectType = 'Account' And DeveloperName = 'Exhibitor'];

        RecordType contExhibitorRT = [Select Id From RecordType Where sObjectType = 'Contact' And DeveloperName = 'Exhibitor'];                        
                 
        Account acc = new Account(
            Name = 'testaccount'
            ,Street__c = 'teststreet'
            ,Country_area_code__c = 'Afghanistan (GMT +4:30; area code +93)'
            ,Region__c = 'Asia - South-Central (and India Sub-Cont.)'
            ,RecordTypeId = acctExhibitorRT.Id //Set this account to the exhibitor Record Type
        );
        insert acc;
                    
        Contact con = new Contact(
            AccountId = acc.id
            ,Lastname = 'testcontact'
            ,Firstname ='testdata1'
            ,Email = 'lakis@o2.pl'
            ,OwnerId = Userinfo.getUserid()
            ,Country__c = 'Afghanistan (GMT +4:30; area code +93)'
            ,Region__c = 'Asia - South-Central (and India Sub-Cont.)'
            ,RecordTypeId = contExhibitorRT.Id //Set this contact to the exhibitor record type
        );
        insert con;

        acc.PURE_Importance__c = 'Leader';
        acc.PURE_Agent__c = 'Name1';
        acc.LE_Miami_Importance__c = 'In Hand';
        acc.LE_Miami_Agent__c = 'Name2';
        acc.WAA_Importance__c = 'Suspect';
        acc.WAA_Agent__c = 'Name3';
              
        Test.startTest();
        update acc;
        Test.stopTest();

        //Requery the contact record and check to make sure it was updated.
        Contact result = 
            [Select
                PURE_Importance_Contact__c
                ,We_Are_Africa_Importance_Contact__c
                ,LE_Miami_Importance_Contacts__c
                ,PURE_Agent__c          
                ,LE_Miami_agent__c
                ,WAA_agent__c
            From
                Contact
            Where
                Id = :con.Id];

        System.assertEquals(acc.PURE_Importance__c,result.PURE_Importance_Contact__c);
        System.assertEquals(acc.WAA_Importance__c,result.We_Are_Africa_Importance_contact__c);
        System.assertEquals(acc.LE_Miami_Importance__c,result.LE_Miami_Importance_contacts__c);
        
        System.assertEquals(acc.PURE_Agent__c,result.PURE_Agent__c);
        System.assertEquals(acc.WAA_agent__c,result.WAA_Agent__c);
        System.assertEquals(acc.LE_Miami_agent__c,result.LE_Miami_agent__c);
        
    }
}
  • December 10, 2015
  • Like
  • 0
Hey everyone,

It's my first attempt to write a test class. I have the following trigger and I'm struggling to write a test big time. Can anyone assist?

The case is pretty simple... If one of the picklist values on the Account with the specific record type 'Exhibitor'  is changed, corresponding picklists on related Contact records (Contact record type is called 'Exhibitor') must update.

***
trigger Contact_Importance_Update on Account (before update) {

    Id recTypeId = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Exhibitor').getRecordTypeId(); //using it like this you won't have problems to deploy (and it'll save you a query)
    
    List<Account> accountsToVerify = new List<Account>();

   for(account a : trigger.new){
       if(a.RecordTypeId == recTypeId  //checks if the account has the correct RecordType
          && (a.PURE_Importance__c != trigger.oldMap.get(a.Id).PURE_Importance__c
          || a.WAA_Importance__c != trigger.oldMap.get(a.Id).WAA_Importance__c
          || a.LE_Miami_Importance__c != trigger.oldMap.get(a.Id).LE_Miami_Importance__c
          || a.PURE_Agent__c != trigger.oldMap.get(a.Id).PURE_Agent__c
          || a.LE_Miami_agent__c != trigger.oldMap.get(a.Id).LE_Miami_agent__c
          || a.WAA_agent__c != trigger.oldMap.get(a.Id).WAA_agent__c)){ //checks if the picklist is changed
           accountsToVerify.add(a);
       }
   }

   if(!accountsToVerify.isEmpty()){ //will only process if there's a need to.
      List<Contact> contactsToUpdate = [SELECT Id, AccountId, FirstName FROM Contact WHERE AccountId IN :accountsToVerify];
      for(Contact c : contactsToUpdate){
          Account a = trigger.newMap.get(c.AccountId);

          c.PURE_Importance_contact__c=a.PURE_Importance__c;
          c.We_Are_Africa_Importance_contact__c=a.WAA_Importance__c;
          c.LE_Miami_Importance_contacts__c=a.LE_Miami_Importance__c;
          c.PURE_Agent__c=a.PURE_Agent__c;
          c.LE_Miami_agent__c=a.LE_Miami_agent__c;
          c.WAA_agent__c=a.WAA_agent__c;
       }
       update contactsToUpdate;
   }


}
***

I got as far as this and I guess faaaaar away. Not sure how to relate records and how to make sure correct record type is called.

@isTest
                private class Contact_Update
                {
                     static testMethod void Contact_Importance_Update()
                  {
                                        
                    Account acc = new Account(name = 'testaccount',Street__c = 'teststreet', Country_area_code__c = 'Afghanistan (GMT +4:30; area code +93)', Region__c = 'Asia - South-Central (and India Sub-Cont.)');
                    insert acc;
                    
                    Contact con = new Contact(AccountId = acc.id,lastname = 'testcontact' , firstname ='testdata1',OwnerId = Userinfo.getUserid(), Country__c = 'Afghanistan (GMT +4:30; area code +93)', Region__c = 'Asia - South-Central (and India Sub-Cont.)');
                    insert con;
                  
                    Account a = new Account();
        
                    a.PURE_Importance__c = 'Leader';
                    a.PURE_Agent__c = 'Name1';
                    a.LE_Miami_Importance__c = 'In hand';
                    a.LE_Miami_Agent__c = 'Name2';
                    a.WAA_Importance__c = 'Suspect';
                    a.WAA_Agent__c = 'Name3';
        
                    update a;
                  
                   }
                   
      
           }
  • December 07, 2015
  • Like
  • 0
We have 3 Lead Record Types: Interior Extended Conversion, Interior Quick Convert and Interior Trad Show Lead

If we create any of the mentioned leads and then convert them to an Account and Opportunity using the convert button, is there a way to specify which type of account and opportunity it will be saved as? 

For example:

If the lead record type is "Interior Quick Convert" it should map to:
1. Account Record Type: Interior Contractor
2. Opportunity Record Type: Interior Quick Convert Opportunity


Another example:

If the lead record type is "Interior Extended Conversion" it should map to:
1. Account Record Type: Interior Contractor
2. Opportunity Record Type: Interior Contractor

Any direction on how to accomplish this would be appreciated. 

Thanks!
JH