select i.processId, i.processInstanceId, i.status, i.statusComment, i.statusDetail, i.partnerId, i.partnerType, i.referenceNbr, i.userId, i.startTime,
opr.companyName customerName, opr.address address, opr.address2 address2, opr.city city, opr.state state, opr.zipcode zipCode, case when opr.mdmType = 'CBS' then opr.mdmId else '' end CBSCID
from tbl_WRK_ProcessInstances i
inner join tbl_OPR_ClientOperators opr
on opr.operatorId = i.partnerId
and opr.ownerId = i.ownerId
and opr.fsltablecode = i.ownerType
where i.ownerId =
and i.ownerType =
and i.processId =
and i.archive = 'N'
and i.partnerType = 'OPR'
and i.status in ( 'NEW', 'ACTIVE')
and i.userId =
order by startTime
select
r.processInstanceId, r.routingId, r.statusDate, i.updateDate,i.partnerId, opr.companyName, r.status, i.status, i.statusDetail
from tbl_WRK_processInstanceRouting r
inner join tbl_WRK_ProcessInstances i
on i.processInstanceId = r.processInstanceId
inner join tbL_WRK_ProcessDefinitions d
on d.processId = i.processId
inner join tbl_Fspro_members m
on m.fspro_userid = r.userId
inner join tbl_OPR_ClientOperators opr with (nolock)
on opr.operatorId = i.partnerId
and opr.ownerId = i.ownerId
and opr.fslTableCode = i.ownerType
where
i.updateDate between and
and opr.mfr_bsr_id =
and r.ownerType =
and r.ownerId =
and r.status = 'APPROVED'
And i.status = 'COMPLETE'
and r.archive = 'N'
and (
opr.countryId = 5 and r.routingNote = 'Customer Master'
or
opr.countryId <> 5 and r.routingNote in ('Field Support','Equipment Integrity')
)
order by opr.companyName
select distinct partnerId
from qmd_getAcceptedERFs
where statusDetail like '%"PLACEMENTREASON":"New Customer"%'