+ Start a Discussion
Samuel_NaylorSamuel_Naylor 

Hello!

It appears that all of my fields are correct, yet I cannot get past this challenge due to the error that I keep getting, in the subject line.  Is anyone able to see where I am mistaken?  Thanks in advance, for anyone's kind assistance!

Error Message:  "Could not find the 'Camping_Item__c' custom object with the correct fields."
Link to Exercise:  https://trailhead.salesforce.com/lex_dev_lc_basics/lex_dev_lc_basics_prereqs
Screen Shot:
User-added image


 

Best Answer chosen by Samuel_Naylor
Akhil AnilAkhil Anil
Hi Samuel,

FLS means field level security settings of the field. You need to go to the appropriate profile and check whether the field has appropriate access levels in the FLS. To check this follow the below path

Go to Setup > Profiles > Edit the appropriate profile and check the field level settings of your object.

Hope that helps !
Naoki Kitaarashi 4Naoki Kitaarashi 4 
It's a basic question. How to rename Lightning component once created?  I couldn't find any menu on Devloper console and any buttons on Setup|Develop|Lightning Components. Is it necessary to delete and create new one with new name?
Best Answer chosen by Naoki Kitaarashi 4
Himanshu ParasharHimanshu Parashar
Hi Naoki,

Yes that is correct. You need to delete the component and create new one with new name.


Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Best Answer chosen by Mayank Rana
Codey AnujCodey Anuj
Hi Mayank,

After running the command can you try uninstalling Salesforce CLI and Install it again. I faced the same issue but worked for that command.
Follow these steps after uninsalling plugins 
Select Start > Control Panel > Programs > Programs and Features.
Select SFDX CLI, and click Uninstall.
Inside your home directory, delete the .config\sfdx directory.
If the CLI is still installed, delete the %LOCALAPPDATA%\sfdx directory in Program Files.
Also Close your VS Code and start again if opened
Thanks 
Anuj Sahu
Fernando Morales OrtizFernando Morales Ortiz 
Hi,

I'm currently working with the "Discover Built-in XSS Protections in Force.com" Unit of Developer Advanced Trail. The point of the challenge is to edit the comments below each use of "{!sampleMergeField1}" to determine if is vulnerable to XSS. 

Based on the criteria found within the unit and in the guidelines in the Secure Coding Cross Site Scripting page for Built in Auto Encoding (All merge-fields are always auto HTML encoded provided they: do not occur within a <style> or <script> tag, AND do not occur within an apex tag with the escape='false' attribute) I came up with the following answers:
<apex:page controller="Built_In_XSS_Protections_Challenge" sidebar="false" tabStyle="Built_In_XSS_Protections_Challenge__tab">
<apex:sectionHeader title="Built-In XSS Protections Challenge" />
<apex:form >
    <apex:pageBlock >
        <c:Classic_Error />
        <apex:pageMessages />      
        <apex:pageBlockSection title="Demo" columns="1" id="tableBlock">          
            
            <apex:outputText value="{!sampleMergeField1}"/>
            <!-- sampleMergeField1 is vulnerable to XSS: NO -->


            <apex:outputText value="{!sampleMergeField2}" escape="false"/>
            <!-- sampleMergeField2 is vulnerable to XSS: YES -->


            <apex:outputText >
                {!sampleMergeField3}
            </apex:outputText>
            <!-- sampleMergeField3 is vulnerable to XSS: NO -->
       
       
            <style>
                .foo {
                    color: #{!sampleMergeField4};
                }
            </style>
            <!-- sampleMergeField4 is vulnerable to XSS: YES -->
             
            
            {!sampleMergeField5}
            <!-- sampleMergeField5 is vulnerable to XSS: NO -->
            
            
            <script>
                var x = '{!sampleMergeField6}';
            </script>
            <!-- sampleMergeField6 is vulnerable to XSS: YES -->
            
            
            <apex:outputLabel value="{!sampleMergeField7}" escape="false"/>
            <!-- sampleMergeField7 is vulnerable to XSS: YES -->
            
       
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Code links" columns="1">
            <apex:outputPanel >
                <ul>
                    <li><c:codeLink type="Visualforce" namespace="security_thail" name="Built_In_XSS_Protections_Challenge" description="Visualforce Page"/></li>            
                    <li><c:codeLink type="Apex" namespace="security_thail" name="Built_In_XSS_Protections_Challenge" description="Apex Controller"/></li>
                </ul>
            </apex:outputPanel>        
        </apex:pageBlockSection>        
    </apex:pageBlock>          
</apex:form>

But everytime y check the challenge, the same message is displayed:

User-added image

I already checked that I am pointing to the right playground. 

If you can check it and help find where I am going wrong I would be thankful.

Thanks


 
Best Answer chosen by Fernando Morales Ortiz
Fernando Morales OrtizFernando Morales Ortiz
Apparently, there is a mismatch between the Visualforce Page version of the expected correct result for the challenge and the Visualforce Page version available in the Developer Edition.

It is necessary to change the comments to match the mentioned ones in the Challenge section, and also you must add a new line after the first use of {!sampleMergeField1} to match it to the line 10 (as the Challenge details suggest).

