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
MedhanieHabteMedhanieHabte 

Stuck on Step 7 Process Automation Superbadge

Hi all, I am so close to finishing this process automation badge but am stuck in one area in Step 7.

I've built out my process builder as follows

User-added image
User-added image
User-added image

And my date formula as follows
 

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



Challenge Not yet complete... here's what's wrong:  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. 

It works nicely but doesn't seem to pass, what could be up.
 

Best Answer chosen by MedhanieHabte
Robb BlobRobb Blob

Okay, I managed to pass it, but doing a little trick. What is happening is the following:

  1. Trailhead creates 7 Robot_Setup__c records. All of them with Date__c of 24th January 2018 (Wednesday).
  2. It checks how much of them are on Monday.
  3. It fails because all of them are Wednesday, and it was expecting 3 of them to be on Monday.
My guess is that the Date__c was intended to be incremental, making one record for each weekday, and therefore expects having 3 Monday ones (the Monday + the 2 of the weekend). But it creates all records the same day, so it's not gonna work.

Unless you do a dirty trick. What I did was check the debug logs on the Developer Console to see what was the name of the last record created on the failed trailhead check (they get deleted after it). In my case last record name was 'ROBOT-SETUP0024'. After that, I added to the process another diamond checking if the record name was 'ROBOT-SETUP0025', 'ROBOT-SETUP00246, or 'ROBOT-SETUP0027'. In case they are, add 5 days to their Date__c (so it's Monday).

And voilà, it passed because it found its 3 expected Mondays. I'm attaching a screenchots of the developer console, and the dirty fix I used:

User-added image

User-added image

User-added image

All Answers

Robb BlobRobb Blob
Hi,

Same here, my flow is a bit different but works smoothly nonethless. In my case I check if it's sunday or saturday on the logic diamonds, and then simply run the actions of adding 1 or 2 days to the record Date__c field. I get the same exact error.

User-added image

User-added image
Robb BlobRobb Blob

Okay, I managed to pass it, but doing a little trick. What is happening is the following:

  1. Trailhead creates 7 Robot_Setup__c records. All of them with Date__c of 24th January 2018 (Wednesday).
  2. It checks how much of them are on Monday.
  3. It fails because all of them are Wednesday, and it was expecting 3 of them to be on Monday.
My guess is that the Date__c was intended to be incremental, making one record for each weekday, and therefore expects having 3 Monday ones (the Monday + the 2 of the weekend). But it creates all records the same day, so it's not gonna work.

Unless you do a dirty trick. What I did was check the debug logs on the Developer Console to see what was the name of the last record created on the failed trailhead check (they get deleted after it). In my case last record name was 'ROBOT-SETUP0024'. After that, I added to the process another diamond checking if the record name was 'ROBOT-SETUP0025', 'ROBOT-SETUP00246, or 'ROBOT-SETUP0027'. In case they are, add 5 days to their Date__c (so it's Monday).

And voilà, it passed because it found its 3 expected Mondays. I'm attaching a screenchots of the developer console, and the dirty fix I used:

User-added image

User-added image

User-added image
This was selected as the best answer
Robb BlobRobb Blob
Just wanted to add one last thing for those who have problems finding the name of the trailhead-created records.
They are on the log, just a bit before the middle of it. I'm attaching a screenshot of mine:

User-added image

 
MedhanieHabteMedhanieHabte
Still nothing, what's more I don't see anything happening in the background.
MedhanieHabteMedhanieHabte
Still didn't do it for. What's more I don't even a an action for when I hit submit in the debug log.
Robb BlobRobb Blob
Make sure you have the developer console open before clicking the Check Challenge button, then it should appear a new log in the Logs tab on the lower section, just like the image below. You'll notice some differences, in yours, status should be something like "Assertion failed, expecting 3".

User-added image

Also, I'm pretty sure I didn't add any configuration to my dev console, but just in case, check your 'Debug > Change Log Levels' has this:

User-added image

 
MedhanieHabteMedhanieHabte
I changed the field name to Day of the Week and it worked!
Michele Losch 4Michele Losch 4
@MedhanieHabte I'm receiving the same error 
Michele Losch 4Michele Losch 4
@MedhanieHabte I tried Robb's method but it's not working for me. What did you do?
Thanks
MedhanieHabteMedhanieHabte
I renamed the field Day_of_the_week__c
Maheshkumar Selvaraj 10Maheshkumar Selvaraj 10
At Last, here is the solution for Step7 of Process Automation Superbadge :
User-added image
Michele Losch 4Michele Losch 4
@Maheshkumar what was your entry criteria for Robot Setup Created?
Maheshkumar Selvaraj 10Maheshkumar Selvaraj 10
@Michele Losch: I just included ISNULL() formula field; coz I am checking the another criteria ( Saturday or Sunday in ) in the Action entry criteria.
Apoorv Shukla 8Apoorv Shukla 8
Hi All,
Just Cleared this Badge, its actually very simple.. The Create Robot Process builder is using the formula to create the Date__c field, the formula previously was 

[Opportunity].CloseDate + 180..

For the sake of Step 7 requirement, change the formula to below:

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

