• Ali Siddiqui 11
  • NEWBIE
  • 15 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Challenge Not yet complete... here's what's wrong:
We can’t find the correct settings for the method handleSave() in the component boatSearchResults JavaScript file. Make sure the method was created according to the requirements, using the correct event, refresh method, correct promises, toast events for success and failure using the constants, and complete error handling.
 
handleSave(event) {
    const recordInputs = event.detail.draftValues.slice().map(draft => {
        const fields = Object.assign({}, draft);
        return { fields };
    });
    const promises = recordInputs.map(recordInput => {
        return updateRecord(recordInput);
    });
    Promise.all(promises)
        .then(() => {
            this.dispatchEvent(
                new ShowToastEvent({
                    title: SUCCESS_TITLE,
                    message: SUCCESS_MSG,
                    variant: 'success',
                })
            );
            this.draftValues = [];
            this.refresh();
        })
        .catch(error => {
            this.dispatchEvent(
                new ShowToastEvent({
                    title: ERROR_TITLE,
                    message: error.message.body,
                    variant: 'error',
                })
            );
        });
}

 
I am stuck at step 5 of automation superbadge:  new Opportunity with a 'Prospecting' stage for a 'Prospect' Account did not successfully create a Task for the Account owner with the Subject 'Send Marketing Materials'. I am checking for nullvalues in trigger and set up correct fields I guess. Hard to figure out what the problem is as the screen error is very generic. BTW I am 1 week new to SF, but manage to clear hurdles till now. I am spinning my wheels for 2 days now with this problem. Any help much appreciated !
Trigger conditions
Task fields
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.

Illegal assignment from Integer to String when trying to save

code that I'm trying to use line 11 is the issue

public class AccountProcessor
{
  @future
  public static void countContacts(Set<id> setId)
  {
      List<Account> lstAccount = [select id,Number_of_Contacts__c , (select id from contacts ) from account where id in :setId ];
      for( Account acc : lstAccount )
      {
          List<Contact> lstCont = acc.contacts ;
         
          acc.Number_of_Contacts__c = lstCont.size(); // line 11
      }
      update lstAccount;
  }
}