16 Aug How do I summarize, in days, when each Opportunity was last modified?
More specifically, this information is usually intended to be outputted as an additional column, in the Opportunity pipeline screen.
To do this, you’ll need to:
- Modify the database view used by the Opportunity pipeline.
- Create a translation.
- Add the new column to the pipeline screen.
Step 1: Modify vListOpportunities
The Pipeline screen uses the vListOpportunities view, to provide the columns for it to display. In Sage CRM, go to the Administration section, select the Opportunties entity and under the Views tab, update the view definition to include our new field:
CAST((DATEDIFF(hh, wi.WkIn_UpdatedDate, GETDATE()) / CAST(24 AS DECIMAL(18,1))) AS DECIMAL(18,1)) AS 'oppo_daysinstage',
and an inner join to the Workflow Instance table (we’re using the Updated Date on the workflow instance as an indicator of when the Opportunity was last modified; you could just use the Opportunity’s Updated Date, but then that wouldn’t include workflow progression).
INNER JOIN WorkflowInstance AS wi ON wi.Wkin_CurrentEntityId = 10 AND wi.WkIn_CurrentRecordId = oppo_opportunityid
Your view definition should end up looking like the following:
Step 2: Add a translation for the new field
To display a user-friendly name for the oppo_daysinstage field, go to Administration -> Customisation -> Translations and create a new translation using the following details:
Step 3: Add “Days in Stage” to the Pipeline screen
For the last step, go to Administration -> Customisation -> Opportunities -> Lists and select the Opportunities List item. Select the “Days in Stage” field in the Field drop-down, click Add and then save your changes.
When you go back to the Dashboard, your Opportunities Pipeline should now display this brand new field!