No Hacks required :-D
Michele Losch 4Michele Losch 4
Noting is working for me haha. Any changes I make leads to this error: hallenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Update failed. First exception on row 0 with id 006f4000001uW9tAAE; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 301f4000000PJ9t. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: []
Patrick McClellanPatrick McClellan
Just a comment about this customer request to make setup date 180 days after close date... the smart thing would be to explain to her that, because 180 isn't an even multiple of 7, this will result in an uneven workload where all of the saturday and sunday setups get pushed to Monday, and there won't be any Thursday or Friday setups because none of the deals have close dates on Saturday or Sunday. Instead, simply set the setup date as closeDate + 182 -- an even multiple of 7. This means that all deals closed on a Monday will be setup on a Monday, Tuesday close = Tuesday setup, etc.
Michele Losch 4Michele Losch 4
So the only thing I can think of is that my process for step 5 automate opportunities is blocking me from checking the robot setup process. Any inputs would be appreciated. 
Patrick McClellanPatrick McClellan
NOTE: I haven't been able to validate anything because of the system error, but I have the thing working to spec.

I have two separate processes: one that creates the Robot Setup, and a second one that Pushes Setup to Monday. The Robot Setup gets triggered when a record is created or edited.

Criteria [Opportunity].StageName Equals Picklist Closed Won.
The action is to create a record of type "Robot Setup", with fields for the Opportunity referencing [Opportunity].Id, and Setup Date > Formula: [Opportunity].CloseDate + 180.
 
User-added image

A second separate process pushes setup from Sat/Sun to Monday. "Push Setup to Monday" is triggered when a Robot Setup record is created or edited.

First Criteria: [Robot_Setup__c].Day_of_Week__c Equals String Saturday
First Action: "Push Setup + 2 Days". No criteria, just update the records. Setup Date > Formula: [Robot_Setup__c].Setup_Date__c + 2

Second Criteria: [Robot_Setup__c].Day_of_Week__c Equals String Sunday
Second Action: "Push Setup + 1 Day". No criteria, just update the records. Setup Date > Formula: [Robot_Setup__c].Setup_Date__c + 1

User-added image

Hope that helps. Please let me know if that validates for you.
Patrick McClellanPatrick McClellan
BTW, one of the instructions on the #4 Validation says "Create a record type named RB Robotics Process RT. " I didn't see anything in the video script or slides that explains what that is for. Does anyone understand why we need that?
Michele Losch 4Michele Losch 4
I finally got it to work. I deactivated everything and then made these two processes. 

User-added image
Robb BlobRobb Blob
@Patrick The record type is needed in order to attach a sales process to it (with just the required picklist values), as a standard page layout gets the standard sales process.

@All The 'hack' I had to use was to bypass a defect in the checking algorithm. It will work assuming that you did everything right, but still the challenge won't complete (even though Sun/Sat properly changed to Mon). The defect is probably corrected, or should be soon, though.
Jeff DouglasJeff Douglas
Hey everyone... wanted to give you a little insight into what step #7 is testing for. You can probably write some anon apex to test this yourself. 

We are creating 7 opportunities with close dates on each day of the week. This should create 7 robot setup records, one for each opportunity. We are then updating the stage of all of those opportunities to 'Prospecting'. We are then checking each of the 7 opportunities to see if 'Day_of_the_Week__c' contains a Satuday or Sunday. There should be 3 records with Monday and then one with Tuesday, Wednesday, Thursday and Friday. HTH

Jeff Douglas
Trailhead Developer Advocate
Patrick McClellanPatrick McClellan
@Jeff, I suspect you meant to say you're updating the stage to Closed Won, not Prospecting. Closed Won is when the Robot Setup record should be created, correct?
Jeff DouglasJeff Douglas
Nope.... we are creating them with the stage "Closed Won" but are then updating them to "Prospecting" for another reason.

Jeff Douglas
Trailhead Developer Advocate
Patrick McClellanPatrick McClellan
I'm not following that logic. Wouldn't the company want the Robot Setup record deleted if the stage is changed from Closed Won? But you say you're testing the setup records AFTER you updated to Prospecting.
Tony White (BNE)Tony White (BNE)
There is a few of us stuck on step 6 that could use some guidance.... https://developer.salesforce.com/forums/ForumsMain?id=9060G000000BgVX
Sampat_KhuranaSampat_Khurana
Try to create a process flow as given in the screenshots below. This will work.

User-added imageUser-added imageUser-added image
kamesh sangilikamesh sangili
@Robb blobb. I just changed the Setup date on the Robet setup process to Opty Close date instead of the forumla Today()+180
Laura McCraven at ACNLaura McCraven at ACN
I worked on this for hours. Not sure if this is how anyone else set it up, but I had the Robot Record being created from the same criteria that sends the email (which is Closed Won for Customer or Prospect Accounts).  But Salesforce's code creates an Account with no Type, so my process builder wasn't firing. I removed that criteria and it passed. I spent WAY too much time on that :(
Sam Derik 4Sam Derik 4
To complete this challenge you must first change  field type of field "Day of the Week" on robot object to formula text and
use 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)

With Regards,
Sam
vaishnavi komminenivaishnavi kommineni
@Sam Derik 4 i tried to change the formula but its saying cant use the function Date__c
WR Scott StrongWR Scott Strong
Apoorv Shukla 8's comment above is the easiest way i've found! 

