• Alexis Masson
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 4
    Likes Given
  • 0
    Questions
  • 6
    Replies
We had Salesforce create a Health Assessment report for us.  Found that we had 6 Apex Classes / 2 Apex Triggers / 5 Visualforce Pages that were using old versions of API's.  Within the "New Code using old API" section we had 37 Apex Classes / 2 Apex Triggers / 4 Visualforce Pages using old versions of API's.

We are new to this process so any guidance / answers / suggestions would be much appreciated for the following questions:
What are others doing to keep API's as current as possible (would it be a good practice to set time aside once a year to make sure all Classes / Triggers / Pages are using the most current version of API's)?  We are requiring when code is updated to upgrade to latest API, but sometimes code doesn't change often.
Can someone give a guess or rough estimate the amount of time it would take 2 people to go through process of upgrading to the latest versions of API's?  (ie so many hours per change or estimate of 40/80/120 ... hours)
What is the recommended process for Apex Classes to upgrade to the latest API version.
What is the recommended process for Apex Triggers to upgrade to the latest API version.
What is the recommended process for Visualforce Pages to upgrade to the latest API version.
Thanks for any guidance you can provide.  Trying to keep our environment as stable / healthy as possible.

Dan
Hello,

I'm doing a 'Visualforce Basics' module and I'm stuck at 'Use Standard Controllers' Unit (link here).
I created a page with the following code:
 
<apex:page>
    <apex:pageBlock title="Account Summary">
        <apex:pageBlockSection>

        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

Then I opened a page via the "Preview" button in a Developer Console and opened a JavaScript console in Chrome where I typed:

$A.get("e.force:navigateToURL").setParams({"url": "/apex/AccSum"}).fire();
And I got the following error:
Uncaught ReferenceError: $A is not defined at <anonymous>:1:1
 

Both the snippets are copied from the Unit's sections, I didn't change anything except the page's name - 'AccSum'. I tried all of the above in a Firefox which also did not work.

Does anyone know what's going on?

I have this very simple class..  
trigger RestrictContactByName on Contact (before insert, before update) {
    //check contacts prior to insert or update for invalid data
    For (Contact c : Trigger.New) {
        if(c.LastName == 'INVALIDNAME') {   //invalidname is invalid
            c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');
        }
    }
}
.. and the corresponding Test Class:  
@isTest
private class TestRestrictContactByName {

	@isTest static void metodoTest() {
		
		List listaContatti = new List();
		Contact c1 = new Contact(FirstName='Francesco', LastName='Riggio');
		Contact c2 = new Contact(LastName = 'INVALIDNAME');
		listaContatti.add(c1);
		listaContatti.add(c2);
		
		//insert listaContatti;
		
		// Perform test
        Test.startTest();
        Database.SaveResult [] result = Database.insert(listaContatti, false);
        Test.stopTest(); 
		
		c1.LastName = 'INVALIDNAME';
		update c1;
       		
	}
	
}

When I run the Test class from the Developer Console I get 100% of coverage on the RestrictContactByName class but, when I check the challenge on the trailhead it returns the error:

Challenge not yet complete... here's what's wrong: The 'RestrictContactByName' class did not achieve 100% code coverage via your test methods

Has someone had my same issue?

hi, im new to salesforce and i was wondering what was the difference between __c and __r when refering to a custom object. Also can u give me examples. thanks

I am getting ready to begin an Apex project that involves very complex business logic. I am currently sitting on about 10,000+ characters (which I realize is not too high), but I expect to have a whole lot more before my project is finished.

 

I was curious as to what the character limit is for one Apex trigger. This will help me decide whether to proceed with only one trigger, or to find an alternate method of specifying the necessary logic.

 

Thank you, in advance!

Hi everybody, I'm a beginner in coding and I'm looking for some help please.

I have two problems :

1) I found on a website a visualforce page file in order to create a button to upload files (see photo 1) but when I upload a picture I can't open it the file is broken (see photo 2). What I would like is that it does as in the picture 3 with the possibility to see it directly on salesforce

2) The last problem is that when I upload a picture with the app salesforce on mobile I receive usually this following message --> file size is too large to handle salesforce (see photo 4).

