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
Michael Rogers 10Michael Rogers 10 

Logic and architecture question

Within the application ive built, i capture a start date and an end date on an opportunity.  I can now show a visual of when things are due to start and due to end, but the question i'm now being asked is can we tell how many concurrently are running.

So as an example i have Opportunity 1, with a start date of 20/1/01 and an end date of 20/6/01, but i want to find out what's running on 20/03/01.  Any ideas on the best way to model the data or build the logic in order to achieve this.  The outcome would be a dashboard report which shows by month how many we have running ie it's past the start date but not past the end date.

Thanks in advance!
Abdul KhatriAbdul Khatri
Do you have any specific List of actions that can be running between Opportunity Start and End Date?
How this processes are being captured today I mean manually or automation?
Are you showing those running things currently anywhere on UI?

Sorry need clarification before proposing any right solution.

Here is tentative solution based on my current understanding and assumption.

Create a new Object with the following fields
1. Opportunity__c -> MasterDetail to Opportunity
2. Date__c -> Date of the currently running process (validation rule the date must be within the due date of opportunity Start & End Date)
3. RunningProcess__c -> Text or PickList (if predefinded List)

This is just a blind Solution with very brief understanding
Michael Rogers 10Michael Rogers 10

Thanks for the reply.  There's no actions, process or anything else that runs from this or depends on it.

Based on my example above i'm almost looking for an out put like this;

Future Date | No. of opportunities live at that point 

20/3/01 - 32 opportunities
20/4/01 - 18 opportunities
20/5/01 - 12 opportunities
20/6/01 - 15 opportunities

So i could build a new object, but it would need to dynamically add new rows for future dates, as i wouldnt want it the backend to have to insert new dates in manually. 
Suraj PSuraj P
Based on your requirement, sounds like you have 2 options
a) Create a Task for each day that an Opportunity is active for (since Tasks only take 1kb or storage space) and create a summary report
b) Use a Visualforce page/ Lightning Component report

The volume of Opportunities and the expected growth would dictate which of the two solutions would work better for you
Abdul KhatriAbdul Khatri
What is the criteria of deciding the future date range to look for the running opportunites?

Based on your last information, no need to create any new object or anything. Just 
  • Create Lightning Component (since Salesforce is aggressively moving towards lightning so not recommending Visualforce page) but you can also create visualforce Page.
  • Have a Date Range for the user to select like Start Date or From Date - End Date or To Date and Submit Button.
  • Build a logic like this
    • Grab all the opportunites between date range given
    • Segregate the opportunities count datewise ignoring the time
    • show them on the component.