• David M. Reed
  • NEWBIE
  • 54 Points
  • Member since 2016
  • Senior Salesforce Developer
  • Radian


  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 14
    Replies
Hello,
I am experiencing an issue while verifying step 7 of the Lightning Component Framework Specialist superbadge.

User-added image
The boat id is being set correctly when I filling in the form and the created record also has the Boat__c field filled in. I have been trying several ways to get past the verification, but I haven't been able to get past it. Does anyone see what I am doing wrong? Below you are able to see the onInit function.
 
onInit : function(cmp, evt) {
        cmp.find("service").getNewRecord(
            "BoatReview__c", 
            null,       
            false,     
            $A.getCallback(function() {                                 
                var error = cmp.get("v.recordError");
                if(error || (rec === null)) {
                    console.log("Error initializing record template: " + error);
                    return;
                }
                else {
                    var rec = cmp.get("v.boatReview");
                    rec.Boat__c = cmp.get('v.boat').Id;
                	cmp.set('v.boatReview', rec);
                }                
            })
        );
	}



 

I am struggling to pass the final unit of this module, "Handle Record Changes and Errors". The error message I'm stuck on is "The 'accEdit' Lightning Component does not appear to be displaying the 'recordSaveError' value inside a div with the class 'recordError'."

I am displaying the error as described, and I've copied and pasted various solutions posted here and on StackExchange several months ago, but it appears the validation checks have changed as none of these things work. Below is my current `accEdit.cmp` - as you can see, I'm trying a variety of display approaches and can't get any of them to pass. 

Any hints would be welcomed!

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="accountRecord" type="Account" />
    <aura:attribute name="simpleAccountRecord" type="Account" />
    <aura:attribute name="recordSaveError" type="String" default="" />
    
    <force:recordData targetRecord="{ v.accountRecord }"
                      targetFields="{! v.simpleAccountRecord }"
                      recordId="{! v.recordId }"
                      mode="EDIT"
                      fields="Name"
                      aura:id="record"
                      targetError="recordSaveError"/>
    
    <lightning:card title="Edit Account">
        <aura:if isTrue="{! v.recordSaveError }">
            <div class="recordSaveError">
                {! v.recordSaveError }
                Error: <ui:outputText value="{! v.recordSaveError }"/>
                Error: <lightning:formattedText value="{! v.recordSaveError }"/>
                <ui:message title="Error" severity="error" closable="true">
                    {!v.recordSaveError}
                </ui:message>
            </div>
        </aura:if>

        <lightning:input value="{! v.simpleAccountRecord.Name }" label="Account Name" />
        <lightning:button label="Save Account" onclick="{! c.handleSaveRecord }" />
    </lightning:card>
</aura:component>

 
I'm working on a Visualforce page to simplify logging of Activities. As a portion of this process, users are asked to enter supporting text, which is to be attached to the resulting Activity in a note record (I'm using the new ContentNote). What I keep encountering is two issues:
  • In the resulting note, all line breaks are removed: all of the lines are run together with no intervening space.
  • There is an exception thrown repeatedly as follows:
"Note can't be saved because it contains HTML tags or unescaped characters that are not allowed in a Note.
Error is in expression '{!save}' in component <apex:commandButton> in page log_activity: Class.LogActivityController.save: line 123, column 1"

Note that I do use String.escapeHTML4() to prepare the text. Based on my testing the exception appears to be thrown when Unicode characters are present. Am I failing to prepare Unicode text appropriately in some fashion I'm not aware of?

Does anyone have any ideas? 

 
ContentNote n = new ContentNote();
        	
        	if (task.Subject != null && task.Subject != '') {
	        	n.Title = task.Subject;
        	} else {
        		n.Title = 'Activity Notes';
        	}
        	
        	n.Content = Blob.valueOf(longDescription.escapeHtml4());
        	
        	insert n;
        	
        	ContentDocumentLink cdl = new ContentDocumentLink();
        	
        	cdl.ContentDocumentId = n.Id;
        	cdl.LinkedEntityId = task.Id;
        	cdl.Visibility = 'AllUsers';
        	cdl.ShareType = 'I';
        	
        	insert cdl;

 
I'm working on a Visualforce page to simplify logging of Activities. As a portion of this process, users are asked to enter supporting text, which is to be attached to the resulting Activity in a note record (I'm using the new ContentNote). What I keep encountering is two issues:
  • In the resulting note, all line breaks are removed: all of the lines are run together with no intervening space.
  • There is an exception thrown repeatedly as follows:
"Note can't be saved because it contains HTML tags or unescaped characters that are not allowed in a Note.
Error is in expression '{!save}' in component <apex:commandButton> in page log_activity: Class.LogActivityController.save: line 123, column 1"

Note that I do use String.escapeHTML4() to prepare the text. Based on my testing the exception appears to be thrown when Unicode characters are present. Am I failing to prepare Unicode text appropriately in some fashion I'm not aware of?

