• Ruby Kandah
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 16
    Replies
Hi ---

I would like to create a custom button on the account page which, when selected, will take a full address from the Salesforce account page, push it to Google maps and the geocode from Google Maps will pass back onto the Salesforce account page.

"Google Maps" in this case is actually a custom map application built by my company. 

What I'm looking for is guidance on how to set something like this up. Any example code would be helpful, 


Thanks!
Hi All, 

I am trying to create a formula field on my opportunity object that does this:
1) Sort opportunities owned by rep
2) Filter opportunities that have reached stage = Closed Won
3) From these CW ops, sort by Close date (first close date should be first, most recent close date should be last)
4) Once sorted, assign it a count (i.e. Op CW on 1/1/2016 = 1...11/16/16 = 100)
5) Repeat this for the next rep

Can someone help me write this formula out?

 
Hi -- 
I am receiving this error: Invalid field Restaurant__ID__c for SObject Account

Here is a partial copy of the critical lines of code in my controller:

 public ObjectStructureMap[] formatObjectStructure( String currentId ){
    
        List<ObjectStructureMap> asm = new List<ObjectStructureMap>{};
        masm.clear();

        //Change below
        List<Account> al            = new List<Account>{};
        List<ID> currentParent      = new List<ID>{};
        Map<ID, String> nodeList    = new Map<ID, String>{};
        List<String> nodeSortList   = new List<String>{};
        List<Boolean> levelFlag     = new List<Boolean>{};
        List<Boolean> closeFlag     = new List<Boolean>{};
        String nodeId               = '0';
        String nodeType             = 'child';
        Integer count               = 0;
        Integer level               = 0;
        Boolean endOfStructure      = false;
        
        //Find highest level obejct in the structure
        currentParent.add( GetTopElement( currentId ) );

        //Loop though all children
        while ( !endOfStructure ){

            if( level == 0 ){
                //Change below     
                al = [ SELECT a.Type, a.Site, a.ParentId, a.OwnerId,a.Restaurant_ID__c,a.Name,a.Deck_Rank__c, a.Market_Area__c,a.Lead_List__c,a.Phone,a.GPV_30_days__c,a.LastActivityDate,a.Account_Type__c,a.Lead_Type__c,a.Owner.Alias, a.Id FROM Account a WHERE a.id IN : CurrentParent ORDER BY a.Name ];
            } 
            else {
                //Change below      
                al = [ SELECT a.Type, a.Site, a.ParentId, a.OwnerId,  a.Restaurant_ID__c,a.Name,a.Deck_Rank__c, a.Market_Area__c,a.Lead_List__c,a.Phone,a.GPV_30_days__c,a.LastActivityDate,a.Account_Type__c,a.Lead_Type__c,a.Owner.Alias, a.Id FROM Account a WHERE a.ParentID IN : CurrentParent ORDER BY a.Name ];
            }

            if( al.size() == 0 ){
                endOfStructure = true;
            }
            else{
                currentParent.clear();
                for ( Integer i = 0 ; i < al.size(); i++ ){
                    //Change below
                    Account a = al[i];
                    nodeId = ( level > 0 ) ? NodeList.get( a.ParentId )+'.'+String.valueOf( i ) : String.valueOf( i );
                    masm.put( NodeID, new ObjectStructureMap( nodeID, levelFlag, closeFlag, nodeType, false, false, a ) );
                    currentParent.add( a.id );
                    nodeList.put( a.id,nodeId );
                    nodeSortList.add( nodeId );
                }
                
                maxLevel.add( level );                
                level++;
            }
        }
        
        //Account structure must now be formatted
        NodeSortList.sort();
        for( Integer i = 0; i < NodeSortList.size(); i++ ){
            List<String> pnl = new List<String> {};
            List<String> cnl = new List<String> {};
            List<String> nnl = new List<String> {};
            
            if ( i > 0 ){
                String pn     = NodeSortList[i-1];
                pnl         = pn.split( '\\.', -1 );
            }

            String cn     = NodeSortList[i];
            cnl         = cn.split( '\\.', -1 );

            if( i < NodeSortList.size()-1 ){
                String nn = NodeSortList[i+1];
                nnl = nn.split( '\\.', -1 );
            }
            
            ObjectStructureMap tasm = masm.get( cn );
            if ( cnl.size() < nnl.size() ){
                //Parent
                tasm.nodeType = ( isLastNode( cnl ) ) ? 'parent_end' : 'parent';
            }
            else if( cnl.size() > nnl.size() ){
                tasm.nodeType     = 'child_end';
                tasm.closeFlag     = setcloseFlag( cnl, nnl, tasm.nodeType );
            }
            else{
                tasm.nodeType = 'child';
            }
            
            tasm.levelFlag = setlevelFlag( cnl, tasm.nodeType ); 
            
            //Change below
            if ( tasm.account.id == currentId ) {
                tasm.currentNode = true;
            }
            asm.add( tasm );
        }
        
        asm[0].nodeType             = 'start';
        asm[asm.size()-1].nodeType     = 'end';
        
        return asm;
    }
    

