+ Start a Discussion
Best Answer chosen by {{7*7}}
zonduu zonduuduzonduu zonduudu
testing- zonduu2
Jonathan Osgood 3Jonathan Osgood 3 
Hello,

Test coverage at 80% and I cant figure out why. Red highlight on Line 11 "return result;" GET request is working fine in workbench.

Account manager class:
 
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {

    @HttpGet
    global static Account getAccount() {
        RestRequest request = RestContext.request;
        // grab the accountId from the end of the URL
        String accountId = request.requestURI.substringBetween('Accounts/', '/contacts');
        Account result = [SELECT ID,Name,(SELECT ID,Name FROM Contacts) FROM Account WHERE Id = :accountId ];
        system.debug(result);
        return result;
        
    }
}
Test Class:
 
@IsTest
private class AccountManagerTest {

    @isTest static void testGetAccount() {
        Id recordId = createTestRecord();
        // Set up a test request
        RestRequest request = new RestRequest();
        request.requestUri =
            'https://na1.salesforce.com/services/apexrest/Accounts/'+ recordId+'/Contacts';
        request.httpMethod = 'GET';
        RestContext.request = request;
        // Call the method to test
        Account thisAccount = AccountManager.getAccount();
        // Verify results
        System.assert(thisAccount != null);
        System.assertEquals('Test record', thisAccount.Name);
    }

   

    // Helper method
    static Id createTestRecord() {
        // Create test record
        Account accountTest = new Account(
        Name='Test record');
        insert accountTest;
       
        Contact con1 = new Contact(
        AccountId = accountTest.Id,
        firstName = 'test',
        lastName  =  'tester');
        insert con1;
        return accountTest.Id;
    }          

}


 
Best Answer chosen by Jonathan Osgood 3
Bryan JamesBryan James
in the apex class you are testing the urlMapping is case sensitive. So you need to capitalize the C in Contacts
@RestResource(urlMapping='/Accounts/*/Contacts')
Diwakar GDiwakar G 
Hi,

In Setup->Users->Fields->Lanuage only field information is available. How to see the picklist values?
Thanks in advance.
Best Answer chosen by Diwakar G
Sohan Raj GuptaSohan Raj Gupta
Hi Diwakar,

You can manage Language filed values from "Language Settings".

Go to Steup->Language Settings



Hope this will help you. Let me know if it helped or you need any more assistance. 

Please mark this is as the solution if it solved your purpose.

Thanks,
Sohan Raj Gupta 
Hemant Gothwal 1Hemant Gothwal 1 
My issue seems to be very strange. I have created this process and when I test it, it is updating the sales price to deposit amount as said in the requirement. But when the chellenge is checked it gives me error message:
Challenge Not yet complete... here's what's wrong: 
The Fulfillment Cancellation Automation process does not appear to be working properly. Make sure that a cancelled Fulfillment updates the Adventure Package correctly.


Chose the fullfillment object
have proper conditions:
User-added image

and update the adventure package
User-added image

I tested it and it seems to be updating the sales price to the diposit amount correctly:
User-added image

but still on checking Chellenge I get the error:
User-added image

completedly stumped!!! please let me know if anybody faced the same issue. any help.
 
Best Answer chosen by Hemant Gothwal 1
NagendraNagendra (Salesforce Developers) 
Hi Hemant Gothwal,

Please doble check the steps. Especially Field Update Filter condition : 
Line Item ID  equals Formula [FullFillment__c].AdventurePackageId__c.

Also check debug logs when you check the challenge.
Refer this post to check what the trialhead doing to test our work in background :
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kIudIAE

So you can check where their test is failing.

Please make sure to mark this post as solved if it helps you.

Best Regards,
Nagendra.P
Adam TossellAdam Tossell 
Hi Guys. 
I have just begun the SuperBadge: Lightning Experience Specialist. I am unable to rename standard objects. Any thoughts? 
Cheers. 
Mark
Best Answer chosen by Adam Tossell
Parker EdelmannParker Edelmann
Hello again Mr. Tossell,

In order to rename the label of Standard Objects, their tabs, and/or their fields, search "rename" in the quick find box. Rename Tabs & Labels should come up, you can't miss it. I've attached two screenshots to illustrate this. They show the Lead object being renamed, but it's the same for other Standard and Custom Objects.

User-added image

User-added image

I just finished the LEX Superbadge myself, so if you have any more questions, feel free to post to my Success Community feed.

Thanks,
Parker Edelmann
RRRizeRRRize 

I currently have a date field that displays a date 3 days from the date the form is opened. Here is the formula I used: TODAY() + 3

 

I would like to modify the formula to show a value of 3 business days instead of 3 days.  Can someone help?


Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
shruthishruthi

 