Does anyone have any ideas? 

 
ContentNote n = new ContentNote();
        	
        	if (task.Subject != null && task.Subject != '') {
	        	n.Title = task.Subject;
        	} else {
        		n.Title = 'Activity Notes';
        	}
        	
        	n.Content = Blob.valueOf(longDescription.escapeHtml4());
        	
        	insert n;
        	
        	ContentDocumentLink cdl = new ContentDocumentLink();
        	
        	cdl.ContentDocumentId = n.Id;
        	cdl.LinkedEntityId = task.Id;
        	cdl.Visibility = 'AllUsers';
        	cdl.ShareType = 'I';
        	
        	insert cdl;

 
I am not an Apex developer.  I fumbled my way through creating a trigger in the sanbox to update data on the OpportunityLineItem.  I now need in production and have discovered I need it to go through testing?  Can someone help by providing steps to get this quickly tested and deployed to production?

trigger SetSyndicatedRevenueSchedule on OpportunityLineItem (before insert) {
    List<OpportunityLineItemSchedule> itemschedule = new List<OpportunityLineItemSchedule>();
    for (OpportunityLineItem o: Trigger.new)
    {
      if (o.Product_Subscription__c == False)
      {
        // o.Description = 'Hello World';
        o.ServiceDate = o.Report_Selling_Date__c;
        
        itemschedule.clear();
        // itemschedule = [Select id, ScheduleDate from OpportunityLineItemSchedule where OpportunityLineItemId =: o.Id Order by ScheduleDate ASC];
        itemschedule = [Select ScheduleDate from OpportunityLineItemSchedule where OpportunityLineItemId =: o.Id Order by ScheduleDate ASC];
        System.Debug('Test: ' + itemschedule);
        
        for (OpportunityLineItemSchedule rs: itemschedule)
        {
            rs.ScheduleDate = o.ServiceDate;
            update itemschedule;
        }
      }
    }
}

 
I am trying to create a new application using Salesforce and was wondering if it is better to start creating it in the Lightning Experience or try to first create the application in Classic and then transition later.
Hello awesome devs! 

I have the followign trigger which works as intended, however when I do a mass upload or mass edit on more than 10 Lead records, I always get the "Apex CPU Time Limit Exceeded" error.  Can anyone tell me how to resolve this error in my code as if my users do a mass update of more than 10 lead records to assume ownership it throws this error and any other time an insert or update of more than 10 Lead records at a time. 

Thanks so much for any help you can provide,

Shawn

Trigger code:
 
trigger LeadCountOfTasks on Task (after delete, after insert, after undelete, after update) {
    Task [] tlist;
        if(Trigger.isDelete)
            tlist= Trigger.old;
        else
            tlist = trigger.new;
    set<id> lid = new set< id> ();
    
    If(!tlist.isEmpty()){
    for(Task ts : tlist)
    {   if(ts.WhoId!=null && ts.whatId == null)
    {
        If(string.valueOf(ts.WhoId).startsWith('00Q'))
        {
        lid.add(ts.Whoid);
    }
    }
    }
    If(lid.size()>0){
    Map <id,Task > tmap = new Map <id, Task>([select id, Whoid from Task where Whoid in:lid]);
    Map <id, Lead> lmap = new Map <id, Lead>([select id,Count_Activity__c from lead where id in:lid ]);
    
        If(lmap.size()>0){
       List<Lead> llist = [SELECT Id, Count_Activity__c FROM Lead WHERE ID IN:lmap.values()]; 
    for(lead l : lmap.values())
    {
        set<id> tids = new set <id>();
        for(Task tt : tmap.values())
        {
           if(tt.WhoId== l.Id)
            tids.add(tt.id);
        }
        if(l.Count_Activity__c!=tids.size())
        l.Count_Activity__c=tids.size();
        
              tlist = [select id, Whoid from task where whoid in:lid ];
        for(lead le :llist)
        {
            for(Task te:tlist)
            {
                if(tlist.size()>0)
                le.Count_Activity__c = tlist.size();
            }
        }
        
        
    }
    If(lmap.size()>0){
    update lmap.values();
    }
    }
    }
    }
}

 
Hi Gurus, 

I have created a Visualforce form to save entry into Salesforce from a Site. On the Visualforce preview, the form loads and goes to the seond page correctly however from the Site, some of the fields are not showing even though it the very same Visualforce page. 

At this point im confused as I dont know why the same VF page looks different and doesnt go to the second on the Site but works perfectly when I clicked Preview on the VF developer page. 

