---> #_helpSubject# ---> ---> #request.allowClose# select i.interactionId, i.interactionType, i.interactionMethod, i.interactionDate, i.approvalStatus, i.comment, i.notes, i.reminderDays, i.profileUpdatedOn, i.profileUpdatedBy, i.opportunityId, i.partnerId, i.partnerType, i.disposition, i.noSaleReasonId, i.noSaleComment, i.dispositionDate, i.saleSubjectId, i.saleQty, i.saleDurationUnit, i.saleDurationAmt, i.sourceId, i.sourceType, i.closeComment, i.interactionCode, sim.marketingActivityId, sim.participantId, sim.enrollmentEndDate, sim.enrollmentStartDate, sim.startDate, sim.endDate, sim.marketingActivityName, sim.enrollmentState, sim.lifecyclestate, sim.marketingActivityType, sim.approvalStatus feedbackApprovalStatus, sim.approvalDate feedbackApprovalDate, sim.locked enrollmentLocked, sim.surveyId, sim.auditSurveyId, sim.auditApprovalDate, sim.auditApprovalStatus, spl.opportunityName, i.dispositionUserId, i.dispositionDate, i.participantId, i.opportunityStageChangeId , i.contactId, contact.firstname contactFirstname, contact.lastName contactLastName, contact.email contactEmail, profileUpdator.firstName profileUpdatorFirstName, profileUpdator.lastName profileUpdatorLastName, dspMbr.firstname dispositionFirstName, dspMbr.LastName dispositionLastName from tbl_CRM_Interactions i left outer join ( select p.participantId, ma.marketingActivityType, ma.marketingActivityId, ma.marketingActivityName, ma.startDate, ma.endDate, rtrim(ma.enrollmentRuleCode) enrollmentRuleCode, ma.enrollmentStartDate, ma.enrollmentEndDate, psc.approvalStatus, psc.approvalDate, p.locked, psc.surveyId, psca.approvalStatus auditApprovalStatus, psca.approvalDate auditApprovalDate, psca.surveyId auditSurveyId , case when ma.enrollmentRuleCode = 'CLOSED' then 'LOCKED' else case when ma.enrollmentEndDate < {fn now()} then 'LOCKED' else 'UNLOCKED' end end enrollmentState , case when ma.ready <> 'Y' then 'NOT READY' when ma.unpublishDate < {fn now()} then 'UNPUBLISHED' when ma.endDate < {fn now()} then 'FINISHED' when ma.startDate < {fn now()} and ma.enrollmentRuleCode = 'CLOSED' then 'RUNNING' when ma.enrollmentStartDate <= {fn now()} and ma.enrollmentEndDate >= {fn now()} then 'ENROLLMENT' when ma.startDate <= {fn now()} and ma.endDate >= {fn now()} then 'RUNNING' when ma.publishDate < {fn now()} then 'PUBLISHED' else 'PLANNING' end lifecycleState from tbl_CRM_Participants p inner join tbl_CRM_MarketingActivities ma on ma.marketingActivityId = p.marketingActivityId and ma.ownerId = p.ownerId and ma.ownerType = p.ownerType left outer join tbl_CRM_ParticipantSurveyCodes psc on psc.participantId = p.participantId and psc.ownerId = p.ownerId and psc.ownerType = p.ownerType and psc.surveyRole = 'SALESCALL' left outer join tbl_CRM_ParticipantSurveyCodes psca on psca.participantId = p.participantId and psca.ownerId = p.ownerId and psca.ownerType = p.ownerType and psca.surveyRole = 'SALESAUDIT' where p.ownerId = 1 and p.ownerType = 'MFR' ) sim on sim.participantId = i.participantId left outer join tbl_SPL_Opportunities spl on spl.partnerId = i.partnerId and spl.partnerType = i.partnerType and spl.opportunityId = i.opportunityId left outer join tbl_FSPro_members contact on contact.fspro_userid = i.contactId left outer join tbl_FSPro_members profileUpdator on profileUpdator.fspro_userId = i.profileUpdatedBy left outer join tbl_FSPro_members dspMbr on dspMbr.fspro_userId = i.dispositionUserId where i.ownerId = 1 and i.ownerType = 'MFR' AND i.interactionId = 785307 order by i.interactionDate desc #request.allowClose# ---> Subject: Support Comments: ---> HELLO!!! --->
: select ptr.resourceId territoryId from tbl_BRO_PrincipalTerritoryResources ptr inner join tbl_BRO_PrincipalTerritories pt on pt.principalTerritoryId = ptr.principalTerritoryId and pt.ownerId = ptr.ownerId inner join tbl_BRO_Principals p on p.principalId = pt.principalId and p.ownerId = pt.ownerId where p.ownerId = and p.ownerType= and ptr.resourceType = 'TER' and p.mfrId = select ter.territoryId from tbl_TER_Territories ter inner join tbl_CDR_Distributors cdr on cdr.cdr_territoryId = ter.territoryId and cdr.ownerId = ter.ownerId where cdr.cdr_recordId = and cdr.ownerId = and cdr.fsl_tablecode =