CASE(MOD(TODAY()- DATE(1900, 1, 7), 7), 0, TODAY()+3, 1, TODAY()+3, 2, TODAY()+3,3, TODAY()+5, 4, TODAY()+5, 5, TODAY()+5, 6, TODAY()+4,null)
The above formula can be used to show TODAY()+3 business days [excluding saturday and sunday]. Please let me know if this helps.
Cheers!

 

Alhad DeshpandeAlhad Deshpande 
Hi,
I am stuck in Step 2 (Automate Accounts) . I am getting below error message.
Challenge Not yet complete... here's what's wrong:
Please check the configuration of the custom fields on the Account object. The formulas, rollup summaries, etc. did not produce the expected outcome.

I have Created Custom Fields as below
Number of deals, Number_of_deals__c --> Roll-Up Summary (COUNT Opportunity)     
Number of won deals, Number_of_won_deals__c --> Roll-Up Summary (COUNT Opportunity) with filter criteria of Closed Won
Amount of won deals, Amount_of_Won_Deals__c --> Roll-Up Summary (SUM Opportunity) with filter criteria of Closed Won
Last won deal date, Last_won_deal_date__c --> Roll-Up Summary (MAX Opportunity)
Deal win percent, Deal_win_percent__c - Formula --> IF ( Number_of_deals__c > 0, (Number_of_deals__c / Number_of_won_deals__c ), 0))
Call for Service, Call_for_Service__c - Formula --> IF(OR(TODAY() - 730 > Last_won_deal_date__c , TODAY() + 730 < Last_won_deal_date__c ), 'Yes','No')

Also my Validation Rules are configured as :
For Account Name Edit Validation - Created 2 Validation Rules
ISCHANGED( Name ) && ISPICKVAL(Type, "Customer - Channel")
ISCHANGED( Name ) && ISPICKVAL(Type, "Customer - Direct" )

For Billing State/Province Validation Rule is
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY", BillingState))

For Billing Country Validation Rule is
BillingCountry <> "US" && BillingCountry <> "USA" && BillingCountry <> "United States" &&  NOT( ISBLANK(BillingCountry ) )

Same Validation rule are set for Shipping State/Province and Shipping Country (with correct field name).

Can anyone help me with this????
Best Answer chosen by Alhad Deshpande
Pradeep SinghPradeep Singh
Hi, Please check the formula for Deal win percent, Deal_win_percent__c - Formula --> IF ( Number_of_deals__c > 0, (Number_of_deals__c / Number_of_won_deals__c ), 0)),

It should be IF ( Number_of_deals__c > 0, (Number_of_won_deals__c / Number_of_deals__c ), 0)),
Glenn Dailey 1Glenn Dailey 1 
The 'AccountProcessor' class did not achieve 100% code coverage via your test methods. Make sure that you chose 'Run All' tests in the Developer Console at least once before attempting to verify this challenge. I did the run all with no luck. I did notice that this is the new section that was just added and I ran into issues in the first unit too.

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.

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();
      }
      update lstAccount;
  }
}

and
@IsTest
public class AccountProcessorTest {
    public static testmethod void TestAccountProcessorTest(){
        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;
       
        set<Id> setAccId = new Set<ID>();
        setAccId.add(a.id);
 
        Test.startTest();
            AccountProcessor.countContacts(setAccId);
        Test.stopTest();
       
        Account ACC = [select Number_of_Contacts__c from Account where id = :a.id LIMIT 1];
        System.assertEquals ( Integer.valueOf(ACC.Number_of_Contacts__c) ,1);
  }
 
}
Best Answer chosen by Glenn Dailey 1
Amit Chaudhary 8Amit Chaudhary 8
I am glad that works. PLease mark best answer and close this thread so that if some one has same issue that post can help other
LinThawLinThaw 
Hi there, 

I got following error on step 3.

A Volunteer Shift Worker record created for another user is not in their approval queue, or it does not have the correct status automatically assigned.

Anyone passed this step?

Thanks
LinThaw
Best Answer chosen by LinThaw
KruzKruz
Hi LinThaw,

The problem is in process builder. please check process builder.

Initial criteria (1st Block) for process builder is: Status does not equal to Confirm and completed then and then your approval process will fire after that in 2nd block criteria is IsShiftVolunter = true then action should be field update (Update Status to 'Confirm').

I hope you got the answer. and if you have any problem to pass this challenge feel free to contact me.
Test User 15Test User 15 
Challenge Not yet complete... here's what's wrong: 
A Volunteer Shift Worker record created for the logged in user is not automatically being assigned the correct status.

Created Approval Process and Called it in Process builder still getting errors
Best Answer chosen by Test User 15
Amit Singh 1Amit Singh 1
The Error is in your Process Builder. See the below process builder and match the same
User-added image
User-added image
User-added image
User-added image