• Tawseef Wani 24
  • NEWBIE
  • 5 Points
  • Member since 2016
  • Software Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hey All, 

First time posting here, I look forward to what I can learn from the community.  I am a mostly self taught Admin so I suspect my issue stems from some of the common knoweldge gaps that newer self taught types can have.  I've read post after post and watched countless videos and can't figure out the small little thing that is hanging me up on this. I also see that this doesn't seem to have spell check so all you grammer hounds please grant me mercy. 

First, since language changes on these modules I'll post the step for future readers and then the error I'm getting. 
---
2)
Set record-level security settings
Configure other Salesforce settings related to record-level security to meet the business requirements.
Create a user, Samantha Cordero, and assign her the Field Sales User profile and the Field Sales role
Create an opportunity owned by Samantha with the stage name 'Needs Analysis'
Create a Closed Won opportunity owned by Samantha, with the type of 'Existing Customer - Upgrade'
---
The error on the apex test thing I get: "Assertion Failed: Field Sales users should not be able to read Opportunities owned by someone else. However, the test returned records not owned by the user. #sadtrombone: Expected: 1, Actual: 3"

So here are the few things I've drilled into and checked, I honestly can't think of anything else that I'm missing. Other parts of this could be messed up but as far as relation to the error thrown I just can't find it. 

1) Issue with the Profile, "Field Sales User". I don't think this is it due to the error throwing a lower case "user" which makes me think it's an issue with roles. Also this doesn't really have much to do with viewing rights beyond basic allowance so.. eh. Honestly I'm not even sure the best way to approach Profiles vs Roles, but again, noob here. In this profile I have the Opportunity object checked for everything except "delete" as the trail ask. 

User-added image

2) Roles. Now here is where we get to the good stuff. I've checked the hierchy and have tried to mark that lowly field reps are not worthy of viewing other's opportunities (humor y'all).  For your consideration here are shots of the hierchy and the field where I marked them as unworthy. 

User-added image 

User-added image

---
3) Sharing Settings. This is the last area I know of to deal with this error.  I have set Opportunities to private. This, in combination with the other rules really baffles me as to why field reps can still creep on other opportunities. For visual confirmation: 

User-added image

Any help or hints would be much appreciated on this.  In the event I make it out to Dreamforce and the lucky person that helps me out the most does I will gladly buy you a beer or coffee or heck even both! 

Cheers. 
 
User-added image

I am trying to insert an account (That is what required of me to complete the challenge). But it throws the error related to "Deletion". FYI, I will furnish the trailhead challenge and the code


Create a method for inserting accounts.
To pass this challenge, create an Apex class that inserts a new account named after an incoming parameter. If the account is successfully inserted, the method should return the account record. If a DML exception occurs, the method should return null.The Apex class must be called 'AccountHandler' and be in the public scope.
The Apex class must have a public static method called 'insertNewAccount'.
The 'insertNewAccount' method must accept an incoming string as a parameter, name the account after the parameter, insert it into the system and then return the account record.
The 'insertNewAccount' method must also accept an empty string, catch the failed DML and return null.


CODE : 
public class AccountHandler {

    public static Account insertNewAccount(String a)
    {
        String aName=a;
        Account newAcc = new Account(Name=aName);
    try {            
            insert newAcc;
        }
        catch(DMLException e)
        {
            system.debug('A DML exception has occured' + e.getMessage());
            return null;
        }    
                return newAcc;
    }
               
}