• Suley Kabore
  • NEWBIE
  • 75 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 21
    Replies
I am having an issue verifying the Prevent Open Redirect Challenge. The code I put into the VF page is actually working correctly, but the verify is coming back with a standard error message.
 
Also I happen to notice that the code displayed for the "Force Local Redirects Only" section on the trailhead page for "Prevent Open Redirects in Your Code" is inconsistent and possibly in error.
 
In the larger code display it shows the line (09) as being
 
           completion.replaceFirst('/','');
 
but in the follow on description it shows that line of code to be
 
completion.replaceFirst('/+','');
 
And according to the documentation for the ReplaceFirst method it returns a string with the desired changes and does not change the target string. That would seem to indicate that the code in the example given in the module content given is not going to actually remove any initial '/' from completion.
 
The code I put in the VF page which is working, but not verifying for the "Check Challenge" is
 
              if(finishURL.startsWith('/')){ 
                    finishURL = finishURL.replaceFirst('/+',''); 
                    }
                savePage = new PageReference('/'+finishURL);
 
Can someone tell me what I need to change in order to get past this challenge? I have actually completed all the other challenges for this module so this is holding up my completion of this particular module.
 
Thanks in advance for any assistance!
Challenge says "To pass this challenge, block all users' access to the Salesforce1 for iOS app or the Salesforce1 for Android app."

"Instructions say: From Setup, enter Connected Apps in the Quick Find box, then select Connected Apps OAuth Usage.
Click Block on the row for Salesforce1 for Android or Salesforce1 for iOS.
When you’re ready to reenable access to the app, click Unblock."

However, neither Salesforce1 for Android nor Salesforce1 for iOS appear in the list "Connected Apps OAuth Usage".  I do see this above "Connected apps that are installed but haven’t been used by anyone don’t appear in the list." So I tried to use the newly downloaded Salesforce1 app in my hands-on org but ... well, I can't. It won't let me log on without authorization token, which - as a Salesforce employee - is aligned to my Salsforce email, not my hands-on org email address. So ... I can't complete the challenge. Help?
Could someone at Trailhed change the api names for external objects. Can't pass this unit because the validation checks for Phone__x object while the data source provides Phones__x.

https://trailhead.salesforce.com/lightning_connect/lightning_connect_setup
https://trailhead.salesforce.com/lightning_connect/lightning_connect_integrate

cheers
  • January 28, 2017
  • Like
  • 0
Hello everyone,

I cannot seem to import contact and hobbies in the object. I get 240 records processed and 240 records failed. I beleive there is something wrong with the Object itself. Maybe I need to clean the excel sheet? I am unsure what needs to be done in order to get the "Contact and Hobbies" to import into salesforce? Please Help.
Hi All
Please can you help resolve this issue I am having with Step 2 of the Security Specialist Badge.
Having got to step 2 but cannot get any response other than this after running the Apex test: "Error MessageSystem.QueryException: List has no rows for assignment to SObject" this is not telling me anything just that it hs passed 0/2. I have configuresd the following:
I have tried loging in for each profile and it all seems to work ok including the the Project manager (add Samantha to the group to test)
OWD 
Account Public read/Write (Was Public read only) Opportunity (Private) Contacts Default (Controlled by Parent)
User
Samantha Cordero Filed Sales User (profile) Field Sales Role.
Profiles and Roles:
Field Sales User Profile  Account (RE) Opportunity (RCE)
 Field Sales Role (Users in this role cannot access opportunities that they do not own that are associated with accounts that they do own)
Inside Sales User Profile Account(RCE) Opportunities (RCE)
Inside Sales Role (Users in this role can edit all opportunities associated with accounts that they own, regardless of who owns the opportunities)
Executive Sales User Profile (Account R VA) Opportunity (R VA)
Executive Sales Role(Users in this role can view all opportunities associated with accounts that they own, regardless of who owns the opportunities)

Group
Project Managers
(Criteria based sharing rule below)

Sharing Rules
User-added imageUser-added image


Thanks in advance for any assistance that can be given 
Hi, I have a question regarding quesiton 3 in unit: "Getting Started with Salesforce and Lightning Experience unit"
3 Salesforce Lightning Experience:
A Is available only on mobile devices.
B Is optimized with flexible, interactive tools that sales reps can use to visualize data on the fly.
C Never strikes in the same place twice.
D Is optimized to be a fast and lightweight tool for your sales reps.