Thank you in advance for your assistance.

User-added imageUser-added imageUser-added imageUser-added image

Visual force page (code) :

<apex:page standardController="Case" extensions="AttachmentActionFunction">
<script type='text/javascript'>
var maxStringSize = 6000000;
var attachmentList;
var j;
function uploadFiles()
{
    input = document.getElementById('fileinput');
    attachmentList = input.files;
    if(j == undefined) 
    j = 0;   
    var file;
    if(j < attachmentList.length)
    {
        file = attachmentList[j];
     var name = file.name;
        var reader = new FileReader();  
        reader.onload = function(e) {  
         var attachmentbodybase64 = window.btoa(reader.result)
            console.log(attachmentbodybase64.length);
            if(attachmentbodybase64.length > maxStringSize )
            alert("File size is too large to handle");
            else
            {
                j++;
                saveFileAF(attachmentbodybase64, name);
            }
        }
         reader.readAsDataURL(file);
    }
    else
    {
        console.log('this is end');
        var url = window.location.origin + '/'+"{!$CurrentPage.parameters.Id}";
        console.log(url);
        window.location.href = url;
    }
    
 }
</script>

<apex:form >
  <input type= "file" Id= "fileinput"  multiple="multiple" />
    <apex:commandButton onclick="uploadFiles(); return false;" value="Upload"/>
    <apex:actionFunction name="saveFileAF" 
         action="{!saveFile}" oncomplete="uploadFiles()" rerender="form"  status="uploading">
        <apex:param name="base64File" value="" assignTo="{!base64}"/>
        <apex:param name="fileName" value="" assignTo="{!fileName}"/>
    </apex:actionFunction>
    <apex:actionStatus id="uploading" >
        <apex:facet name="start" >
            <img src="/img/loading.gif" />                    
  </apex:facet>
 </apex:actionStatus>    
</apex:form>
</apex:page>

Apex class (code) :

public with sharing class AttachmentActionFunction {
    public transient String base64;
    public Case c;
    public String getBase64()
    {
        return base64;
    }
    public void setbase64(String base64)
    {
        this.base64 = base64;
    }
    public transient String fileName {get; set;}
    public AttachmentActionFunction(ApexPages.StandardController std)
    {
        c = (Case)std.getRecord();
    }
    public void saveFile()
    {
        Attachment a = new Attachment(parentId = c.Id, Body =  EncodingUtil.base64Decode(base64), name = fileName);
        insert a;
    }
}
I can't find Dev Hub in my org's Setup search.
I needed to be able to customize the fields visible on the Contact Role Opportunity related list to add the Contact Mobile Phone. I searched Answers and the famous Deepak came up with a brillant work-around solution using VisualForce (see link to the original thread below).

https://success.salesforce.com/answers?id=90630000000hp0AAAQ

I used the VF code he provided and modified it to pull in the Contact Mobile Phone into the Contact Roles related list on the Opportunity. It works perfectly except for a couple of things:
  • When I click to add a New Contact Role in the new VF page on the Opportunity, it pulls it in within the full SF tab and sidebar window (see screen shot below).
  • There is no link to the Contact record in the VF Contact Role related list (see screen shot below).
Add New Contact Role Opens in the full SF tab and sidebar window Shot
User-added image

VF Contact Role has no link to the Contact record​
User-added image


Does anyone know if is there a way to modify the VF code Deepak provided to resolve these two issues? 

Any help or advice will be most appreciated!

Thanks!
 
Hai guys,
The repeater must use the <li> HTML list tag
The repeater must use the apex:outputLink component to link to the respective record detail page
HINT: Record detail pages can be reached by placing a record ID at the root of the URL (e.g. '/<record id>').
how can i achieve it.
my vf page code is
<apex:page standardController="Account" recordSetVar="accounts">
  <apex:form >
  <apex:repeat value="{!accounts}" var="a">
 
  
 <li> <apex:outputLink value="/apex/AccountList?id=00128000005LpU9">
  
  {!Account.Name}
  
  </apex:outputLink>
</li>
  </apex:repeat>
  
  
  </apex:form>
</apex:page>
can any one help me