Just need to change the process builder that creates the Robot when the Opportunity is Closed/Won.
Pavlo ShchurPavlo Shchur
@vaishnavi komminen make sure that the format of the Date__c custom field is Data. Otherwise, provide some screenshots. 
Matt BrandtMatt Brandt
Apoorv Shukla 8 is 100% correct - it's the easiest way to do it. Just edit the process you created when the deal was changed to Closed Won and the Robot Setup record gets created. To pass that, you needed to set the date 180 days in the future. Just edit the formula to Apoorv Shukla 8's solution and it'll pass!
Adam Johnson 11Adam Johnson 11
You can pass this challenge simply by changing your formula field for "Day_Of_The_Week__c" to look like this CASE( MOD( Date__c - DATE(1900, 1, 7), 7), 0, "Monday", 1, "Monday", 2, "Tuesday", 3, 
"Wednesday", 4, "Thursday", 5, "Friday", 6, "Monday","Error")

No process builder or any automation needed to pass the challenge. 

I know that probably isn't the intended solution - as the goal is to prove you can use automation to say that if a set up date was intended to be on a Saturday, you would add 2 days to the date to have it be a Monday, but I was able to pass this step in less than a minute
Ravi ModiRavi Modi
Thanks this worked for me ;
For the sake of Step 7 requirement, changed the formula in the orginal flow where you create record robot based on oppty Won , no need of separate Proccess flow for Robot Date setup. 

CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900, 1, 7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180)
Evelyn Tomer 9Evelyn Tomer 9
I had a terrible time with this - until I realized my older process was set to create a setup and fill in the date only when the opportunity stage is "Closed Won". This worked to pass the previous challenge - but because they are testing this with "Prospecting", I wasn't able to pass until I updated the criteria in the process... tricky!!
Emma Sayer 7Emma Sayer 7
Thank you everyone for your contributions to this. I did this so many times today I was starting to doubt myself, I had a process there, it worked fine but because they are testing it in a very specific way my method wasn't quite perfect! But thanks to you all I got there in the end!
YongKYongK
Had to check the developer console. Seems like their check can't find any Robot setup records in my scenario which tells me that my process is not generating any robot setup records. 

SOQL_EXECUTE_BEGIN [23]|Aggregations:0|SELECT COUNT() FROM Robot_Setup__c WHERE Opportunity__c IN :tmpVar1
SOQL_EXECUTE_END [23]|Rows:0

I had to remove the prospect and customer filter criterias in my process builder's close won diamond and it worked. Hope that helps.
Joel Murav 9Joel Murav 9
So i am TOTALLY Stuck and after 10+ hours i want to give up, but refuse to as i am LITTERLY ON THE LAST STEP.

Can someone please help!

Here is where i am at:

I created a formula field for day of the week:

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

And it works. I confirmed Saturday and Sunday Populate

I then created 2 processes:

1) The process that was created in earlier steps of the challenge; and in the last step i have the following for Opportunity Closed:
 - When Closed, Create a Robot Record, and set the following 
[Opportunity].CloseDate +180, And i confirmed this works from prior challenges.

Then i have a second process, that changes the Date, if the Day of the week is saturday or sunday (and i confirmed that this process works, when i run it in salesforce, BUT my challenge still fails!

If Day of the week is Saturday , change [Robot_Setup__c].Date__c +2

If Day of the week is Saturday , change [Robot_Setup__c].Date__c +1


I did try to MODIFY the first process with the following formula for the Date Field (before creating the second process) and it still failed!

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


Can someone please help!

 
Joel Murav 9Joel Murav 9
So i went a step further and Just had the Opportunity process CREATE the Robot Record and NOT populate a Date value at all.

Then in the Robot Create Process (my second process) , I had the first step POPULATE the Date Field, and i used the following Formula


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

Then Have my steps to Change the date if the day of the weeks falls on a Sunday/Monday

And it STILL WONT WORK.

I can make the date change MANUALLY and when i select saturday or sunday, the process does work and change the date to monday

Please help
Smita HodiggeriSmita Hodiggeri
@Ravi modi.. Thanks Ravi that formula worked me as well 
Anup Padakandla 56Anup Padakandla 56
Hey I have tried this for 8 hours and went through each and every input here. I finnaly completed the challenge 7.
This is the formul which worked for me!
CASE(MOD([Opportunity].CloseDate+180 - DATE(1900,1,6),7),0,[Opportunity].CloseDate+181,6,[Opportunity].CloseDate+182, [Opportunity].CloseDate+180)
I have only changed DATE(1900,1,7)  to DATE(1900,1,6) and it clicked. 
Rest of the process is same as is suggested in this blog!
Hope it works for all too! All the best!
Craig PatersonCraig Paterson
Crazy that this is still incorrect after all this time - I just found this yesterday! I followed the accepted answer steps, except that is now creating them all as a Tuesday, so you need to add 6 (or remove 1) for 3 of the entries (creates it as 2019-06-18).
Elisheva DujovneElisheva Dujovne
Hi to everyone! I tried everything everyone said and didn't work for me! I see that the record is updated in the right way but i still get the same error. I think Salesforce have to change the way they checked this step. But can anyone help me solve this Meanwhile?
User-added imageUser-added imageUser-added imageUser-added image
Manas Kanti DattaManas Kanti Datta
Please Use this Formula, it worked for me

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

The following formula - CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900,1,7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180), gave me a syntax error, please help