I understand the correct answer is B. but what is wrong with D?
Salesforce document says that 'Lightning Experience is the name for the all new Salesforce desktop app, with over 25 new features, built with a modern user interface and optimized for speed.'
Doesn't this mean that it is optimized to be a fast tool? My understanding is that lighting means fast hence speed is important.
To me answser B emphasizes on visualization and answer D emphasizes on speed. 
Why B is correct?

Thanks in advance.



 
Challenge Not yet complete... here's what's wrong: 
The 'Accounts' class 'onApplyDefaults' method does not appear to be setting the Description field to 'Domain classes rock!' correctly for a default value.
public override void onApplyDefaults() 
	{
        List<Account> updatedAccounts = new List<Account>();
        
        for (Account acct : (List<Account>)Records) {
                acct.Description = 'Domain classes rock!';
                updatedAccounts.add(acct);
        }
        
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
        uow.registerDirty(updatedAccounts);
        uow.commitWork();
    }

Any recommendations or suggestions would be greatly appreciated.
I am having an issue verifying the Prevent Open Redirect Challenge. The code I put into the VF page is actually working correctly, but the verify is coming back with a standard error message.
 
Also I happen to notice that the code displayed for the "Force Local Redirects Only" section on the trailhead page for "Prevent Open Redirects in Your Code" is inconsistent and possibly in error.
 
In the larger code display it shows the line (09) as being
 
           completion.replaceFirst('/','');
 
but in the follow on description it shows that line of code to be
 
completion.replaceFirst('/+','');
 
And according to the documentation for the ReplaceFirst method it returns a string with the desired changes and does not change the target string. That would seem to indicate that the code in the example given in the module content given is not going to actually remove any initial '/' from completion.
 
The code I put in the VF page which is working, but not verifying for the "Check Challenge" is
 
              if(finishURL.startsWith('/')){ 
                    finishURL = finishURL.replaceFirst('/+',''); 
                    }
                savePage = new PageReference('/'+finishURL);
 
Can someone tell me what I need to change in order to get past this challenge? I have actually completed all the other challenges for this module so this is holding up my completion of this particular module.
 
Thanks in advance for any assistance!

Hello everyone,

First post here...  I need some assistance with updating a set of custom fields on the Contact object when one custom field is changed on the Contact object.  When the Degree Program field is updated, I want to use a trigger to update other related fields such as Degree Level, College, School, etc.  Basically,

Controlling field is Application_Program__c, a picklist field.  If Application_Program__c changes to value xxx, change the following fields to:

Picklist_Field_2__c change to aaa
Picklist_Field_3__c change to bbb
Picklist_Field_4__c change to ccc
Picklist_Field_5__c change to ddd
Picklist_Field_6__c change to eee
Picklist_Field_7__c change to fff
Picklist_Field_8__c change to ggg
Picklist_Field_9__c change to hhh
Text_Field_1__c change to abcdefg

I'm not a developer, I don't know Apex, and Process Builder is limiting me here.  I work in Higher Education, and we use the Contact object in Salesforce for a lot.  We have over 200 degree programs we've offered over the years, so I've had to split up that 200 into 10 different Process Builders to try to keep the editing time within Process Builder to a minimum.  Even still, it takes me 3 minutes of system processing time of Salesforce spinning and thinking to make a change in any of these Processes.  I'm concerned not just about the processing time to edit Process Builders, but to have them fire consistently and successfully when its 10 different Process Builders firing simultaneously, looking at the same field, and affecting other automations and operations.

Thanks in advance!

Cheers,
 

Matt

I'm getting an error on teh challenge here https://trailhead.salesforce.com/lex_dev_lc_basics/lex_dev_lc_basics_prereqs) saying that I haven't created the Expense__c object, or that it doesn't have the right fields. The challenge does not ask you to create any custom fields but also implies that the object has already been completed in some other module.  What fields is this object supposed to have?
Hello everyone,

The challenge is the following :
 
