I found this Deal Activities query in analytic. Apparently, it ran a long time ago, but now does not find a table called "Activities."
This would be a highly useful query table for me. Can it be revised to work with however CRM stores the underlying "activities" associated with a Deal?
- SELECT
- p."Id" "POTENTIALID",
- p."Deal_Name" "Potential Name",
- p."Owner.full_name" "Potential Owner",
- p."Owner" "Potential Owner Id",
- p."Created_Time" "Potential Created Time",
- p."Closing_Date" "Potential Closing Date",
- p."Type" "Potential Type",
- p."Stage" "Stage",
- p."Amount" "Amount",
- a."Activity Id" "ACTIVITYID",
- a."Activity" "Activity",
- a."Subject" "Subject",
- a."Activity Owner" "Activity Owner",
- a."Created Time" "Activity Created Time",
- a."Modified Time" "Activity Modified Time",
- a."Due Date" "Due Date",
-
- case
- when p."Stage" = 'Closed Won' then p."Deal_Name"
- else null
- end "Won Potential",
- datediff(a."Due Date", p."Created_Time") AS "Days to Respond"
- FROM "Deals" p
- INNER JOIN "Activities" a ON a."POTENTIALID" = p."Id"