Symptoms
I wrote a script for autonumbering in InvoicePageV2. It works only for the Zherlygin contact, in the rest of cases the request returns as null.
Profiler data:
Object {value: "b7f3b127-51be-494e-b184-58fe18c0e781", displayValue: "Кривошеева Екатерина", primaryImageValue: "00000000-0000-0000-0000-000000000000"} exec sp_executesql N' SELECT NULL [Id], NULL [UsrInvCounter], NULL [PhotoId], [Photo].[Name] [Photo.Name] FROM [dbo].[SysEmpty] [Contact] WITH(NOLOCK) LEFT OUTER JOIN [dbo].[SysImage] [Photo] WITH(NOLOCK) ON ([Photo].[Id] = [Contact].[Id]) WHERE NULL = @P1',N'@P1 uniqueidentifier',@P1='B7F3B127-51BE-494E-B184-58FE18C0E781' Object {value: "410006e1-ca4e-4502-a9ec-e54d922d2c00", displayValue: "Жерлыгин Дмитрий", primaryImageValue: "00000000-0000-0000-0000-000000000000"} exec sp_executesql N' SELECT [Contact].[Id] [Id], [Contact].[UsrInvCounter] [UsrInvCounter], [Contact].[PhotoId] [PhotoId], [Photo].[Name] [Photo.Name] FROM [dbo].[Contact] [Contact] WITH(NOLOCK) LEFT OUTER JOIN [dbo].[SysImage] [Photo] WITH(NOLOCK) ON ([Photo].[Id] = [Contact].[PhotoId]) WHERE [Contact].[Id] = @P1',N'@P1 uniqueidentifier',@P1='410006E1-CA4E-4502-A9EC-E54D922D2C00'
Cause
Access permissions for the [Contact] object have been distributed incorrectly.
Solution
Redistribute permissions.