• Martin Löffler
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

Hello everybody, 

So I want to use a APEX Class for a one time correction of old data (process for updating contact addresses from accounts came to late). The (batch-)job is finished and works, but when trying to provide the class on my productive environment, I can´t because of missing code coverage.

But since the class won´t be triggered except by me and has no other influence on the system, I don´t understand why Unittests or such would be needed.

So, any idea how to circumvent the problem?

Greetings and thanks in advance

Martin

Hello everybody, 

So I want to use a APEX Class for a one time correction of old data (process for updating contact addresses from accounts came to late). The (batch-)job is finished and works, but when trying to provide the class on my productive environment, I can´t because of missing code coverage.

But since the class won´t be triggered except by me and has no other influence on the system, I don´t understand why Unittests or such would be needed.

So, any idea how to circumvent the problem?

Greetings and thanks in advance

Martin

Create an Apex class that returns an array (or list) of strings: 
Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.

MyApexClass to above Challenge:

public class StringArrayTest {
    
    public static List<string> generateStringArray(Integer n)
    {
        List<String> myArray = new List<String>();
        
        for(Integer i=0;i<n;i++)
        {
            myArray.add('Test'+i);
            System.debug(myArray[i]);
        }
        return myArray;
        
    }


It's compile and execute as per requirement in Developer console. But Traihead showing the below error:

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.

Anyhelp would be greatly appreciated. Thanks.
 

Hi guys,

 

I got some work related to removing duplicate prduct entries from Salesforce org, complete scenario as,

We had created to custom priceboks called Australia and NewZealand and seperatly inserted products in the same.

later we come to know that, there are many products which are actually same but get created seperatly for each of the pricebook(As u all aware that single product can exist in multiple pricebook). so I want to removed this duplicated products.

 

Main problem is that, the salesforce environment is Live, and there are lot more opportunities having references to this products, so I can't directly delete this products.

 

So is there any solution for this problem

 

Thanks in advance.

regards.