• Steve_Early
  • NEWBIE
  • 19 Points
  • Member since 2014
  • Global CRM Administration
  • Novanta, Inc. - Bedford, MA


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 20
    Replies
We have the Inline Account Hierarchy app from Salesforce labs installed. It has been installed and working fine since July 2014 and I've made several Change Set deployments since them without incident. I am now suddenly unable to deploy a Flow from our Sandbox to Production, and this application is the one that is failing the code tests. (I don't have a lot of Apex in the system, (I'm not a programmer) and what Apex I do have is all from 3rd party AppExchange apps like this one.) My code coverage has suddenly gone from something like 89% to 29%. on the AccountStructure class 0 out of 133 lines are passing, and other Classes related to this application are getting 41%, 71% and 84% coverage which is all a bit disturbing.

I haven't altered the test scripts since they were installed.
I have turned off the two validation rules that were running against the account object.
I have added a couple of new custom account fields, but they do not have validation statements in them.
I have added one rollup field recently that counts the number of opportunities on the account. 

Since I have no experience in writing test cases, and have never had to deal with code coverage issues before:

Are there other things I should check?
Are there resources I can reference to learn more?
Does anyone have any ideas on how to fix this?

I don't want to have to delete the application because one of our business units relies on it, but it may come to that if I can't deploy things to production!

Specific errors I encounter are:

Class.InlineAcountHerachy_TestUtilities.updateAccountList: line 106, column 1
Class.AccountHierarchyTestData.createTestHierarchy: line 33, column 1
Class.testAccountHierarchy.testAccountHierarchy: line 6, column 1

First error code near error "106, column 1"
101       if ( this.checkObjectCrud('Account', fieldsToCheck, 'create') && !this.testAccList.isEmpty() ){
102         try{
103           update this.testAccList;
104         }
105         catch( Exception ex ){
106          System.assert( false ,'Pre deploy test failed, This may be because of custom validation rules in your Org. You can check ignore apex errors or temporarily deactivate your validation rules for Accounts and try again.');
107        }
108       }
109       else{
110         System.Assert(false , 'You need right over Account Object');
111       }

Second error at line 33, column 1

26         // Create 10 sub accounts
27       testUtils.createAccounts( 10 , fieldsToCheck );
28       Integer i = 0;
29         for ( Account accAux : testUtils.testAccList ){ //Now i need change the names
30           accAux.Name = 'HierarchyTest' + String.valueOf( i );
31             i++;
32         }
33         testUtils.updateAccountList( fieldsToCheck );        
34         
35         List<Account> accountList = [ Select Id, parentID, name from account where name like 'HierarchyTest%' ORDER BY Name limit 10 ];
36                 
37         for ( Integer x = 0; x < accountList.size(); x++ ){
38             if ( accountList[x].name != 'HierarchyTest0' ){
39                 accountList[x].parentID = parentID;
40                 parentID = accountList[x].Id; 
41             }

Last error at line 6, column 1
1 @isTest
2 private class testAccountHierarchy{
3
4     static testMethod void testAccountHierarchy(){
5
6         AccountHierarchyTestData.createTestHierarchy();
7
8         Account topAccount      = [ Select id, name from account where name = 'HierarchyTest0' limit 1 ];
9         Account middleAccount   = [ Select id, parentID, name from account where name = 'HierarchyTest4' limit 1 ];
10         Account bottomAccount   = [ Select id, parentID, name from account where name = 'HierarchyTest9' limit 1 ];
11         Account[] accountList   = [ Select id, parentID, name from account where name like 'HierarchyTest%' ];
12
13         test.startTest();

Any guidance will be greatly appreciated.
 

Greetings all and Happy New Year - 

I'm attempting to provide a way for engineers to send an template email to some people that have sent in a new case via Email2 Case (we do not want to send email on all new cases). I have set up a button using:

Detail Page Button
Execute JavaScript - OnClick JavaScript
The selected behavior is View in New Window

The script I am using is:

location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00Xf0000000IQPO&p26={!Case.From_2__c}&p5=')

This script behaves as desired and sends the email I expect.

I have tried unsuccessfully to also make this script change a field value on the Case (checkbox) from False to True. So far I have tried:
&{!Case.Initial_Email_Sent__c}=true
&{!Case.Initial_Email_Sent__c}='true'
&{!Case.Initial_Email_Sent__c}=1
&{!Case.Initial_Email_Sent__c}=-'1'

and also via URL hack:
&00Nf0000000vKwV=1
&00Nf0000000vKwV=true .... etc. 

where '00Nf0000000vKwV' is the custom field identifier.

Once I try to add the field change, things break. The errors I get are either that the URL is no longer valid, or there is a left hand error. Can this be done or am I whistling in the wind here?

Thanks!

 

We are using this set of formulas to test to see if the quantity price is null. If it isn't it should be output, otherwise it is skipped.

IF(ISNULL(Product2.Qty_1_9__c),"","$"&TEXT(Product2.Qty_1_9__c)&BR())
&IF(ISNULL(Product2.Qty_10_49__c),"","$"&TEXT(Product2.Qty_10_49__c)&BR())
&IF(ISNULL(Product2.Qty_50_199__c),"","$"&TEXT(Product2.Qty_50_199__c)&BR())
&IF(ISNULL(Product2.Qty_200_499__c),"","$"&TEXT(Product2.Qty_200_499__c)&BR())
&IF(ISNULL(Product2.Qty_500_999__c),"","$"&TEXT(Product2.Qty_500_999__c)&BR())
&IF(ISNULL(Product2.Qty_1000__c),"","$"&TEXT(Product2.Qty_1000__c)&BR())),"",

The goal is to have output on a Quote:
Qty 1-9  $15
Qty 10-19  $14.45
Qty 20-39  $13.95

It works fine with one exeption: If the price ends in zeroes ($15.00) on the PDF output we are seeing is "$15.0" - the second zero is being dropped. The field involved is set up with 2 decimal places.

Is there anything I can put in this formula to force the second 0 to print on PDF output? 
I have a checkbox field (controlling) with an associated multi-select picklist field (dependent). I want the dependent picklist field to remain hidden UNLESS the checkbox field is checked. I am having trouble working this one. I already have a validation rule where the dependent field must have at least one selection if the controlling field is checked, but I do not want the depedent field to be visible to the users at all if the controlling field is not checked. Does anyone have a solution for this?

Thank you!
Hello Everyone!!

I am trying to figure out how to create a button (called "Full Year") within the Case are of the accounts so that when clicked it will create 12 separate cases, associated with that specific account, and each case representing a month (ie. Jan-2015, Feb-2015, Mar-2015, etc)

And also another button (called "Partial Year") that when clicked, will create cases that are leftover for that year (ie. If button is clicked in September 10th 2015, it will create 4 cases called Sept-2015, Oct-2015, Nov-2015, Dec-2015)

Does that make sense?  Is this possible?

After doing this I want to also be able to, once the specific case is closed, will Trigger the deletion of the uploaded file on the case and the automatic upload to Cirrus Files/Google Drive integration...

I know it's a lot to ask, but I've tried with SalesForce Customer Service, but they say it is outside of their allowed help...

Thank you!!
Hi, I keep getting errors while checking the creating list view challenge.(other challenges worked and completed)
 I have created the view correctly. see attached screenshots. User-added imageUser-added image
SF Ultimate/Wind 8.1
I am new to SF, so my question: I have an Accountfield called Black with content X and I have to
put the X value in the same Black field in the RELATED Contactfield. (some 50.000 records)
How to do this  ?
Thanks for reply.
 
I do not have the option in IE 11 to switch to Lightning Experience.  I do, however, have the option in Chrome.  What might be the issue?

What I see in Chrome:
Chrome

What I see in IE 11:
IE 11
IE 11 version information:
User-added image
I have 3 custom, locked buttons that show when I am editing the page layout but when I go to create a new record using that same layout the buttons do not appear. I have checked the field security and it is correct.
I want an email alert to be send all 14 days before my expiry date.
how to do it??
How can i achive this?? Do I have to use schedular apex??
Help needed asap.
Thanks.
Hi.  I'm a bit confused with the screenshot below and would like some clarity.  I want to make sure that my points/badges remain accessible if I ever depart from my current employer.

Trailhead: My username is exactly my work email.  However, the email address in my account is my personal email address.
Developer Account: My username has the domain of my work email but some fictional letters/numbers before the domain.  The email address on this account is also my personal email address.

So what will hypothetically happen if I left my current employer and they deactivate my work email and access to their SFDC org?  Thanks.


User-added image
Hi,

I'm new to all this and need some urgent help. I found a trigger that i modified in our sandbox which works fine. The problem i am having is i do not know how to create a test so i can push it to production. Can you help?

The code is:
 

trigger Guest_Relations_CaseTeamTrigger on Case (after insert) {

    Map<Id, CaseTeamMember> membersToAdd = new Map<Id, CaseTeamMember>();
    List<Case> cases = [Select Id,OwnerId,RecordTypeId,RecordType.Name
                  from Case where id IN :Trigger.newMap.keySet()];
    for (Case c : cases) {
    
      if (c.RecordType.Name == 'Geneva Guest Relations' ||                        
            c.RecordType.Name == 'Guest Relations') {
           
        membersToAdd.put(c.Id, 
          new CaseTeamMember(                   
            ParentId = c.Id,                           
            MemberId = UserInfo.getUserId()
          )
        );
        System.debug('*******************************************');  
        System.debug('User = '+UserInfo.getName());
        
        System.debug('*******************************************');  
      }
    }
    
    if (!membersToAdd.isEmpty()) {
      try {
        CaseTeamRole caseTeamRole = [SELECT Id FROM CaseTeamRole WHERE Name = 'Creator' LIMIT 1];

        for (CaseTeamMember ctm : membersToAdd.values()) {
          ctm.TeamRoleId = caseTeamRole.Id;
        }
      
        for (CaseTeamMember ctm : [SELECT Id, MemberId, ParentId
                       FROM CaseTeamMember
                       WHERE ParentId IN :membersToAdd.keySet()
                       AND MemberId = :UserInfo.getUserId()
                       ORDER BY ParentId]) {
        System.debug('*******************************************');  
        System.debug('User = '+UserInfo.getName());
        
        System.debug('*******************************************');               
          if (membersToAdd.containsKey(ctm.ParentId)) {
            membersToAdd.remove(ctm.ParentId);
          }
        }
        
        if (!membersToAdd.isEmpty()) {
          insert membersToAdd.values();
        }
      } catch (System.QueryException qe) {}
    }
  
}

 
Since my last deployment, which passed, the coverage of my company is rated 64 percent if I run all tests. If I try to deploy something, the coverage is rated 72%. How is that possible?
Since last week our code coverage has decreased by 10%.  The only changes we made were a couple classes no longer are referenced anywhere in our org.  Is this a new Salesforce setting?  I cannot understand what has happened.
I have 2 case assignment rules
a) first one when the status is new and
b) when there is a update to status

The 1st rule works, the 2nd doesn't. Any suggestions on why the 2nd doesn't work on an existing case.
I'm trying to increase our code coverage percentage and finding many issues with actually determining what a class or trigger's coverage is. My current frustration is with a specific class and test.  In our full copy sandbox, I'm getting 96% coverage, 24/25 lines. In production, I'm getting 57% coverage, 16/28 lines.  I know that one of those lines (the one showing up in fullcopy) is actually uncovered; however the other lines that are showing as uncovered in production are close brackets and blank lines.  I tried clearing all test history as that was a suggestion, but it did not fix the problem.  Additionally, when I run the test to cover that class, and click on the specific methods to see all the classes and triggers that it covers, it says 80% coverage, 20/25 lines.  On the class page, it shows the 57% number.  
We have the Inline Account Hierarchy app from Salesforce labs installed. It has been installed and working fine since July 2014 and I've made several Change Set deployments since them without incident. I am now suddenly unable to deploy a Flow from our Sandbox to Production, and this application is the one that is failing the code tests. (I don't have a lot of Apex in the system, (I'm not a programmer) and what Apex I do have is all from 3rd party AppExchange apps like this one.) My code coverage has suddenly gone from something like 89% to 29%. on the AccountStructure class 0 out of 133 lines are passing, and other Classes related to this application are getting 41%, 71% and 84% coverage which is all a bit disturbing.

I haven't altered the test scripts since they were installed.
I have turned off the two validation rules that were running against the account object.
I have added a couple of new custom account fields, but they do not have validation statements in them.
I have added one rollup field recently that counts the number of opportunities on the account. 

Since I have no experience in writing test cases, and have never had to deal with code coverage issues before:

Are there other things I should check?
Are there resources I can reference to learn more?
Does anyone have any ideas on how to fix this?

I don't want to have to delete the application because one of our business units relies on it, but it may come to that if I can't deploy things to production!

Specific errors I encounter are:

Class.InlineAcountHerachy_TestUtilities.updateAccountList: line 106, column 1
Class.AccountHierarchyTestData.createTestHierarchy: line 33, column 1
Class.testAccountHierarchy.testAccountHierarchy: line 6, column 1

First error code near error "106, column 1"
101       if ( this.checkObjectCrud('Account', fieldsToCheck, 'create') && !this.testAccList.isEmpty() ){
102         try{
103           update this.testAccList;
104         }
105         catch( Exception ex ){
106          System.assert( false ,'Pre deploy test failed, This may be because of custom validation rules in your Org. You can check ignore apex errors or temporarily deactivate your validation rules for Accounts and try again.');
107        }
108       }
109       else{
110         System.Assert(false , 'You need right over Account Object');
111       }

Second error at line 33, column 1

26         // Create 10 sub accounts
27       testUtils.createAccounts( 10 , fieldsToCheck );
28       Integer i = 0;
29         for ( Account accAux : testUtils.testAccList ){ //Now i need change the names
30           accAux.Name = 'HierarchyTest' + String.valueOf( i );
31             i++;
32         }
33         testUtils.updateAccountList( fieldsToCheck );        
34         
35         List<Account> accountList = [ Select Id, parentID, name from account where name like 'HierarchyTest%' ORDER BY Name limit 10 ];
36                 
37         for ( Integer x = 0; x < accountList.size(); x++ ){
38             if ( accountList[x].name != 'HierarchyTest0' ){
39                 accountList[x].parentID = parentID;
40                 parentID = accountList[x].Id; 
41             }

Last error at line 6, column 1
1 @isTest
2 private class testAccountHierarchy{
3
4     static testMethod void testAccountHierarchy(){
5
6         AccountHierarchyTestData.createTestHierarchy();
7
8         Account topAccount      = [ Select id, name from account where name = 'HierarchyTest0' limit 1 ];
9         Account middleAccount   = [ Select id, parentID, name from account where name = 'HierarchyTest4' limit 1 ];
10         Account bottomAccount   = [ Select id, parentID, name from account where name = 'HierarchyTest9' limit 1 ];
11         Account[] accountList   = [ Select id, parentID, name from account where name like 'HierarchyTest%' ];
12
13         test.startTest();

Any guidance will be greatly appreciated.
 

Greetings all and Happy New Year - 

I'm attempting to provide a way for engineers to send an template email to some people that have sent in a new case via Email2 Case (we do not want to send email on all new cases). I have set up a button using:

Detail Page Button
Execute JavaScript - OnClick JavaScript
The selected behavior is View in New Window

The script I am using is:

location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00Xf0000000IQPO&p26={!Case.From_2__c}&p5=')

This script behaves as desired and sends the email I expect.

I have tried unsuccessfully to also make this script change a field value on the Case (checkbox) from False to True. So far I have tried:
&{!Case.Initial_Email_Sent__c}=true
&{!Case.Initial_Email_Sent__c}='true'
&{!Case.Initial_Email_Sent__c}=1
&{!Case.Initial_Email_Sent__c}=-'1'

and also via URL hack:
&00Nf0000000vKwV=1
&00Nf0000000vKwV=true .... etc. 

where '00Nf0000000vKwV' is the custom field identifier.

Once I try to add the field change, things break. The errors I get are either that the URL is no longer valid, or there is a left hand error. Can this be done or am I whistling in the wind here?

Thanks!

 

We are using this set of formulas to test to see if the quantity price is null. If it isn't it should be output, otherwise it is skipped.

IF(ISNULL(Product2.Qty_1_9__c),"","$"&TEXT(Product2.Qty_1_9__c)&BR())
&IF(ISNULL(Product2.Qty_10_49__c),"","$"&TEXT(Product2.Qty_10_49__c)&BR())
&IF(ISNULL(Product2.Qty_50_199__c),"","$"&TEXT(Product2.Qty_50_199__c)&BR())
&IF(ISNULL(Product2.Qty_200_499__c),"","$"&TEXT(Product2.Qty_200_499__c)&BR())
&IF(ISNULL(Product2.Qty_500_999__c),"","$"&TEXT(Product2.Qty_500_999__c)&BR())
&IF(ISNULL(Product2.Qty_1000__c),"","$"&TEXT(Product2.Qty_1000__c)&BR())),"",

The goal is to have output on a Quote:
Qty 1-9  $15
Qty 10-19  $14.45
Qty 20-39  $13.95

It works fine with one exeption: If the price ends in zeroes ($15.00) on the PDF output we are seeing is "$15.0" - the second zero is being dropped. The field involved is set up with 2 decimal places.

Is there anything I can put in this formula to force the second 0 to print on PDF output?