and here is the relevant chunk of my visualforce page:

  <apex:outputLink value="/{!pos.account.id}" style="{!IF(pos.currentNode,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!pos.account.name}</apex:outputLink>

<!-- Include the following if you uses sites with accounts -->
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Restaurant__ID__c}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Deck_Rank__c}"rendered="{!IF(pos.account.Deck_Rank__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Lead_List__c}" rendered="{!IF(pos.Lead_List__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Phone}" rendered="{!IF(pos.Phone!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.GPV_30_days__c}" rendered="{!IF(pos.GPV_30_days__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.LastActivityDate}" rendered="{!IF(pos.LastActivityDate!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Account_Type__c}" rendered="{!IF(pos.Account_Type__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Lead_Type__c}" rendered="{!IF(pos.Lead_Type__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Owner.Alias}" rendered="{!IF(pos.Owner.Alias!= '', true, false)}"/>&nbsp;
<!-- Stop -->
            </span>
            <div> </div>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),false,true)}">
                <div id='{!pos.nodeId}'>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),true,false)}">
                <div id='{!pos.nodeId}'><apex:image url="/s.gif" alt="" width="1" height="1"/></div>
            </apex:outputText>
            <apex:repeat value="{!pos.closeFlag}" var="close">
                </div>
            </apex:repeat>            


Can someone help me here?

Hi All, 

I have created a button "Request Edit" on the account page...I have it linked to a URL that displays a new case creation page.

On this case creation page, I have fields such as "Account Name", "Opportunity Name" etc...what I would like this "Request Edit" button to do, is that, when it is clicked from the account, it opens up the new case page and "Account Name" and "Opportunity Name" are auto-populated from the Account page where the "Request Edit" button actually sits. 

Can someone help me out with this?


RK

Hi Everyone, 

I'm trying to program a validation rule and needed some help. Essentially, I have 3 fields that I would like to incorporate in this rule: Account Type (Picklist field), Deck Rank (Picklist field) and Lead List (Date field). 

I want the rule logic to be something like this:
IF Account Type = GM Pick, someone can only change Deck Rank to "Ace of Spades" IF PRIORVALUE of Deck Rank was "Ace" AND there should be no more than 5 Ace of Spades for Lead List = 09/01/2016

Can someone help me translate this to Salesforce language?


Thank you!
Hey Everyone! 

I want fields (picklist and text fields) in my Case Object to be linked to similar fields in the Account Object. I am trying to use Flow Designer + Process Builder to accomplish this, but I can't seem to get it to trigger. Can anyone help me out with this?

Thanks!
Hi -- 
I am receiving this error: Invalid field Restaurant__ID__c for SObject Account

Here is a partial copy of the critical lines of code in my controller:

 public ObjectStructureMap[] formatObjectStructure( String currentId ){
    
        List<ObjectStructureMap> asm = new List<ObjectStructureMap>{};
        masm.clear();

        //Change below
        List<Account> al            = new List<Account>{};
        List<ID> currentParent      = new List<ID>{};
        Map<ID, String> nodeList    = new Map<ID, String>{};
        List<String> nodeSortList   = new List<String>{};
        List<Boolean> levelFlag     = new List<Boolean>{};
        List<Boolean> closeFlag     = new List<Boolean>{};
        String nodeId               = '0';
        String nodeType             = 'child';
        Integer count               = 0;
        Integer level               = 0;
        Boolean endOfStructure      = false;
        
        //Find highest level obejct in the structure
        currentParent.add( GetTopElement( currentId ) );

        //Loop though all children
        while ( !endOfStructure ){

            if( level == 0 ){
                //Change below     
                al = [ SELECT a.Type, a.Site, a.ParentId, a.OwnerId,a.Restaurant_ID__c,a.Name,a.Deck_Rank__c, a.Market_Area__c,a.Lead_List__c,a.Phone,a.GPV_30_days__c,a.LastActivityDate,a.Account_Type__c,a.Lead_Type__c,a.Owner.Alias, a.Id FROM Account a WHERE a.id IN : CurrentParent ORDER BY a.Name ];
            } 
            else {
                //Change below      
                al = [ SELECT a.Type, a.Site, a.ParentId, a.OwnerId,  a.Restaurant_ID__c,a.Name,a.Deck_Rank__c, a.Market_Area__c,a.Lead_List__c,a.Phone,a.GPV_30_days__c,a.LastActivityDate,a.Account_Type__c,a.Lead_Type__c,a.Owner.Alias, a.Id FROM Account a WHERE a.ParentID IN : CurrentParent ORDER BY a.Name ];
            }

            if( al.size() == 0 ){
                endOfStructure = true;
            }
            else{
                currentParent.clear();
                for ( Integer i = 0 ; i < al.size(); i++ ){
                    //Change below
                    Account a = al[i];
                    nodeId = ( level > 0 ) ? NodeList.get( a.ParentId )+'.'+String.valueOf( i ) : String.valueOf( i );
                    masm.put( NodeID, new ObjectStructureMap( nodeID, levelFlag, closeFlag, nodeType, false, false, a ) );
                    currentParent.add( a.id );
                    nodeList.put( a.id,nodeId );
                    nodeSortList.add( nodeId );
                }
                
                maxLevel.add( level );                
                level++;
            }
        }
        
        //Account structure must now be formatted
        NodeSortList.sort();
        for( Integer i = 0; i < NodeSortList.size(); i++ ){
            List<String> pnl = new List<String> {};
            List<String> cnl = new List<String> {};
            List<String> nnl = new List<String> {};
            
            if ( i > 0 ){
                String pn     = NodeSortList[i-1];
                pnl         = pn.split( '\\.', -1 );
            }

            String cn     = NodeSortList[i];
            cnl         = cn.split( '\\.', -1 );

            if( i < NodeSortList.size()-1 ){
                String nn = NodeSortList[i+1];
                nnl = nn.split( '\\.', -1 );
            }
            
            ObjectStructureMap tasm = masm.get( cn );
            if ( cnl.size() < nnl.size() ){
                //Parent
                tasm.nodeType = ( isLastNode( cnl ) ) ? 'parent_end' : 'parent';
            }
            else if( cnl.size() > nnl.size() ){
                tasm.nodeType     = 'child_end';
                tasm.closeFlag     = setcloseFlag( cnl, nnl, tasm.nodeType );
            }
            else{
                tasm.nodeType = 'child';
            }
            
            tasm.levelFlag = setlevelFlag( cnl, tasm.nodeType ); 
            
            //Change below
            if ( tasm.account.id == currentId ) {
                tasm.currentNode = true;
            }
            asm.add( tasm );
        }
        
        asm[0].nodeType             = 'start';
        asm[asm.size()-1].nodeType     = 'end';
        
        return asm;
    }
    

and here is the relevant chunk of my visualforce page:

  <apex:outputLink value="/{!pos.account.id}" style="{!IF(pos.currentNode,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!pos.account.name}</apex:outputLink>

<!-- Include the following if you uses sites with accounts -->
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Restaurant__ID__c}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Deck_Rank__c}"rendered="{!IF(pos.account.Deck_Rank__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Lead_List__c}" rendered="{!IF(pos.Lead_List__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Phone}" rendered="{!IF(pos.Phone!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.GPV_30_days__c}" rendered="{!IF(pos.GPV_30_days__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.LastActivityDate}" rendered="{!IF(pos.LastActivityDate!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Account_Type__c}" rendered="{!IF(pos.Account_Type__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Lead_Type__c}" rendered="{!IF(pos.Lead_Type__c!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.Owner.Alias}" rendered="{!IF(pos.Owner.Alias!= '', true, false)}"/>&nbsp;
<!-- Stop -->
            </span>
            <div> </div>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),false,true)}">
                <div id='{!pos.nodeId}'>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),true,false)}">
                <div id='{!pos.nodeId}'><apex:image url="/s.gif" alt="" width="1" height="1"/></div>
            </apex:outputText>
            <apex:repeat value="{!pos.closeFlag}" var="close">
                </div>
            </apex:repeat>            


Can someone help me here?
Hi Everyone, 

I'm trying to program a validation rule and needed some help. Essentially, I have 3 fields that I would like to incorporate in this rule: Account Type (Picklist field), Deck Rank (Picklist field) and Lead List (Date field). 

I want the rule logic to be something like this:
IF Account Type = GM Pick, someone can only change Deck Rank to "Ace of Spades" IF PRIORVALUE of Deck Rank was "Ace" AND there should be no more than 5 Ace of Spades for Lead List = 09/01/2016

Can someone help me translate this to Salesforce language?


Thank you!
Hey Everyone! 

I want fields (picklist and text fields) in my Case Object to be linked to similar fields in the Account Object. I am trying to use Flow Designer + Process Builder to accomplish this, but I can't seem to get it to trigger. Can anyone help me out with this?

Thanks!