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
Sudeep SinghSudeep Singh 

Next Order Date should be Order Start date + 30

I have a field Next order date in contract
Written a batch class to creaet automatically order if the contract is Activated. When the Contract status is made activated at that time the Next order Date will display the immediate wednesday which is handled by flow.

I need to do an setup that when Order status will be Order Dispatched then the Next Order Date should display Order Start Date + 30 days or Order Start Date + 30 days  (immediate wednesday).

Is it possible by flow If yes then how, if no then how we can achieve this.

Best Answer chosen by Sudeep Singh
Shri RajShri Raj
Yes, it is possible to achieve this using a Flow. You can create a Flow that is triggered when the Order status is set to "Order Dispatched" and use the Flow to update the Next Order Date field on the Contract.
Here is an example of how you can accomplish this using a Flow:
Create a new Flow and choose "Record-Triggered Flow" as the type.
Use a "Record Update" element to update the Next Order Date field on the Contract.
Use a "Formula" element to calculate the Next Order Date by adding 30 days to the Order Start Date.
To get the next Wednesday you can use a formula as MOD(WEEKDAY(Order_Start_Date__c)+5,7) = 0
Use an "Update Records" element to update the Next Order Date field on the Contract with the calculated value.
Use the "Record Lookup" element to look up the contract based on the order start date.
Use the "Decision" element to check if the calculated Next Order Date is a Wednesday or not, if not use another formula element to get the next wednesday.
Finally, activate the Flow and test it by creating a new Order with the status set to "Order Dispatched."