This code passed the challenge:
<apex:page controller="Built_In_XSS_Protections_Challenge" sidebar="false" tabStyle="Built_In_XSS_Protections_Challenge__tab">
<apex:sectionHeader title="Built-In XSS Protections Challenge" />
<apex:form >
    <apex:pageBlock >
        <c:Classic_Error />
        <apex:pageMessages />      
        <apex:pageBlockSection title="Demo" columns="1" id="tableBlock">    
              
            
            <apex:outputText value="{!sampleMergeField1}"/>
            <!-- Line 10 is vulnerable to XSS: NO -->


            <apex:outputText value="{!sampleMergeField2}" escape="false"/>
            <!-- Line 14 is vulnerable to XSS: YES -->


            <apex:outputText >
                {!sampleMergeField3}
            </apex:outputText>
            <!-- Line 19 is vulnerable to XSS: NO -->
       
       
            <style>
                .foo {
                    color: #{!sampleMergeField4};
                }
            </style>
            <!-- Line 26 is vulnerable to XSS: YES -->
             
            
            {!sampleMergeField5}
            <!-- Line 32 is vulnerable to XSS: NO -->
            
            
            <script>
                var x = '{!sampleMergeField6}';
            </script>
            <!-- Line 37 is vulnerable to XSS: YES -->
            
            
            <apex:outputLabel value="{!sampleMergeField7}" escape="false"/>
            <!-- Line 42 is vulnerable to XSS: YES -->
            
       
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Code links" columns="1">
            <apex:outputPanel >
                <ul>
                    <li><c:codeLink type="Visualforce" namespace="security_thail" name="Built_In_XSS_Protections_Challenge" description="Visualforce Page"/></li>            
                    <li><c:codeLink type="Apex" namespace="security_thail" name="Built_In_XSS_Protections_Challenge" description="Apex Controller"/></li>
                </ul>
            </apex:outputPanel>        
        </apex:pageBlockSection>        
    </apex:pageBlock>          
</apex:form>              
</apex:page>

Thanks.

 
Michael MMichael M 
Hello, Would someone be able to assist in writing a test class for the following apex class:
global class purgeFiles implements Schedulable{
    
    global void execute(SchedulableContext SC) {
        
    List<ContentDocumentLink > docs;
        docs = [SELECT Id, Linkedentity.name, Linkedentity.id,ContentDocument.CreatedDate  
                FROM contentDocumentLink 
                WHERE Linkedentityid 
                IN (SELECT Id FROM lead where createddate < Last_N_Days:7 and isconverted = false) ];  
                //may want to change to include ALL leads
                //AND ContentDocument.CreatedDate < Last_N_Days:7];
                if(!docs.isEmpty())
            delete docs;
    }
}

Thank you very much
Best Answer chosen by Michael M
AnudeepAnudeep (Salesforce Developers) 
Hi Michael, 

You can start with something like this

@isTest 
public class purgeFilesTest 
{
    static testMethod void testMethod1() 
    {
        List<contentDocumentLink> lstCon = new List<contentDocumentLink>();
         
         Account acc = new Account(name='Test Account');
         insert acc;

         ContentNote n = new ContentNote();
         n.title = 'My Note from Apex';
         insert n;

        for(Integer i=0 ;i <200;i++)
        {
            
            ContentDocumentLink contentlink=new ContentDocumentLink();
            contentlink.LinkedEntityId = acc.id;
            contentlink.ShareType= 'V';
            contentlink.ContentDocumentId=n.id;
            contentlink.Visibility = 'AllUsers';
            lstCon.add(contentlink);
        }
        
         insert lstCon;
       
        Test.startTest();

            purgeFiles obj = new purgeFiles();
            DataBase.executeBatch(obj); 
            
        Test.stopTest();

       // After the testing stops, Please assert if records are updated properly
    }
}

You can learn more about testing batch apex here: 

https://trailhead.salesforce.com/en/content/learn/modules/asynchronous_apex/async_apex_batch

Anudeep
Yogesh BiyaniYogesh Biyani 
I tried the following today in apex anonymous window and I see an unexpected behavior 
System.debug(Datetime.now());
System.debug(Datetime.now().format('YYYY-MM-DD'));
Why id the DD 84 when I use System.debug(Datetime.now().format('YYYY-MM-DD'))? 
13:09:14.1 (2508337)|USER_DEBUG|[1]|DEBUG|2020-03-24 19:09:14
13:09:14.1 (2587013)|USER_DEBUG|[2]|DEBUG|2020-03-84
Best Answer chosen by Yogesh Biyani
AbhishekAbhishek (Salesforce Developers) 
Hi Yogesh,

I think your query is answered in this blog,

https://salesforce.stackexchange.com/questions/103436/datetime-format-unexpected-behavior

Check it once.

Thanks.
Varun Sharma 150Varun Sharma 150 
HI,
I am looking to get an SOQL which can help to find all service Appointment which are scheduled to Preferred / Requried Service Resources. I am looking for a SOQL including ServiceAppointment, WorkOrder and WorkType.

 
Best Answer chosen by Varun Sharma 150
AnudeepAnudeep (Salesforce Developers) 
Hi Varun,

 Can you try something like this? 

