Stored Procedures [dbo].[MssWebGetOrganizationLaborEmailAddresses]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE procedure [dbo].[MssWebGetOrganizationLaborEmailAddresses]
as
begin
    set nocount on

    select
        [Name] = dbo.FormatFirstNameLastName(Sysuser.FIRSTNAME, Sysuser.LASTNAME),
        EmailAddress = Sysuser.EMAIL,
        LaborType = LaborType.LaborType
    from Sysuser
        inner join SysUserLaborTypeMap on
            SysUserLaborTypeMap.SysUserFID = Sysuser.SysUserID and
            SysUserLaborTypeMap.[Default] = 1
        inner join LaborType on LaborType.PriKey = SysUserLaborTypeMap.LaborTypeFID
        inner join [Status] on
            SysUser.[STATUS] = [Status].[PriKey] and
            [Status].[Status] <> 'INACTIVE'
    where Sysuser.EMAIL is not null; -- null check is sufficient as back-end will validate the remainder.
end;
GO
GRANT EXECUTE ON  [dbo].[MssWebGetOrganizationLaborEmailAddresses] TO [MssExec]
GO
Uses