• Dave Berenato
  • NEWBIE
  • 185 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 33
    Questions
  • 51
    Replies
Is there anything I can do to the difference between two dates to convert it to a number that could be used in a large calculation (multiply by an integer or a currency field) in a field update for a currency field?
DATE(2019,7,1) – DATE(2019,5,1)

This by itself, as well as in the larger formula where this difference is used to calculate a pro-rated price, gives a "Syntax Error" for a Field Update to a Currency Field
I'm trying to set up a Validation rule to show an error if both of the below fields are filled in but not if both are blank. 

or( 
and(!isblank( Strategic_Partner__c ),!ISBLANK( Reseller__c )), 
or(!ISBLANK( Reseller__c) ,!isblank( Strategic_Partner__c )) 
)
If I have a column in an Apex:PageBlockTable for a Long Text Area, can I have the field Truncated to a certain number of characters with a Show More Link?
 
<apex:column width="300px">

            <apex:facet name="header">Description</apex:facet>

            <apex:outputText value="{!task.description}"/>

        </apex:column>

Some kind of href that will display the full field if clicked?
I'm running into an issue where I have too many buttons on the Lead page and they display in a drop-down list in Lightning. I want to use a Formula Field to open a Visualforce page, so I have this display on the top of the Lightning Lead view.

This is the button:
/apex/Application?leadid={!Lead.Id}&accid={! Lead.AccountId__c}

And the field would be:
HYPERLINK("/apex/Application?leadid="& Id & "accid=" & Account__r.Id , "Application")
I've seen people use "_target" but this forces a new tab in Google Chrome. Can I force a new Window, as well as set the height and width, all from a formula field?
 
Hi everyone,

I have a Visualforce page that checks for an existing Lookup record. If it does not exist, it runs a Flow Interview to create one, and if it does exist, it loads a Visualforce webform I made that uses Standard Controller for that "Application__c" custom object.

My only issue is I need the <flow: interview> FinishLocation to pull a variable ID from the record created in the Visual Workflow. How can I achieve this and reference it in the Visualforce Page?
 
public class FAIRAssistanceApplication {

     public FAIRAssistanceApplication (ApexPages.StandardController controller) {
    }
    public ID getAccId = System.currentPagereference().getParameters().get('var_AccountID');
    
    
    public Flow.Interview.NewFAIRAppAuto NewAppFlow{get;set;}
    public String getAccountId(){ return getAccId; }

    public ID AppId = NewAppFlow.var_AppID;
    
    public PageReference getAppId(){
        
        if(NewAppFlow != null) AppId = NewAppFlow.var_AppID;

        PageReference send = new PageReference('/' + NewAppFlow.var_AppID);
        send.setRedirect(true);
        return send;

    }
    
}
 
<apex:page showheader="false" standardController="Application__c" extensions="FAIRAssistanceApplication">



<apex:pageblock rendered="{!IF(ISBLANK(Application__c.Property_Account__c),TRUE,FALSE)}">
    <flow:interview name="NewFAIRAppAuto" interview="{!NewAppFlow}" finishLocation="{!AppId}')}">
    </flow:interview>
</apex:pageblock>




<apex:form rendered="{!IF(NOT(ISBLANK(Application__c.Property_Account__c)),TRUE,FALSE)}">
    <p>{!Application__c.Property_Account__r.Name}</p>
    <p>{!Application__c.Name}</p>
    <p>Employer: <apex:inputField value="{!Application__c.Employer_Position_1__c}"/></p>
<apex:commandButton id="saveBtn" value="Save" action="{!save}" />


</apex:form>

</apex:page>

 
I have a Visualforce Page to make a new record of a custom object we call "Notes"
<apex:page standardController="Note__c" showHeader="false">
    <apex:form id="theForm">
        <table>
            <tr>
                <th rowspan="2">Note Type</th>
                <th>Note Name</th>
                <th>Note Body</th>
                <th rowspan="2"><apex:commandButton value="Save" action="{!Save}" rerender="theForm" /></th>
            </tr>
            <tr>
                
                <th><apex:inputField value="{!Note__c.Name}"/></th>
                <th><apex:inputField value="{!Note__c.Content__c}"/></th>
            </tr>
        </table>
    </apex:form>
