+ Start a Discussion
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
Mangi S V V Satya Surya Sravan KumMangi S V V Satya Surya Sravan Kum 
Hello,  I have been trying this program since last 4 hours I'm stuck with it please some one help me 
Best Answer chosen by Mangi S V V Satya Surya Sravan Kum
Suraj Tripathi 47Suraj Tripathi 47
Hi Mangi,

Check this code:-
public class NumberTOWordConvertion {
    public static void method(){
        Date dt = Date.newInstance(2020, 6, 1);//user give any month
        
        Integer month = dt.Month(); 
        Integer year = dt.Year(); 
        Integer numberDays = Date.daysInMonth(year, month);
        Integer totalSun = 0;
        Integer totalSat = 0;
        for(Integer i=1;i<=numberDays ;i++)
        {
            Date myDate = date.newInstance(year, month, i);
            Datetime dt1 = (DateTime)myDate;
            if(String.valueOf(dt1.format('EEEE')) == 'Sunday')
            {
                totalSun = totalSun+1;  
            }
            if(String.valueOf(dt1.format('EEEE')) == 'Saturday')
            {
                totalSat = totalSat+1;  
            }
        }
        
        System.debug('totalSun -->> '+totalSun);
        System.debug('totalSat -->> '+totalSat);
    }
}

In case you find any other issue please mention. 
If you find your Solution then mark this as the best answer. 
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
Anshuman ParhiAnshuman Parhi 
  1. Create custom object ‘Complaints’ with appropriate fields. It will have ‘Response Date’ field (Date/time). It will also have ‘Priority’ field (Picklist). Write a code which will auto-update Response Date field based on Priority using following mapping:             
 
PriorityResponse Date
CriticalCreation Date + 6 Business Hours
HighCreation Date + 2 Business Days
MediumCreation Date + 5 Business Days
LowCreation Date + 10 Business Days

[Response Date cannot include Saturday/ Sunday in calculation as they are not business days]

Any solution for this..
Best Answer chosen by Anshuman Parhi
CharuDuttCharuDutt
Hii Ayushman
Try Below Code
trigger ComplaintsTrigger on Complaints__c (before Update) {

    for(Complaints__c Acc:trigger.new){
         if(Acc.Priority__c == 'Critical'){
            Acc.Response_Date__c = Acc.CreatedDate.AddHours(6);
        }
        else if(Acc.Priority__c == 'High'){
            Acc.Response_Date__c = Acc.CreatedDate.AddDays(2);
        }
        else if(Acc.Priority__c == 'Medium'){
            Acc.Response_Date__c = Acc.CreatedDate.AddDays(5);
        }
        else if(Acc.Priority__c == 'Low'){
            Acc.Response_Date__c = Acc.CreatedDate.AddDays(10);
        }
       
       datetime myDate = datetime.newInstance(Acc.Response_Date__c.year(), Acc.Response_Date__c.month(), Acc.Response_Date__c.day());
       String day = myDate.format('EEEE');
         system.debug(day);
       
        if(day == 'Sunday' || day == 'Saturday'){
            Acc.priority.AddError('Error');
        }

	}
}
Please Mark It As Best Answer If It Helps
Thank You!

 
Nuevo9763Nuevo9763 
I added a new value to an existing custom field which is of type picklist on contact object. Now if I create a new contact I can see the new value in picklist. But if I want to edit an existing contact record and assign the new value, I do not see that value in picklist. I checked for any workflow rules and apex code is not controlling the values that appear in picklist. Does anyone know why? Any help appreciated.
Thanks,
MK7
 
Best Answer chosen by Nuevo9763
Joshua Long 10Joshua Long 10
User-added image
Chris McCartyChris McCarty 
How does one add the Salesforce Trailhead Badges (link) on their Linkedin Profile? When I edit my Linkedin profile where do I do this?
Thanks!
Best Answer chosen by Chris McCarty
Sebastian.PerazaSebastian.Peraza
I just added a badge that i've already had in my LinkedIn profile.
You can go to your LinkedIn profile and under Add certificate -> Certification Name & Certification Authority (Salesforce Trailhead).
That's it.
Daniel Garcia-Gurtubay 5Daniel Garcia-Gurtubay 5 
Hi,

I am not able to get the license and profile set up correctly for Ada Balewa, and I have tried all the licences available.

