Blue Flower

The Undettered New Button

Removing the New Button in Salesforce related lists and tabs seems to be something we all want to do at some point in time, but despite 11 years and nearly 14,000 points we still don't have that ability.

The ability we do have though is to redirect the New button to a Visual Force page.

Welcome to SalesforceBeastie.com!

 

My name is Frances and I'm just getting this site up and running, so please forgive me if the information is a little sparse.

I started my role as Salesforce Administrator as an accidental Admin, coming into the role as a "natural transition" when we needed someone to take over the our brand new Salesforce platform and help navigate the development of the platform to meet our growing company's new needs.

Knowing nothing about Salesforce, but recognizing the great capacity and flexability of the Salesforce platform over our previous Dynamics system, and the unique learning opportunity the Trailhead provided, I made the leap from Director of Customer Success to Salesforce Administrator and began my journey on the Salesforce platform.

Now I'm a Ranger and a certified Administrator working toward being an "Admineloper" with the goal of becoming a Technical Architect. On my way, I hope I might be able to share some tips, tools and tricks with you that I have learned and perhaps help fellow admins and users expand their skills of take more advantage of the platform Salesforce provides.

Apex Learning

General Info

/* this comments out to close of */      
       
       

For Loops:

Loops through the entire list and then exits based on the size of the list.

List <string> myList=new List <string> {'purple','red','blue','yellow', 'green'};
//    for (integer k=0; k<=mylist.size ()-1; k++) (option 1)

// (shorthand option)
for(string j:mylist)

{
    system.debug (j);
}

 

Break the For Loop

Allows you to stop the execution of the loop at any point.

Example 1- With a List

List <integer> values=new List <integer> {1,2,3,8,-1,7,9};
for (integer i=0; i<values.size(); i++)
//is zero less than 7? If yes iterate through the loop and print the value (first-round = 1).
{
    System.debug (values [i]);
//checks to ensure that this condition is not met; if = no: reiterate loop with i++ value; if = yes: execute break

    if(values [i]==3)
    {
        break;
    }
  
}

 Example 2- General For loop

for (integer i=1; i<=100; i++)
//i=1 is initialization clause, and only runs 1x
//after i=1 it evaluates the loop conditions each time   
{
    System.debug (i);
    if(i==5)
        break;
}

 

Continue the For Loop

Allows you to stop the current loop and move to a new one.

For Each Loop = size of list does not matter in this type of loop

Example 1

Prints all the values in the list EXCEPT 77

List <integer> myList=new List <integer> {100,7,90,77,6,5};
    for (integer value:myList)
{
    if (value==77)
    {
        continue;
    }
    System.debug(value);
}

Example 2

Prints all the values in the list EXCEPT 77 (both times)

List <integer> myList=new List <integer> {100,7,90,77,6,5,77,900};
    for (integer j:myList)
{
    if (j==77)
    {
        continue;
    }
    System.debug(j);
}

This occurs because the continue sends it back through the loop BEFORE the System.debug is executed.

Example 3

List <string> myList=new List<string> {'cat','bear', 'dog','bird', 'giraffe'};
    for (string y:myList)
{
    if (y.startsWith('b'))
    {
        continue;
    }
    System.debug(y);
}

Prints only cat, dog and giraffe.

 

Nested Loops

For each positive iteration of the outer loop the inner loop will execute its entire set of criterion. Thus for the equation below the 'b' loop will execute 0-2 for each iteration of 'a'.

Example 1

A B A B A B A B
0 0 1 0 2 0 3 0
0 1 1 1 2 1 3 1
0 2 1 2 2 2 3 2

//outer loop

for(integer a=0; a<=3;a++)
{

//inner loop
    for (integer b=0; b<=2;b++)
    {
        System.debug ('a='+a+' b='+b);
    }
}

Example 2

Desired Result:

/*
1
22
333
4444*/
for(integer i=1; i<=4;i++)
{
    //key is the value of i which allows step-wise iterations; as I increases j can execute successively more times.
    for (integer j=1; j<=i;j++)
    {
       //by printing the value of i not j, you get the value of i iterated progressively with each inner loop
        System.debug (i);
    }
 
}

 

