• Tabbasum Nihan
  • NEWBIE
  • -4 Points
  • Member since 2019
  • Techgape


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I'm wondering if this is just a glitch in Salesforce and if anyone has any workaround. I currently have a Trigger on ContentDocumentLink that sends an email to the owner of a custom object record when a File or Note is created and attached to that record. The trigger also attaches file information and the body of the Note if it's a ContentNote being inserted. The trigger handles the logic in differentiating Notes from other file types. The problem is when the user hits the button to create a new Note in classic or in the Console, an empty, untitled, new note record is inserted instantly firing my trigger before the user has time to add content to the body. In Lightning it at least allows the user to fill out the header of the note before saving, but saves before the note body is filled out. Cancelling out of creating the note still leaves the blank note saved and attached to the record. Any help in understanding why the note saves before the user hits the save button would be appreciated.
I am stuck on Step 4 of the Process Automation Specialist Superbadge. I am receiving the following error:
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: GTJRSNVZ

Here are the Challenge Requirements: 
Create Sales Process and Validate Opportunities
Create a sales process with the required stages and name it RB Robotics Sales Process. Create a record type named RB Robotics Process RT. Add a field to the opportunity page layout as described in the business requirements and create the appropriate validation rule for high-value opportunities.

Hey, nice work on the setup records! Now let’s talk about our sales process. Most of the stages we use are already in Salesforce, but one of the stages we track doesn’t come standard so it would be great if you’d add it. These are the stages we use:  Prospecting, Qualification, Proposal/Price Quote, Negotiation/Review, Awaiting Approval, Closed Won, and Closed Lost. We want all our reps to follow the same process, so everyone should see those stages for every opportunity. 
Oh, and the biggest deals--anything over $100K--have to be approved before they can close. We should have a way to show on the record that the deal is approved--maybe you can add an “Approved” checkbox to the opportunity. Obviously the sales reps shouldn’t be able to check that box. Only system administrators like you and sales managers should be able to check it. By the way, all of us sales managers here have the Custom: Sales Profile in Salesforce.

I have created the following:
  1. Created a new Opportunity Stage: Awaiting Approval (Open, 95%, Pipeline)
  2. Created the following Opportunity Fields:
    1. Approved (Checkbox) Defaulted FALSE
  3. Sales Process:
    1. NAMED: RB Robotics Sales Process
    2. Stages Added:
      1. Prospecting (Open, 10%, Pipeline)
      2. Qualification (Open, 10%, Pipeline)
      3. Proposal/Price Quote (Open, 75%, Pipeline)
      4. Negotiation/Review (Open, 90%, Pipeline)
      5. Awaiting Approval (Open, 95%, Pipeline)
      6. Closed Won (Closed/Won, 100%, Closed)
      7. Closed Lost (Closed/Lost, 0%, Omitted)
  4. Opportunity Record Type:
    1. NAMED: RB Robotics Process RT
    2. Sales Process: RB Robotics Sales Process
    3. This is the only record type and assigned to all profiles. Also using the Opportunity Layout. 
  5. Opportunity Validation Rules:
    1. Approved_Field_Validation
      AND( 
      ISCHANGED(Approved__c), 
      OR( 
      $Profile.Name <> 'System Administrator', 
      $Profile.Name <> 'Custom: Sales Profile' 
      ) 
      )

      2. High_Value_Opportunity_Validation
      AND(
          ISCHANGED( IsClosed ),
          IsClosed = TRUE,
          Amount  > 100000,
          Approved__c  <> TRUE
          )
Im not sure what I am missing. Can anyone assist?
Hello everyone I could use some help on the using future Methods trailhead. Please keep in mind I am not an Apex coder at all but I am trying to learn as much as I can.

Here is the Task

Create an Apex class with a method using the @future annotation that accepts a List of Account IDs and updates a custom field on the Account object with the number of contacts associated to the Account. Write unit tests that achieve 100% code coverage for the class.
Create a field on the Account object called 'Number_of_Contacts__c' of type Number. This field will hold the total number of Contacts for the Account.
Create an Apex class called 'AccountProcessor' that contains a 'countContacts' method that accepts a List of Account IDs. This method must use the @future annotation.
For each Account ID passed to the method, count the number of Contact records associated to it and update the 'Number_of_Contacts__c' field with this value.
Create an Apex test class called 'AccountProcessorTest'.
The unit tests must cover all lines of code included in the AccountProcessor class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

I have written an Apex class and a Test class but I think I am doing them both Wrong: because when I try to check the challenge i Get this error

Challenge Not yet complete... here's what's wrong: 
The 'AccountProcessorTest' test class doesn't appear to be calling the 'AccountProcessor.countContacts' method between Test.startTest() and Test.stopTest().


When I run the Test class I get this error :

System.QueryException: List has no rows for assignment to SObject

Here is the CLASS:
 
public class AccountProcessor {
     @future

  public static void someFutureMethod(List<id> scope) {

   Account[] updates = new Account[] {};
        for (AggregateResult ar : [
                select AccountId a, count(Id) c
                from Contact
                where AccountId in :scope
                group by AccountId
                ]) {
            updates.add(new Account(
                    Id = (Id) ar.get('a'),
                    Number_of_Contacts__c = (Decimal) ar.get('c')
                    ));
        }
        update updates;
    }

}

Here is the Test Class:
 
@IsTest
public class AccountProcessorTest {
  public static testmethod void TestAccountProcessorTest() {
 
Test.startTest();
     Account a = new Account();
        a.Name = 'Test Account';
        Insert a;
      
      Contact cont = New Contact();
      
      cont.FirstName ='Bob';
      cont.LastName ='Masters';
      cont.AccountId = a.Id;
      Insert cont;

    Test.stopTest() ;
     Contact ACC = [select AccountId from Contact where id = :a.id LIMIT 1];

 
        System.assert(Cont.AccountId != null);
        System.assertequals(cont.id, ACC.AccountId);

  }}

I have used alot or diffrent google searches to get me this far. But I have not Idea if Im even remotly close to the right answer or not.