Create a Service and Implement a Caller.
Create an Apex class that is a service that exposes a bulkified service method. The service closes and sets the reason for one or more given case records. Implement an Apex REST class that calls this service.
  • Create an Apex class called CaseService that contains a void static method called closeCases that takes a set of Case IDs and a String parameter for the close reason.
  • Create a REST Apex class called CaseCloseResource with a URL mapping /case/*/close (where * will be the Id). Implement a POST closeCase method which accepts a String reason and calls the CaseService.closeCases service method passing in the Id and close reason.
I keep getting the following error when trying to submit my solution on "Apply Service Layer Principles in Apex"
Challenge Not yet complete... here's what's wrong: 
The Apex service does not appear to be closing cases correctly with the specified reason.

My Service class is the following:
 
global with sharing class CaseService {

    global static void closeCases(List<Id> caseIds, String closingReason) {
        if (caseIds == null || caseIds.size() == 0) {
            throw new CaseServiceException('You should tell me which cases you wanna close');
        }
        
        if (closingReason == null || closingReason == '') {
            throw new CaseServiceException('I won\'t close a case without any reason');
        }
        
        List<Case> closedCases = new List<Case>();
        
        for(Id caseId : caseIds) {
            Case caseToClose = new Case(
            	Id = caseId,
                Status = 'Closed',
                Reason = closingReason
            );
            closedCases.add(caseToClose);
        }
        
        SavePoint sp = Database.setSavepoint();
        if (closedCases.size() > 0) {
            try {
                update closedCases;
            } catch (Exception e) {
                Database.rollback(sp);
                throw e;
            }
        }
    }
    
    public class CaseServiceException extends Exception {}
}

And my webservice endpoint (I can't really call it restful) is :
 
@RestResource(urlMapping='/case/*/close')
global with sharing class CaseCloseResource {
    
    @HttpPost
    global static void closeCase(String reason) {                
        Id id = RestContext.request.requestURI.substringBetween('case/', '/close');
        CaseService.closeCases(new Id[]{id}, reason);
    }
}

I tried in an anonymous code execution :
 
Id id = '5000Y000002Vc8Y';
CaseService.closeCases(new Id[]{id}, 'You shall be closed!');
And successfully got the following : 
Changed Case Reason from Installation to You shall be closed!.
Changed Status from New to Closed.

Then, using workbeng, I tried the following request :
POST /services/apexrest/case/5000Y000002Vc8m/close
Payload : {"reason" : "Please close this case too!"}

And got a 200 response from the server as well as 
Changed Case Reason from Feedback to Please close this case too!.
Changed Status from New to Closed.

That's why I am still confused on why the challenge checker is rejecting me ?
Did I miss something the challenge requested me to do ?
 
Hi All, I am working on the Unit of Work Principles trailhead and seem to be stuck, I cannot get it to pass even though the test passes. I surmise it may be because it is testing other tests and looking for 100% code coverage across the board. Are there any steps I should take. Here is my code below. Hope it helps.
 
@isTest
public class UnitOfWorkTest {
    @isTest static void challengeComplete(){
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(
            new Schema.SObjectType[]{
                Account.SObjectType,
                Contact.SObjectType,
                Note.SObjectType
            }
        );
        
        for (Integer i=0 ; i<100 ; i++) {
            Account a = new Account(Name= 'Test' + i);
            uow.registerNew(a);
            
            for (Integer j=0 ; j<5 ; j++) {
                Contact c = new Contact(LastName = 'Test'+i + ' ' +j);
                uow.registerNew(c, Contact.AccountId, a);
                
                Note n = new Note(Body='Test '+i + '' + j, Title='Test'+i+j);
                //uow.registerRelationship(n, Note.ParentId, a);
                //uow.registerNew(n, Note.ParentId, a);
                uow.registerNew(n, Note.ParentId, c);
            }
        }

        uow.commitWork();
 
        fflib_SObjectUnitOfWork uow2 = new fflib_SObjectUnitOfWork(
            new Schema.SObjectType[]{
                Account.SObjectType,
                Contact.SObjectType,
                Note.SObjectType
            }
        );        
        
        Id oldAccountId;
        Account a2;
        for (Contact c : [SELECT Id, LastName, AccountId, Account.Name, (SELECT Id, ParentId, Title, Body FROM Notes) FROM Contact Order By AccountId, Id]) {
            
            if (oldAccountId != c.AccountId) {
                oldAccountId = c.AccountId;
                a2 = new Account(Id=c.AccountId, Name='Test');
                uow2.registerDirty(a2);
            }
            
                c.LastName = 'Test';
                uow2.registerDirty(c);
                

                c.Notes[0].Body = 'Test';

                uow2.registerDirty(c.Notes[0]);

        }        
        
        test.startTest();
        uow2.commitWork();
        //uow.commitWork();
        test.stopTest();
        
        System.assertEquals(100, [Select Id from Account].size());
        System.assertEquals(500, [Select Id from Contact].size());
        System.assertEquals(500, [Select Id from Note].size());
    }
}