• MohsinWadee
  • NEWBIE
  • 35 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
Cannot get this to work - get the error:

Challenge Not yet complete... here's what's wrong: 
The 'Accounts' class 'onBeforeUpdate' method does not appear to be calculating the Levenshtein distance between the phrase default Description ‘Domain classes rock!’ and the value in the updated Description and storing the result in the Annual Revenue field correctly.

Here's my code in the Accounts class:
 
public class Accounts extends fflib_SObjectDomain {

    public Accounts(List<Account> sObjectList) {
        super(sObjectList);
    }
    
    public class Constructor implements fflib_SObjectDomain.IConstructable {
        public fflib_SObjectDomain construct(List<sObject> sObjectList) {
            return new Accounts(sObjectList);
        }
    }
    
    public override void onBeforeInsert() {
        List<Account> newAccounts = new List<Account>();
        
        for (Account acct : (List<Account>) Records) {
            acct.Description = 'Domain classes rock!';
            newAccounts.add(acct);
        }
        
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
        uow.registerNew(newAccounts);
    }
    
    public override void onBeforeUpdate(Map<Id,sObject> Records) {
        String rock = 'Domain classes rock!';
        Set<Id> Ids = Records.keySet();
        
        List<Account> accountList = [SELECT Id, Description, AnnualRevenue 
                                     FROM Account 
                                     WHERE Id IN :Ids];
        
        List<Account> updatedAccounts = new List<Account>();
        
        for (Account acct : accountList) {
            if (acct.Description != NULL) {
                acct.AnnualRevenue = rock.getLevenshteinDistance(acct.Description);
                updatedAccounts.add(acct);
            }
        }
        
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
        uow.registerDirty(updatedAccounts);
    }
    
    public override void onApplyDefaults() {
        String rock = 'Domain classes rock!';
        List<Account> accountList = (List<Account>)Records;
        List<Account> updatedAccounts = new List<Account>();
        
        for (Account acct : accountList) {
            if (acct.Description != NULL) {
                acct.AnnualRevenue = rock.getLevenshteinDistance(acct.Description);
                updatedAccounts.add(acct);
            }
        }
        
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
        uow.registerDirty(updatedAccounts);
        uow.commitWork();
    }
}

 
Can someone please give the complete Visualforce page code? Cannot get mine to work.
A Create a Record action for the Closed Won criteria node isn’t properly configured. Make sure that it creates a task and uses the same field settings as the ‘Follow up on new contract’ task action. Make sure that Due Date Only is set by using a formula.
User-added image

Hep me for this Problem!
I'm trying to go through "Trailhead Native Android" and I'm getting stuck in the first chapter on "forcedroid create". the error I'm getting after i enter the output directory and the error even appears when i leave it blank.
error i am getting from the command line is
"forcedroid create failed
Command failed: git clone --branch v5.0.0 --single-branch --depth 1 --recurse-submodules https://github.com/forcedotcom/SalesforceMobileSDK-Templates C:\Users\Owner\Documents\Android project\tmp84510\SalesforceMobileSDK-Templates 
'git' is not recognized as an internal or external command,
operable program or batch file."


 
Cannot get this to work - get the error:

Challenge Not yet complete... here's what's wrong: 
The 'Accounts' class 'onBeforeUpdate' method does not appear to be calculating the Levenshtein distance between the phrase default Description ‘Domain classes rock!’ and the value in the updated Description and storing the result in the Annual Revenue field correctly.

Here's my code in the Accounts class:
 
public class Accounts extends fflib_SObjectDomain {

    public Accounts(List<Account> sObjectList) {
        super(sObjectList);
    }
    
    public class Constructor implements fflib_SObjectDomain.IConstructable {
        public fflib_SObjectDomain construct(List<sObject> sObjectList) {
            return new Accounts(sObjectList);
        }
    }
    
    public override void onBeforeInsert() {
        List<Account> newAccounts = new List<Account>();
        
        for (Account acct : (List<Account>) Records) {
            acct.Description = 'Domain classes rock!';
            newAccounts.add(acct);
        }
        
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
        uow.registerNew(newAccounts);
    }
    
    public override void onBeforeUpdate(Map<Id,sObject> Records) {
        String rock = 'Domain classes rock!';
        Set<Id> Ids = Records.keySet();
        
        List<Account> accountList = [SELECT Id, Description, AnnualRevenue 
                                     FROM Account 
                                     WHERE Id IN :Ids];
        
        List<Account> updatedAccounts = new List<Account>();
        
        for (Account acct : accountList) {
            if (acct.Description != NULL) {
                acct.AnnualRevenue = rock.getLevenshteinDistance(acct.Description);
                updatedAccounts.add(acct);
            }
        }
        
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
        uow.registerDirty(updatedAccounts);
    }
    
    public override void onApplyDefaults() {
        String rock = 'Domain classes rock!';
        List<Account> accountList = (List<Account>)Records;
        List<Account> updatedAccounts = new List<Account>();
        
        for (Account acct : accountList) {
            if (acct.Description != NULL) {
                acct.AnnualRevenue = rock.getLevenshteinDistance(acct.Description);
                updatedAccounts.add(acct);
            }
        }
        
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
        uow.registerDirty(updatedAccounts);
        uow.commitWork();
    }
}

 
Can someone please give the complete Visualforce page code? Cannot get mine to work.
I keep getting the "Challenge Not yet Complete......... Here's whats wrong"
Lightning page named 'New Account Page' does not appear to have the correct components on it.

The new record page must use the 'Header and Two Columns' template, be called 'New Account Page', and be assigned to the Account object. (Check this is done)
The page must have the Highlights Panel and Twitter components, and a Tabs component with these tabs containing these components: (Check this is done)
Activity Tab contains the Activities Component - Complete
Collaborate Tab contains the Feed Component - Complete
Related Tab contains the Related Lists Component - Complete
Details Tab contains the Record Detail Component - Compelte

Here is a screen shot, I believe I have all the items I am supposed to as well as what goes inside the components.
User-added image