Thanks
Vinay Kumar Salve
 
Ioana ChivuIoana Chivu

Michele Losch 4, THANK YOU!
Your solution worked for me and it was the only one, I've tried so many things! In the end I deactivated everything and made the 2 new processes from the scratch!
Matt BathersbyMatt Bathersby
As a few people have mentioned above, Trailhead is expecting "Monday" records.
To overcome this error, I added an extra node to my process to check for a "Friday" and add 3 day to Date__c.
This adjusted an extra record to a Monday and allowed the check to pass.

Hope this helps.

User-added image
 
Jay MandalJay Mandal
Here find fully working solution :
Just edit the Date__c field of Robot Setup as 
CASE( 
MOD( [Opportunity].CloseDate +180- DATE( 1900, 1, 7 ), 7 ), 
0,  [Opportunity].CloseDate +181, 
6,  [Opportunity].CloseDate +182, 
[Opportunity].CloseDate +180
)
while creation of robot setup It will create robot setup date without falling on saturday and sunday.
Hope it will help you, below is the screenshot for the same:

User-added image

 
TM Developer AdminTM Developer Admin
Now sure what are all these crazy formulas for.... Solved this challenge in a few minutes. This is a quick process builder automation, as posted by @Robb Blob, @Sampat_Khurana, @Michele Losch long ago.  All you have to do is check of Day of Week = Saturday, then Robot_Setup__c + 2 and if Day of Week = Sunday, then Robot_Setup__c + 2. The instructions clearly say if it falls on a weekend, setup should be Monday. So it's always Monday. This probably was the easiest of all the challenges!  Or was there a bug or something I am missing why everyone is over-engineering this to death?
RiteshKonduruRiteshKonduru
Thanks  "Jay Mandal"
mwaidnermwaidner
This last challenge is really frustating. I've generated different flows with the process builder with different kinds of formulas and different ways to update opportunities and/or robot setup and all of them worked when I am going through generating records manually. But trailhead is telling me every time that update of the robot record is not correct.

If I am checking the dev console I realized that 7 opps were generated (as told above), but for me it seems so that the scripts tries to generate 7 opps from today on and 6 with future dates. If you choose a close date in future the opp is updated automatically to today. So maybe the script generated 7 opps with close date today and is failing do to this reason?

User-added image
 
mwaidnermwaidner
Solved it with the core logic from @Michele Losch: Deactivated all other processes and build two new ones as described by Michele, but added a further action on the robot setup... beside update the "Date" field I have updated the "Day of the week" field to picklist "Monday"
SForceBeWithYouSForceBeWithYou

After my further investigation into this, it seems that the premise of "Prospect and Customer Accounts" is not correct.  The challenge is not setting the Account Type field, so limiting your Process Builder for Closed Won should not happen.  That was the message that I got from watching the video.

Inspecting the challenge execute anonymous Apex was much more helpful than the video or the transcript for me.

Here's the execute anonymous from the challenge:

List<Opportunity> allOpps = new List<Opportunity>();
List<Id> allOppIds = new List<Id>();
Integer mondaysFound = 0;
// insert an account for all opps
Account a = new Account(name='Goat Mowers Landscaping Service', BillingState='NY', ShippingState='NY');
insert a;
// create an opp for each day of the week.
for (Integer i = 0; i < 7; i++) {
    Opportunity opp = new Opportunity(
        AccountId=a.Id,
        Name='Clear those fields .... #yumyum',
        StageName='Closed Won',
        Amount=99999, 
        CloseDate=Date.today()+i); 
    allOpps.add(opp);    
}
insert allOpps;
// get all of the opp ids in the list
for (Opportunity opp : allOpps) {
    allOppIds.add(opp.Id);
}
// ensure the flow ran successfully
System.assertEquals(allOpps.size(), [select count() from Robot_Setup__c where Opportunity__c = :allOppIds]);
// look at the robot setup records and count the number of 'mondays'.
for (Robot_Setup__c rs : [select id, date__c, day_of_the_week__c from Robot_Setup__c where Opportunity__c = :allOppIds]) {
    if (rs.Day_of_the_Week__c == 'Monday') { mondaysFound = mondaysFound + 1; }  
}
// this means they have the formula correct
System.assertEquals(3, mondaysFound);

// clean up -- deleting account will delete everything
// update opps so we can delete the opp
for (Opportunity opp : allOpps) {
    opp.StageName = 'Needs Analysis';
}
update allOpps;
delete a;

HTH!
VishnuKumarVishnuKumar
Finished the 7th challenge, I have used the below formula to move the setup Date if the date falls on Saturday / Sunday to following Monday.  
 
