Stored Procedures [dbo].[MssWebGetConversationListByUser]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inSysUserIdint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE procedure [dbo].[MssWebGetConversationListByUser]
    @inSysUserId int
as
begin
    set nocount on
    select
        OrderId = Orders.PriKey,
        OrderNumber = coalesce(
        Orders.OrderNo,
        Orders.ArchivedOrderNo + ' [A]' ) ,
        CustomerName = dbo.FormatFirstNameLastName(Orders.LastName, Orders.FirstName ),
        ContactPriKey = SakariContact.SakariContactID,
        UpdateCount = Data.UpdateCount ,
        ScheduledMessageCount = Data.ScheduledMessageCount,
        LastUpdatedAt = SakariContact.LastUpdatedAt
    from UdfGetUnreadAndScheduledMessageCount(@inSysUserId) Data
    inner join SakariContact on Data.ContactID = SakariContact.SakariContactID
    inner join SakariContactOrderMap on Data.ContactID = SakariContactOrderMap.SakariContactFID
    inner join Orders on SakariContactOrderMap.OrderFID = Orders.PriKey
    order by LastUpdatedAt desc
end
GO
GRANT EXECUTE ON  [dbo].[MssWebGetConversationListByUser] TO [MssExec]
GO
Uses