Please if anyone know if I have missed something or a way I can make the Site form the same as the preview on the VF page, please let me know, thanks very much!
Hello,
I am currently using SFDC's Developer Console (because it's on the cloud) but would like to know the opinion of Developers who have worked with (or may have tried) other IDEs for Force.com.
I have come across various alternative IDEs such as:
  1. MavensMate which is not supported any more (Dec-2017) and the owner suggest to look at "Visual Studio Code Extension";
  2. Visual Studio Code Extension;
  3. Welkin Suite (It looks like a paid option but cannot see the price on their website);
  4. Illuminated Cloud (hosted within JetBrains Intellij IDEA); price seem to be 65 USD for 1 or few licenses (and we never know if the vendor will charge new versions)
  5. The traditional Force.com IDE Eclips based (Free but a real pain to install in a Mac);
  6. Any other IDE?
Could you possible let us know your opinion and if you would advise using one or the other? Maybe you could comment on Pros/Cons for each IDE you know?

Thank you very much.
  • December 03, 2017
  • Like
  • 2

I am struggling to pass the final unit of this module, "Handle Record Changes and Errors". The error message I'm stuck on is "The 'accEdit' Lightning Component does not appear to be displaying the 'recordSaveError' value inside a div with the class 'recordError'."

I am displaying the error as described, and I've copied and pasted various solutions posted here and on StackExchange several months ago, but it appears the validation checks have changed as none of these things work. Below is my current `accEdit.cmp` - as you can see, I'm trying a variety of display approaches and can't get any of them to pass. 

Any hints would be welcomed!

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="accountRecord" type="Account" />
    <aura:attribute name="simpleAccountRecord" type="Account" />
    <aura:attribute name="recordSaveError" type="String" default="" />
    
    <force:recordData targetRecord="{ v.accountRecord }"
                      targetFields="{! v.simpleAccountRecord }"
                      recordId="{! v.recordId }"
                      mode="EDIT"
                      fields="Name"
                      aura:id="record"
                      targetError="recordSaveError"/>
    
    <lightning:card title="Edit Account">
        <aura:if isTrue="{! v.recordSaveError }">
            <div class="recordSaveError">
                {! v.recordSaveError }
                Error: <ui:outputText value="{! v.recordSaveError }"/>
                Error: <lightning:formattedText value="{! v.recordSaveError }"/>
                <ui:message title="Error" severity="error" closable="true">
                    {!v.recordSaveError}
                </ui:message>
            </div>
        </aura:if>

        <lightning:input value="{! v.simpleAccountRecord.Name }" label="Account Name" />
        <lightning:button label="Save Account" onclick="{! c.handleSaveRecord }" />
    </lightning:card>
</aura:component>

 
Hello,
I am experiencing an issue while verifying step 7 of the Lightning Component Framework Specialist superbadge.

User-added image
The boat id is being set correctly when I filling in the form and the created record also has the Boat__c field filled in. I have been trying several ways to get past the verification, but I haven't been able to get past it. Does anyone see what I am doing wrong? Below you are able to see the onInit function.
 
onInit : function(cmp, evt) {
        cmp.find("service").getNewRecord(
            "BoatReview__c", 
            null,       
            false,     
            $A.getCallback(function() {                                 
                var error = cmp.get("v.recordError");
                if(error || (rec === null)) {
                    console.log("Error initializing record template: " + error);
                    return;
                }
                else {
                    var rec = cmp.get("v.boatReview");
                    rec.Boat__c = cmp.get('v.boat').Id;
                	cmp.set('v.boatReview', rec);
                }                
            })
        );
	}



 
I m getting error of System.UnexpectedException: Note can't be saved while inserting list of content notes like Database.insert(listContent,false)

What can be the issue?
I'm working on a Visualforce page to simplify logging of Activities. As a portion of this process, users are asked to enter supporting text, which is to be attached to the resulting Activity in a note record (I'm using the new ContentNote). What I keep encountering is two issues:
  • In the resulting note, all line breaks are removed: all of the lines are run together with no intervening space.
  • There is an exception thrown repeatedly as follows:
"Note can't be saved because it contains HTML tags or unescaped characters that are not allowed in a Note.
Error is in expression '{!save}' in component <apex:commandButton> in page log_activity: Class.LogActivityController.save: line 123, column 1"

Note that I do use String.escapeHTML4() to prepare the text. Based on my testing the exception appears to be thrown when Unicode characters are present. Am I failing to prepare Unicode text appropriately in some fashion I'm not aware of?

Does anyone have any ideas? 

 
ContentNote n = new ContentNote();
        	
        	if (task.Subject != null && task.Subject != '') {
	        	n.Title = task.Subject;
        	} else {
        		n.Title = 'Activity Notes';
        	}
        	
        	n.Content = Blob.valueOf(longDescription.escapeHtml4());
        	
        	insert n;
        	
        	ContentDocumentLink cdl = new ContentDocumentLink();
        	
        	cdl.ContentDocumentId = n.Id;
        	cdl.LinkedEntityId = task.Id;
        	cdl.Visibility = 'AllUsers';
        	cdl.ShareType = 'I';
        	
        	insert cdl;