User-added image

User-added image

User-added image

Any tip?

Thanks a lot

Dani
Best Answer chosen by Daniel Garcia-Gurtubay 5
Narender Singh(Nads)Narender Singh(Nads)
Hi,
You are choosing the wrong license mate.

Refer to this screenshot.
User-added image
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)),
David Vickers 44David Vickers 44 
I am a beginner with coding and looking for help

The code I have below works for getting 100% coverage and passes the trailhead evaluation however I also wanted to assert that the Error message is correct.

because I wanted to set up all test data outside of the starttest() and I wanted to check and valid insert as well as a invalid one I need to write the saveresults to a list. Everything works fine untill i tried to access the  error messages.
I have played with every variation but cannot figure out the syntax

system.debug(r1.getErrors());  gives me  DEBUG|(Database.Error[getFields=();getMessage=The Last Name "INVALIDNAME" is not allowed for DML;getStatusCode=FIELD_CUSTOM_VALIDATION_EXCEPTION;])

system.debug(r1.getErrors().getMessage);  doesn't compile " Initial term of field expression must be a concrete SObject: List<Database.Error>"
system.debug(r1.getErrors().getMessage()); doesn't  Method does not exist or incorrect signature: [List<Database.Error>].getmessage()

And so my tries Have gone on!

how do I get the getMessage field from the getErrors?

 
@istest
private class TestRestrictContactByName {
    @isTest Static void TestRestictedname(){
        List<contact> testcontacts = New List<contact>();
        contact c0 = new contact(LastName = 'Testcontact');
        testcontacts.add(c0);
        Contact c1 = new contact(LastName = 'INVALIDNAME');
        testcontacts.add(c1);
        Test.startTest(); 
        Database.SaveResult[] srList = Database.insert(testcontacts, false); 
        Test.stopTest();
        Database.SaveResult R0 = srlist[0];
        Database.SaveResult R1 = srlist[1];
        
        System.assert(r0.isSuccess());
        System.assert(!r1.isSuccess());
                      
                      }
                      }

 
Best Answer chosen by David Vickers 44
Amit Chaudhary 8Amit Chaudhary 8

Please check below post for same issue
1) https://developer.salesforce.com/forums/?id=906F0000000BNjqIAG
2) https://developer.salesforce.com/forums/?id=906F0000000BQwoIAG

you can try below code
@isTest
public class TestRestrictContactByname {
    
    @isTest static void TestContactWithInvalidNameNotInserted(){
        
        String inputLastName = 'INVALIDNAME';
        Contact newContact = new Contact(LastName= inputLastName);	    
        
        Test.startTest();
        try{
            insert newContact;
        }
        catch (DmlException dmlEx) {
        	
        	// Verify (Assert)
        	// In this case the insert should have been stopped by the trigger,
        	// so we need to verify that we got a dml exception (and specifically that we got the error message
            // that we were expecting).
        	String expectedMessage = 'The Last Name "'+ newContact.LastName+'" is not allowed for DML';
            System.assertEquals(expectedMessage, dmlEx.getDmlMessage(0));
        }
        Test.stopTest();
    }
}

Sample code 2:-
@isTest
private class TestRestrictContactByName {

    @isTest static void metodoTest() 
    {
        Contact c = new Contact(LastName = 'INVALIDNAME');
  
       
        Database.SaveResult result = Database.insert(c, false);
      
       
        System.assert(!result.isSuccess());
        System.assert(result.getErrors().size() > 0);
        System.assertEquals('The Last Name "INVALIDNAME" is not allowed for DML',
                             result.getErrors()[0].getMessage());


        
    }
    
}


Let us know if this will help you

Thanks
Amit Chaudhary
 
Shahab KhanShahab Khan 
Hi,

I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.

Thanks,
Faraz
Best Answer chosen by Shahab Khan
Grazitti TeamGrazitti Team
Hi Shahab,

Create a new custom field, where type is "formula" and the formula return type is "text".

In the formula, use the TEXT() function, and pass the existing number field value into this formula. For example, if your number field is MyNumber_c then your formula would be: TEXT( MyNumber_c )

Your users will enter values into the existing number field, but you can use the formula field (which doesn't display thousands separators)


And don't forget to mark this answer as best, if answer this helps you :-)


--
Regards,
Grazitti Team
Web: www.grazitti.com