I J Prints I J Prints I J Prints I J Prints
I=1 J=1 I= 1 I=2 J=1 I=2 I=3 J=1 I=3 I=4 J=1 I=4
  J=2>I     J=2 I=2   J=2 I=3   J=2 I=4
        J=3>I     J=3 I=3   J=3 I=4
              J=4>I     J=4 I=4
                    J=5>I  

 Example 3

/*
1
12
123
1234*/
for(integer i=1; i<=4;i++)
{
    //key is the value of i which allows step-wise iterations; as I increases j can execute successively more times.
    for (integer j=1; j<=i; j++)
    {
       //by printing the value of J not I, you get the value of J iterated progressively with each inner loop
        System.debug (J);
    }
 
}

I J Prints I J Prints I J Prints I J Prints
I=1 J=1 J= 1 I=2 J=1 J=1 I=3 J=1 J=1 I=4 J=1 J=1
  J=2>I     J=2 J=2   J=2 J=2   J=2 J=2
        J=3>I     J=3 J=3   J=3 J=3
              J=4>I     J=4 J=4
                    J=5>I  

 

 Loop Assignments

Q1

List <integer> Q1=new list<integer> {1,4,7,10,13,16};
    //method is mylist.size
    //-1 allows you display all the variables because index starts at zero
for(integer i=0;i<=Q1.size()-1;i++)
{
    System.debug(Q1[i]);
}

OR

for (integer i=1;i<=16;i=i+3)
{
    System.debug (i);
}

Q2

List <integer> Q2=new list<integer> {20,15,10,5};
    //method is mylist.size
    //-1 allows you display all the variables because index starts at zero
for(integer i=0;i<=Q2.size()-1;i++)
{
    System.debug(Q2[i]);
}

 

OR

//for decreasing values, iterate to the lowest value to close the loop

for (integer i=20;i>=5;i=i-5)
{
    System.debug (i);
}

 Q3

 for (integer i=2;i<=10;i=i+2)
{
    System.debug (i);
}

We made several major transitions in our business practices as part of our migration to Salesforce. One of these major changes involved tracking the industry vertical of each of the Accounts that we had in the system. Moving the Accounts from our Dynamics system to Salesforce involved migrating several thousand records, none of which had verticals, and many of which might no longer be active. As part of this same transition, we added an outbound sales team and business development agents. This involved new processes and agents that our company had no previous experience with and that added novel requirements to our current business processes.

We needed an Opportunity generation process that would allow us to address all these needs. Why do this through the Opportunity? An active Opportunity indicates an active Account and Contact, so we know that these Accounts need classification in our system. The opportunity is also a place where our company really differentiates how each of our teams function. The result is the following Visual Flow, which is described in its development in the Problems and Business Requirements below.

Problem 1. Identifying Active Accounts and back filling the necessary data to them.

Business Requirement 1

All Accounts in the system needed verticals, but the size of doing the task manually prior to uploading the data would have prohibitively slowed the progress of our Salesforce deployment.

Business Requirement 2

As a result of adding outbound sales to our team, a business rule was made that Account should only be owned by agents in our Customer Success Department, regardless of who created the Account. However we did not want to lose the value of the creator of the Account.

Business Requirement 3

The Customer Success Agents, rather than serving on a first-come first-serve basis, would work in specific verticals to develop the needed specialization to support their customer base's unique needs.

Business Requirement 4

As the process progressed, Accounts that were not receiving vertical assignments could be targeted by outbound sales or purged if they were no longer potential clients or duplicates.

 

 

Problem 2. Addressing the interface needs of 4 different user types with a single flow.

 

Problem 3. The "New Button".

Built a VF page for redirecting New Opportunity Buttons in Lightning that can't be hidden to redirect users back to contacts where the Create New OPP flow fires from called NewOpportunityRedirect

Had set permissions, insufficient permissions.