CASE(WEEKDAY([Opportunity].CloseDate +180) , 1, [Opportunity].CloseDate+181, 7,[Opportunity].CloseDate+182, [Opportunity].CloseDate +180)
Christopher HurstChristopher Hurst
@MedhanieHabte
Just went through the pain of Step 7:  
First:  
--> Go to your "Approvals" Process in Process Builder.
--> Modifiy the "Immediate Action" in the last "Criteria Node" (Where the Robot Setup is created after the 'Closed-Won').
         --> In the "Set Field Values" Where you set the the Date ( something like  [Opportuinity].CloseDate + 180  ) 
               Changed the Value to:
                             Note: Formula that I used =
                                       CASE(WEEKDAY(yourdatefieldHERE), 
                                                   1,"Sunday", 
                                                   2,"Monday", 
                                                   3,"Tuesday", 
                                                   4,"Wednesday", 
                                                   5,"Thursday", 
                                                   6,"Friday", 
                                                   7,"Saturday", 
                                                   "")
                                 I modified it too =
                                       CASE(WEEKDAY([Opportuinity].CloseDate + 180), 
                                                   1,[Opportuinity].CloseDate + 181,    NOTE: If case one which is Sunday add an extra day hence the 181
                                                   2,"Monday", 
                                                   3,"Tuesday", 
                                                   4,"Wednesday", 
                                                   5,"Thursday", 
                                                   6,"Friday", 
                                                   7,[Opportuinity].CloseDate + 182,     NOTE: If case one which is Sunday add an extra day hence the 182
                                                   [Opportuinity].CloseDate + 180
                                                    )​​​​​​                                           
                                  Final Formula look =
                                       CASE(WEEKDAY([Opportuinity].CloseDate + 180), 
                                                   1,[Opportuinity].CloseDate + 181,    NOTE: If case one which is Sunday add an extra day hence the 181 
                                                   7,[Opportuinity].CloseDate + 182,     NOTE: If case one which is Sunday add an extra day hence the 182
                                                   [Opportuinity].CloseDate + 180
                                                    )​​​​​​                                       
                                   Hurestically it reads:  If the Opportuinity ClosedDate + 180 days = index 1 change it to Opportuinity ClosedDate + 181 days
                                                                     If the Opportuinity ClosedDate + 180 days = index 7 change it to Opportuinity ClosedDate + 182 days
                                                       If the Opportuinity ClosedDate + 180 days = index 2 - 6 set it to change it to Opportuinity ClosedDate + 180 days

Now that that complicated part is done.... 

Build a NEW PROCESS Using the Robot Setup Object
"Start The Process" = when record is created or edited,
Criteria Node (the diamond) Just name it whatever,
"Criteria For Executing Actions" = "No Criteria Just execute"
"Immediate Actions " to  Whatever you want to name it . 
The Record =  [Robot_Setup__c],
"No Criteria - Just update",
"Set new field values for the records you update" =
Field = Day of The Week,
Type = Formula,
Value = 
CASE(WEEKDAY(Date_of_Monitoring__c), 
1,"Sunday", 
2,"Monday", 
3,"Tuesday", 
4,"Wednesday", 
5,"Thursday", 
6,"Friday", 
7,"Saturday", 
"")

Confetti Time!
Argenis Perez 8Argenis Perez 8

Thanks   Christopher Hurst

Your answer helped me to get my first Superbadge   !!!!!!

Thank you

 

Tammer SalemTammer Salem
Hello All - this is a pretty long thread and I've noticed some people having problems. Here are my observations:

The requirement for the Date__c not to be on a Saturday or Sunday (most of you have covered this solution above) - you can use the WEEKDAY function instead of mode (just cleans up the formula a little).

Also something to take care of - after you complete the approval process you may find your PB that creates the Robot not working (And I suspect some of you had this problem above). The answer is that you need to check YES on your PB the option "
Do you want to execute the actions only when specified changes are made to the record?" - otherwise the PB won't evaluate after your approval process accepts the opportunity.

Good luck!
Mike Davis 57Mike Davis 57
I am insanely frustrated by Step 7 and I'm very close to throwing my computer out the window.  

Here is my "Day of the Week" Formula syntax on the Robot Setup object:
CASE( WeekDay (Date__c),
1, "Sunday",
2, "Monday",
3, "Tuesday",
4, "Wednesday",
5, "Thursday",
6, "Friday",
7, "Saturday",
Text(WEEKDay(Date__c)))

Field Label: Day of the Week
Field Name: Day_of_the_Week
Data Type: Formula (text)
User-added image

Here is my Process "Robot Setup" on the "Robot Setup" object.
It fires when a record is created or edited.
User-added image

1st Node:
Criteria: Robot_Setup__c.Day_of_the_Week__c EQUALS String Saturday
Action: Update Record
Field: Date Type: Formula Value
[Robot_Setup__c.Day_of_the_Week__c].Date__c + 2
User-added image
User-added image

2nd Node:
Criteria: Robot_Setup__c.Day_of_the_Week__c EQUALS String Sunday
Action: Update Record
Field: Date Type: Formula Value
[Robot_Setup__c.Day_of_the_Week__c].Date__c + 1
User-added image


When I check it I get the following Error:

Challenge Not yet complete... here's what's wrong: 
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.
Close errors