</apex:page>

I want to display a link to the URL off the Account, which is the Parent object in a Master-Detail Relationship field (Account__c).

Can I preopulate the Lookup Field with this value using a URL from the Account?

I've tried:

1. 
https://corere--c.na50.visual.force.com/apex/NewNoteiFrame?Account__c=0016A000001p8GD
2.
https://corere--c.na50.visual.force.com/apex/NewNoteiFrame?Account__r.Id=0016A000001p8GD
3.
https://corere--c.na50.visual.force.com/apex/NewNoteiFrame?00N6A000008PlNb=0016A000001p8GD
4.
https://corere--c.na50.visual.force.com/apex/NewNoteiFrame?Account__c=12345+Test+Drive

But none of them work. Any ideas?


 
I'm building out a link on the Lead to allow our salespeople to fill out an Application (Application__c) for a client. 

I want the URL to be linked to the Lead where:
 
https://corere--app--c.cs71.visual.force.com/apex/AssistanceApplication?acc={!Account__r.Id}

And then I'm writing a controller to basically determine if that attached Account has an existing Application to be updated or a new one to be created before page-load.
 
public class FAIRAssistanceApplication {

    public FAIRAssistanceApplication(){myParam = ApexPages.currentpage().getParameters().get('acc');}
    
    public String myParam { get; set; }    

    public List<Account> getAccount(){
        Map<String, Account> ExistingAppID = new Map<String, Account>();
        for (Account mapaccount : [Select FAIR_Assistance_Application__r.Id FROM Account WHERE Id = :myParam LIMIT 1])
        {ExistingAppID.put(mapaccount.FAIR_Assistance_Application__r.Id,mapaccount);}
        return ExistingAppID.values();}

    public String ExistingAppID { get; set; }   

    public void getAppId()
    {
        if(ExistingAppID != Null)
            
			{string AppId = ExistingAppID;}

        else{
        
        	Application__c NewApp = new Application__c();
            
        	NewApp.Property_Account__c = myParam;
        	NewApp.Name = 'Test';            
            Insert NewApp;

        	Account acc2  = [Select id,Name FROM Account WHERE Id = :myParam LIMIT 1];
			acc2.FAIR_Assistance_Application__c = NewApp.Id;
        	update acc2;
            
        	string AppId = NewApp.Id;
        }
    }
    
    public String AppId { get; set; }  
    
    public FAIRAssistanceApplication(ApexPages.StandardController controller) {
		ApexPages.currentPage().getParameters().put('id', AppId);
    }

}

The Account is linked to the Application by the Lookup field "Assistance_Application__c" and the Application is linked back to the Account with a Master-Detail field "Property_Account__c."

The Visualforce page loads and it will essentially be a stylized webform of <apex: inputField> for the StandardController "Application__c"

I loaded the Visualforce page and tested one save where no Application existed and one where it did exist and neither worked. They saved new Applications with only the fields in the InputFields being populated.
I found a simple collapisble table online: https://codepen.io/andornagy/pen/gaGBZz

And I wanted to use it in a Visualforce page. I copied a simplified version of it, first with the Static Resource I called "Collapisble Table"
 
$(document).ready(function() {
	$('[data-toggle="toggle"]').change(function(){
		$(this).parents().next('.hide').toggle();
	});
});

And then wrote the Visualforce page accordingly:
 
<apex:page showheader="false" sidebar="false">

<apex:includeScript value="{!$Resource.CollapsibleTable}"/>


<style>
table { 
    width: 750px; 
    border-collapse: collapse; 
    margin:50px auto;
    }

th { 
    background: #3498db; 
    color: white; 
    font-weight: bold; 
    }

td, th { 
    padding: 10px; 
    border: 1px solid #ccc; 
    text-align: left; 
    font-size: 18px;
    }

.labels tr td {
    background-color: #2cc16a;
    font-weight: bold;
    color: #fff;
}

.label tr td label {
    display: block;
}


[data-toggle="toggle"] {
    display: none;
}
</style>

