Set System Settings after login

Hello Community,

 

Could You advise which module i may replace in order to implement function which will calculate and set system variable ?

 

Best Regard,

Marcin

Like 0

Like

1 comments

Hello Marcin,

 

You need to mark this system setting as not cached (uncheck this checkbox):

And create a trigger on the database level on the SysAdminUnit table so to check if the Supervisor is logged in then the value for the setting should be modified (something like this):

CREATE TRIGGER [dbo].[SysAdmUnit_SysSettingValueTrigger]
ON [dbo].[SysAdminUnit]
AFTER UPDATE
AS
BEGIN
DECLARE @admin_unit_id as UNIQUEIDENTIFIER;
DECLARE @loggedin as BIT;
SELECT @admin_unit_id = inserted.Id FROM inserted;
SELECT @loggedin = inserted.LoggedIn FROM inserted;
IF @admin_unit_id = '7F3B869F-34F3-4F20-AB4D-7480A5FDF647' AND @loggedin = 'true'
BEGIN
UPDATE SysSettingsValue SET IntegerValue = 111 WHERE SysSettingsId = 'F8520582-8161-4F36-A88D-028D3BDEFBDE'
END
END

where:

7F3B869F-34F3-4F20-AB4D-7480A5FDF647 - is an ID for the Supervisor user in the SysAdminUnit table

111 - value for the IntegerValue column in the SysSettingsValue table

 

Best regards,

Oscar

Show all comments