function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mars Rover guestadminMars Rover guestadmin 

Superbadge Process Automation

Hi There, I am stuck with the challenge 7 - Superbadge Process Automation :
error message: The Robot Setup Day of the Week formula does not seem to be working properly. The Day of the Week should not fall on Saturday or Sunday.
The process works fine when I am testing it. I added a second process only for the Robot Setup which determines Saturday/Sunday and adding 1/2 days.
The formula on the Robot Setup Date "[Opportunity].CloseDate ...." worked fine as well .
Nevertheless checking teh challenge brings always the same bl.. error.

NagendraNagendra (Salesforce Developers) 
Hi Rover,

To complete this challenge you must first change  field type of field "Day of the Week" on robot object to formula text and
use the below formula.

CASE( MOD( Date__c - DATE(1900,1,6),7) , 0, "Saturday",1,"Sunday",2,"Monday",3,"Tuesday",4,"Wednesday",5,"Thursday",6,"Friday","") 

Instead of creating a new process You can clone the Existing process which you have build.

In Closed won criteria's immediate action Change formula of date field from [Opportunity].CloseDate + 180 to

CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900, 1, 7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180)

Please let us know if this helps.

Thanks,
Nagendra
Kaaviya P 4Kaaviya P 4
@Nagendra  sir
Can you help me ,I dont know how I to do this steps and where I start ,can you explain the step ?

In Closed won criteria's immediate action Change formula of date field from [Opportunity].CloseDate + 180 to

CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900, 1, 7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180)

 
Dinesh Kumar K BDinesh Kumar K B
Home -> Process Bulider -> Automate Opportunities -> 
 1. Deactivate
 2. Clone the Automate Opportunities
 3. Delete the old one
 In Closed won criteria's immediate action Change formula of date field from [Opportunity].CloseDate + 180 to

CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900, 1, 7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180)
 4. Rename the cloned one as "Automate Opportunities" and Activate
Kaaviya P 4Kaaviya P 4
Thanks a lot sir,I completed.
Kaaviya P 4Kaaviya P 4
Trailmix 5  --> Asynchronous Apex --> Use Future Methods:
       I created two appex class , test the two vapex class it shows below error in AccountProcessorTest , I couldn't find what is error in that step

        Error  : System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, error: []                    Stack Trace : Class.AccountProcessorTest.TestAccountProcessorTest: line 6, column 1   

@isTest
public class AccountProcessorTest {
    public static testmethod void TestAccountProcessorTest(){
     Account a = new Account();
        a.Name = 'Test Account';
        Insert a;
        system.debug('account a :'+a.id);
        
        Contact cont = New Contact();
        cont.FirstName ='Ankit';
        cont.LastName ='Avula';
        cont.AccountId = a.Id;
        Insert cont;
        system.debug('contact cont :' +cont.id);
        
        List<Id> accIds = new List<Id>();
        accIds.add(a.Id);
        
        Test.startTest();
        AccountProcessor.countContacts(accIds);
        Test.stopTest();
        
        Account ACC = [select Number_of_Contacts__c from Account where id = :a.id LIMIT 1];
        System.assertEquals(ACC.Number_of_Contacts__c, 1);
    }
 
Kaaviya P 4Kaaviya P 4
Anyone help me to solve this problem