SELECT Id, Status, ParentRecordId,ParentRecordType,WorkTypeId FROM ServiceAppointment where Status IN ('Preferred', 'Required Service') AND ParentRecordType = 'Workorder'

User-added image

Anudeep

 
Brian Franklin 12Brian Franklin 12 
We have created a Connected App in our developer account.  Other developer accounts can connect to it and use it.

Trial accounts can connect to it, but don't by default have API access.

Will Professional users with API access, Enterprise, and Unlimited users be able to use the Connected App specified in our developer account, or do we need to have a paid Salesforce account in which to re-create the Connected App for "production" use?
Best Answer chosen by Brian Franklin 12
jigarshahjigarshah
Brian,

A connected app is an application that helps an external entity or application connect to Salesforce.com and get access to the data residing within. Connected Apps use OAuth 2.0 as the authentication protocol to authenticate any user or application and provide them with access ot the instance.

To answer your question, YES your Salesforce users from other orgs will be able to access and use the Connected App setup in your Developer Edition Salesforce Org without incurring any additional license cost. A simple analogy to understand this would be to look at Salesforce as a castle which has entry gates called Connected Apps. As long as you are authenticated and allowed through the gates, you have access to the castle.

Your Salesforce users will be using a single set of credentials to access the Salesforce.com instance where the Connected App is setup. Hence, irrespective of the number of Salesforce Users accessing the Connected App, they would still map to a single User account on the target org which can be accessed via the Connected App.You do not need a paid license to access a Connected App specifically as long as you have enough Salesforce User licenses and have the right access configured.

However, I am curious why would you want your Production Salesforce Users access information from a Developer Edition org. Is it a part of a proof of concept that you are implementing?

Please mark the thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
Thomas Thejn 8Thomas Thejn 8 
When I try to add content reports to my managed package and install this in Sandbox org I get the following error: 
This app can't be installed.
There are problems that prevent this package from being installed.
(SalesValue_reports/Content_by_class_yrh) ReportType: Content is not available	SalesValue_reports/Content_by_class_yrh: ReportType: Content is not available
I have enabled Content in the Sandbox org, and I can see the option to create reports of the type "File and Content Report". 

Does anybody know what is wrong? 
Best Answer chosen by Thomas Thejn 8
AnudeepAnudeep (Salesforce Developers) 
Hi Thomas, 

Enabling content seems to be the only solution

Did you also try giving users access to Salesforce CRM Content by assigning feature licenses and verify that the Salesforce CRM Content users have the Salesforce CRM Content user permissions enabled?

https://help.salesforce.com/articleView?id=content_initialsetup.htm&type=5

During the package installation, you will recieve an email with the org Id if there is a failure for example: 

OrganizationId: 00Dxxxxxxxxxxxx
UserId: 005xxxxxxxxxxxx

Subject: Package Install Failure 04ti0000000LHIVAA4
ExtendedMessage: ReportType: Content is not available: ReportType: Content is not available

Ensure you are doing this for the correct org and the user. If the issue still persists, please contact support. Thank You!

Anudeep
 
kumquatlilykumquatlily 
Appreciate the correct answers for the following PD 1 exam questions and clarification?
My thoughts of answers in Italic.
thanks in advance!

1.  Given the following Anonymous Block:
List<Case> casesToUpdate = new List<Case>();
for(Case thisCase : [Select Id, Status FROM Case LIMIT 50000]){            thisCase.status = 'Working';
    casesToUpdate.add(thisCase);

} try{
       Database.update(casesToUpdate.false);
}catch(Exception e){
      System.debug(e.getMessage()); }

What should a developer consider for an environment that has over 10,000 Case records?
A. The transaction will fail due to exceeding the governor limit.  
B. The try/catch block will handle any DML exceptions thrown.
C. The transaction will succeed and changes will be committed.
D. The try/catch block will handle exceptions thrown by governor limits.

2. A developer has an Apex controller for a Visualforce page that takes an ID as a URL parameter. How should the developer prevent a cross site scripting vulnerability?
A. ApexPages.currentPage() .getparameters() .get('url_param')
B. ApexPages.currentPage() .getParameters() .get('url_param') .escapeHtml4()
C. String.ValueOf(ApexPages.currentPage() .getparameters() .get('url_param'))
D. String.escapeSingleQuotes(ApexPages.currentpages() .getParameters() .get('url_param'))
Best Answer chosen by kumquatlily
AnudeepAnudeep (Salesforce Developers) 
Hi kumquatlily, 

1. There is a DML Insert/Update Limit of 10,000 rows when running anonymous apex. Based on the code block above, we run into the error - "Too many DML rows: 10001" error when trying to insert/update so the answer would be B based on my knowledge

2. Option D because String.escapeSingleQuotes can be used to prevent attackers from accessing restricted data in the org

https://trailhead.salesforce.com/en/content/learn/modules/secdev_injection_vulnerabilities/secdev_inject_prevent_soql_injection

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. Thank You!

Anudeep