<table>
    <tbody>
        <tbody class="labels">
            <tr>
                <td colspan="5">
                    <label for="accounting">Accounting</label>
                    <input type="checkbox" name="accounting" id="accounting" data-toggle="toggle"/>
                </td>
            </tr>
        </tbody>
        <tbody class="hide">
            <tr>
                <td>Australia</td>
                <td>$7,685.00</td>
                <td>$3,544.00</td>
                <td>$5,834.00</td>
                <td>$10,583.00</td>
            </tr>
            <tr>
                <td>Central America</td>
                <td>$7,685.00</td>
                <td>$3,544.00</td>
                <td>$5,834.00</td>
                <td>$10,583.00</td>
            </tr>
        </tbody>
    </tbody>
</table>

</apex:page>

It loads property but the click to collapse functionality is missing. This is probably something really simple I'm missing. 
I'm writing a formula to convert a Number Field into a Word.

Basically where 1,234,567 would equal "One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"

But I'm running into the compiled size of the formula error.

Now I've come up with a formula that only works for numbers between 100,000 and 999,999 (which should be fine for about 95% of cases I would be using it), but I'm interested in seeing if anyone has been able to do this in the 5,000 character limit before.
 
CASE(LEFT( RIGHT(TEXT(Offer_Price__c) ,6),1),

"1","One Hundred ",
"2","Two Hundred ",
"3","Three Hundred ",
"4","Four Hundred ",
"5","Five Hundred ",
"6","Six Hundred ",
"7","Seven Hundred ",
"8","Eight Hundred ",
"9","Nine Hundred ",
"10","Ten Hundred ",NULL)

&
IF(
AND(VALUE(LEFT(RIGHT(TEXT(Offer_Price__c),5),2))>9,
VALUE(LEFT(RIGHT(TEXT(Offer_Price__c),5),2))<20),

CASE(LEFT(RIGHT(TEXT(Offer_Price__c),5),2),
"10","Ten Thousand ",
"11","Eleven Thousand ",
"12","Twelve Thousand ",
"13","Thirteen Thousand ",
"14","Fourteen Thousand ",
"15","Fifteen Thousand ",
"16","Sixteen Thousand ",
"17","Seventeen Thousand ",
"18","Eighteen Thousand ",
"19","Nineteen Thousand ",NULL),


CASE(LEFT(RIGHT(TEXT(Offer_Price__c),5),1),

"2","Twenty ",
"3","Thirty ",
"4","Forty ",
"5","Fifty ",
"6","Sixty ",
"7","Seventy ",
"8","Eighty ",
"9","Ninety ",NULL)

&

CASE(LEFT(RIGHT(TEXT(Offer_Price__c),4),1),
"0","Thousand",
"1","One Thousand ",
"2","Two Thousand",
"3","Three Thousand ",
"4","Four Thousand ",
"5","Five Thousand ",
"6","Six Thousand ",
"7","Seven Thousand ",
"8","Eight Thousand ",
"9","Nine Thousand ",NULL))

 
I'm currently using an Apex Class to generate a list of records owned by a specific User.
 
public TelemarketerDialing(){

        if(ApexPages.currentpage().getParameters().get('leadgenerator') == null)
                       {myParam = UserInfo.getUserId();}

        else{myParam = ApexPages.currentpage().getParameters().get('leadgenerator');}
        }

      public String myParam { get; set; }

I build a Visualforce page for Managers to basically click in to the list of any User using the Visualforce page URL of that individual LeadGenerator's page.
 
<td><a href="https://corere--c.na50.visual.force.com/apex/DoorKnockerPortal?leadgenerator=0056A000000f0af">Angel</a></td>

        <td><a href="https://corere--c.na50.visual.force.com/apex/TelemarketerPortal?leadgenerator=0056A000000e779">Antonio</a></td>

        <td><a href="https://corere--c.na50.visual.force.com/apex/TelemarketerPortal?leadgenerator=0056A000001IVgU">Ary</a></td>
I'm wondering if there's a way to user the UserID to display the name of the User you are viewing on the page.

Something like:
public String LeadGeneratorName = getUserInfo(myParam).UserName;
Is this possible?