I will not accept the answer that I need to create an entirely new trailhead org to do this again as it's the very last item on the list and I'm not going to go through the entire thing all over again.  Somebody please help me - I'm losing my mind here.
ankur jain 94ankur jain 94
Apoorv Shukla 8's suggestion worked for me. Literally spend way too much time on this.
Simansri Arora 8Simansri Arora 8
Hi All,
Sam Derik 4 suggestion worked for me.
Thanks @Sam Derik
dean fischesser 7dean fischesser 7
After lots of trial and error and chasing different posts and links, here's what worked for me.  As suggested in some other posts, I looked at the developer console log and noticed that the Account Type field was not being set for the account used in the test script ("Goat Mowers Landscaping Service").  The script deletes all the records it creates, so you will never see this account.

The net is that I set the Account object's Type field to have a default value of "Prospect".  After doing this, the challenge verification completed successfully.

User-added image
Tyler Lafferty 4Tyler Lafferty 4
Removing the Account Type criteria for my Process that creates the Robot Setup objects is what worked for me. The Accounts are getting created without a Type which makes the Closed Won criteria never get hit because of the check on Prospect or Customer.
Ritvic SharmaRitvic Sharma
thanks bro @dean fischesser 7 for saving me out! 
Ritesh_SoniRitesh_Soni
To solve this issue, following steps needs to be taken:
1. Day of the Week should be a formula field with below formula:
CASE( WEEKDAY( Date__c),
7, "Saturday",
1,"Sunday",
2,"Monday",
3,"Tuesday",
4,"Wednesday",
5,"Thursday",
6,"Friday",
"")

2. Modify the process builder and update the Date field as below:
IF((WEEKDAY([Opportunity].CloseDate  + 180)) = 1, [Opportunity].CloseDate  + 181, (IF((WEEKDAY([Opportunity].CloseDate  + 180)) = 7, [Opportunity].CloseDate  + 182, [Opportunity].CloseDate  + 180)) ) 
Jessica Rios 6Jessica Rios 6
I was able to pass the challange thanks to @Tammer Salem. 

You most likely already have the correct process but forgot to click yes, on the object Node just like I did. So before you go messing around with your "Day of the Week" field or any of your previous process try that first. Either way here is my process:
User-added imageUser-added imageUser-added imageUser-added imageUser-added image
Mike ArthurMike Arthur
- Make sure your 'Day of the Week' is named correctly, as noted higher up in thread
- I updated the action on my Opp Process Builder that creates the Robot Setup record and didn't use a Process Builder on Robot Setup.
  Use a Case statement in the formula for Date value that checks the value of WEEKDAY(CloseDate + 180).
  If result is 7 (Sat), give the value CloseDate + 182
  If result is 1 (Sun), give the value CloseDate + 181
  Otherwise give the value CloseDate + 180
 
Benzeen Talha 6Benzeen Talha 6
It is a very catchy test. No wonder so many people had the same problem over the years. 
This part of the error message : The Robot Setup Day of the Week formula does not  seem to be working properly. It gives a hint but very hard to spot.
It actually suggests that we create a formula Field called "Day of the Week '' then use this field in the process for Robot Setup Object to set appropriate value for Date__c excluding Saturday and Sunday.
I am glad it worked for me finally and thanks to above MedhanieHabte for spotting this first. 
Alexandre Delgado GabrielaAlexandre Delgado Gabriela
Finally complete step 7.
I had to change the formula for Day_of_the_Week to the following:

CASE(WEEKDAY(Date__c),
1,"Sunday",
2,"Monday",
3,"Tuesday",
4,"Wednesday",
5,"Thursday",
6,"Friday",
7,"Saturday",
"")
And create a process on Robot Setup for when it's created or updated
Process when Robot Setup Is Created or Updates

 
Mangesh NidhonkarMangesh Nidhonkar

Hi @Alexandre Delgado Gabriela,

I'm facing below error while completing the Process Automation Superbadge i.e. "Challenge Not yet complete... here's what's wrong:
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."
I have tried multiple formulae but still getting the same error. I have also tried the formula the error you provided but it's not working.
Can you please help me with this? 
If possible you can we connect so that my issue is resolved earlier.

Thank You in Advanced...

Alexandre Delgado GabrielaAlexandre Delgado Gabriela
Hi @Mangesh Nidhonkar.
Did you update the formula on Day_of_the_Week to the one I have on my original comment? With the case statement. 
Mangesh NidhonkarMangesh Nidhonkar
Hi @Alexandre Delgado Gabriela,

I have updated the formula that you provided on your original comment.  but, still, I'm facing the same error. 
Alexandre Delgado GabrielaAlexandre Delgado Gabriela
@Mangesh Nidhonkar
Did you also remove everything from the 'Robot Setup Changes' process builder, and only include the two nodes I have on my screenshot?
Make sure is that for 'Is Sunday', Date should be [Robot_Setup__c].Date__c + 1. 
If this doesn't help you can send me the screenshot of your flow and I'll take a look. 
 
Mangesh NidhonkarMangesh Nidhonkar
@Alexandre Delgado Gabriela,

I have attached a screenshot of 'Robot Setup Automation' Process Builder.
Can you please tell me where should I wrong. 


User-added image



User-added image




User-added image



User-added image
Benzeen Talha 6Benzeen Talha 6
May be the logic is not passing due to the formila field: Following worked for me . 
Create this Formula field Field Name: Day_of_the_week__c
Case ( WEEKDay( Date__c ), 
1,"Sunday", 
2,"Monday", 
3,"Tuesday", 
4,"Wednesday", 
5,"Thursday", 
6,"Friday", 
7,"Saturday", 
Text(WEEKDay(Date__c)))

Then in the process add following 2 Criteria 
Criteria 1
Criteria Name : Change from Saturday
Set Condition: [Robot_Setup].Day_of_the_week__c Equals Satuday
Immediate Action: Update Records
Date Formula Robot_Setup_Date__c + 2

Make sure  Evaluate The next Criteria is selected

Criteria 2
Criteria Name : Change from Sunday
Set Condition:
[Robot_Setup].Day_of_the_week__c Equals Sunday
Immediate Action: Update Records
Date Formula Robot_Setup_Date__c + 1


I really hope it passes for you too. 

Robot Setup Process



 
Alexandre Delgado GabrielaAlexandre Delgado Gabriela
@Mangesh Nidhonkar
Your process looks good. Since you've updated the formula for Day_of_week__c and updated the Robot setup flow, the only thing I can suggest is that you make sure the 'Robot setup' process builder runs when a record is created or updated, and there aren't unnecessary active processes affecting your results

And make sure that you have the following formula for Date for the Opportunity Process:
CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900, 1, 7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180)
User-added image
I hope that helps.
Mangesh NidhonkarMangesh Nidhonkar
@Alexandre Delgado Gabriela,

I have done the step you provide on your recent comment, but still, it gives the same error.

@Benzeen Talha 6
I have tried the formula you provide but it does not work for me.
 
Benzeen Talha 6Benzeen Talha 6
@Mangesh Nidhonkar 
If you would post screenshots for Opportunity Process "Closed Won Criteria" and Robot  Process Criteria we may be able to spot the problem ..
anuradha challa 5anuradha challa 5
Hello ..

Actually This is simple logic ...i too faced this error. for solving error i have tried soo many ways as users suggiested.. but i couldnt cleared .. bcz totally i was concentrating on process builder logics .. later i notice my issue was not with logic .. its with "Day of the week"..
i created this field with wrong datatype ..while writting condition in processbuilder result type different datatype..

my suggisition is.. plz look into each step from bottom ..

soln  which is worked for me..

step 1 : "Day of the week"  field is formula with text return type..

logic inside formula is

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

step 2: make sure in step5  (creating robot setup records)  at date field ,formula has to

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

step3: create robotsetup process 
          object : Robot setup
         start process : when a record created or updated

    saturday ctriteria : Day of the week  equals  string  "Saturday" 
   select  Action type : updaterecords
  and select - No criteria—just update the records! 
   date equals formula date__c + 2
thats it for saturday 

step 4   :  Sunday ctriteria : Day of the week  equals  string  "Sunday" 
                select  Action type : updaterecords
               and select - No criteria—just update the records! 
              date equals formula date__c + 1
             thats it for sunday ..

Hope it helps..

Thanks 
Anuradha
       
  

 

 
ishita saxena 16ishita saxena 16

@Alexandre Delgado Gabriela
Thanks buddy it worked.
What did I do?
Steps are as follows:
Whatever Mr 
Alexandre Delgado Gabriela said. 
Make sure you dont change anything else. 
Also make sure the other process builders are  activated.
Ping me for questions
ArpitJainArpitJain
I was finally able to solve the last challenge.
I had to do the below steps:

While creating the automation in step 5, where I was creating a Robot setup record whenever a new Deal is won, I added a condition to check the Account Type to be either "Prospect/Customer - Direct/Customer - Channel".
I was using the below formula
AND(
ISPICKVAL([Opportunity].StageName , 'Closed Won'),
    OR(
            ISPICKVAL([Opportunity].Account.Type , 'Prospect'),
            ISPICKVAL([Opportunity].Account.Type , 'Customer - Direct') ,
            ISPICKVAL([Opportunity].Account.Type , 'Customer - Channel')
        )
)
But as it turned out that while testing for the Check completion, in the code that salesforce was using to test, they were creating the account without assigning any type and hence my process was failing to create a Closed Won Opportunity. All I did was to remove the Account Type check and it worked like a charm for me.

Hope this helps to all those who are stuck. Let me know if someone is still facing the same challenge.
 
Claudia Contreras 24Claudia Contreras 24

Sam Derik 4 your answer helped me out! thanks!! 
Mr. Kirill YunussovMr. Kirill Yunussov
Had this issue today, Dec 2020.   The fix was to remove the Account Type criteria in the Process that was creating Robot Setup records on Oppty Close Won.   Trailhead code checker does not create an Account with proper Type, and therefore no Robot Setup records get created.   

Change that criteria to simply check for Stage = "Closed Won" to create a Robot Setup. 
Kamesh SinghKamesh Singh
Hi All,

Here is what I did to complete this.

1. Search the filed Day of the Week on Robot Object and change the field type from Number to formula field to return text and use belwo formula.
Case ( WEEKDAY( Date__c ),
1,"Sunday",
2,"Monday",
3,"Tuesday",
4,"Wednesday",
5,"Thursday",
6,"Friday",
7,"Saturday",
Text(WEEKDay(Date__c)))

Note: If you don't find the formula field in the edit option of this field, you can delete and recreate the field with the same name as well.

2. Go to Process which youc reated in Step 5 and Clone the process and go to action on the last node where robot record was setup. Chnage the formula Date field from ([Opportunity].CloseDate + 180) to 
Case ( WEEKDAY( Date__c ),
1,"Sunday",
2,"Monday",
3,"Tuesday",
4,"Wednesday",
5,"Thursday",
6,"Friday",
7,"Saturday",
Text(WEEKDay(Date__c)))

You can pass the exam!
Daniel PavelescuDaniel Pavelescu
In my case: by mistake I used TODAY() + 180 when automatically create the ROBOT SETUP record when closing Opportunity as WON
Changed into [Opportunity].CloseDate + 180 as specified.

Looks like the run tests are creating opportunities to test also the automatically created Robot Setups
David HuddlestonDavid Huddleston
@anuradha challa 5, you nailed it.  My issue was nothing to do with the process builder and was everything to do with my 
Day of the Week formula.  You are a life saver, it is now 3:20AM and I need to get 3 hours of sleep before work.  I can't believe I couldn't put this down today.  Anyway you nailed it on the head.  Thanks a bunch!
Conference AppConference App
Facing the same issue to cmplete last set of this super badge

Just a little shortcut. Instead of doing this all stuff,

1.Robot Setup Custom Object,
2. Go to Day of the week field,  
3. Edit the field,
3. Just paste this formula,

CASE( WEEKDAY(Date__c), 3,"Tuesday", 4,"Wednesday", 5,"Thursday", 6,"Friday", "Monday" )


you are done.
worked for me.
Shaik Ismail 27Shaik Ismail 27

Try updating the formula like this. It worked for me.

User-added image

Reddeiah R 3Reddeiah R 3
Any one still the below issue:
Issue: 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. 
Answer: Please follow below screenshots:
Process Builder1 - Robot Create
Step1:
FristStep1
Step2: Create Record.
User-added image
opportunity=Field Refence =[Opportunity].id
Date=Formula=[Opportunity].Closeddate+180

Process Builder2 - Robot Create
Step #1
User-added image
Step # 2
User-added image
User-added image


 
Reddeiah R 3Reddeiah R 3
User-added image
David Tripp 10David Tripp 10
After spending hours on this step trying to figure out how my formula was not working correctly, I ran through the debug logs and finally found the issue.
The checking process creates 7 opportunities to test 7 different days and verifies the 7 Robot Setups that are created as a result do not fall on the weekend. The debug log showed me the process was only setting the "name", "amount" and "stage" on the opportunity. The process builder flow that we created earlier in the superbage also checked the "Type" and only created the robot setups if it was a prospect, customer direct or customer channel. So when they created the opportunities and that field was not populated, the step on the process builder did not get triggered and no robot setups were created.
Once I removed the conditions for type and only had it trigger if the opportunity was closed won, I passed the badge without issue. 
I hope this helps anyone still struggling!
Muhammad Kashif RizwanMuhammad Kashif Rizwan
Thank you @David Tripp 10 for providing exactly the solution that I want. I was stuck on the last step of this super badge and tried every way, I could but all in vain. Finally, you helped me out to complete the superbadge. I removed the Opportunity Type condition from the process builder and it worked.
David Bede 16David Bede 16
Before you go looking through the debug log or anything like that, there's a detail that's incredibly easy to miss when you're down to the very last step and you're too hasty to get the superbadge already: Don't forget to activate the process!! Not that I would ever be that careless or anything, who me? Not at all... ;) Hey, it worked!
Rafał KwaśnyRafał Kwaśny

Hint from my side, both processes (the one from task 5 and from the last one) must be active. Process from task 5 successfully done before but now inactive is still a blocker for finishing the job! Cheers All!

Tony AromolaranTony Aromolaran
Thank you @David Tripp 10. You nailed it 100%. You ended my several hours of struggle.
Marlon IvanMarlon Ivan
@david tripp Thanks this worked!!
LilahLilah
@ArpitJain - I've been stuck on this step for hours trying all of the solutions and yours was the one that worked perfectly! Thank you so much - such a relief! The solution that saved me was to go back and change the conditions in the Opportunity Closed Won Process so that there were no specifications as to Account Type being Prospect or Customer. 
Rohit KhaitanRohit Khaitan
Hi All,

Here what i did to complete the step 7 : Automate Setups.

CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900, 1, 7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180)
Above formula updates the "Date" field of the Robot Setup record, but in the challenge it is checking the "Day of the Week" which we are not updating anywhere.
So what i did is created a new process builder which update "Day of the Week" field.

Create new process builder for Object : Robot Setup
Crtieria : No criteria—just execute the actions!
Immediate Actions :
                                No Criteria
                                Field : Day of the Week, Type : Formula, Value : CASE(Mod([Robot_Setup__c].Date__c-DATE(1900,1,7),7),1,"Monday",2,"Tuesday",3,"Wednesday",4,"Thursday",5,"Friday","Monday")

Save and activate.

Hope this will resolve the issue.