'UF_CUSTNAM':

EXIT(GetUserFilter(ESUserFilter.FIELDNO(ESUserFilter."Customer Name")));

'UF_MORESPO':
EXIT(GetUserFilter(ESUserFilter.FIELDNO(ESUserFilter."Production Resp. Ctr. Filter")));

'UF_TSRESPO':
EXIT(GetUserFilter(ESUserFilter.FIELDNO(ESUserFilter."Transfer Resp. Ctr. Filter")));

'UF_MODFLOC':
EXIT(GetUserFilterDefault(ESUserFilter.FIELDNO(ESUserFilter."Default Prod. Location")));

'UF_SODFLOC':
EXIT(GetUserFilterDefault(ESUserFilter.FIELDNO(ESUserFilter."Default SO Location")));

'UF_ASMDLOC':
EXIT(GetUserFilterDefault(ESUserFilter.FIELDNO(ESUserFilter."Default Assembly Location")));

'UF_PODFLOC':
EXIT(GetUserFilterDefault(ESUserFilter.FIELDNO(ESUserFilter."Default Purch Location")));

'UF_TSTOLOC':
EXIT(GetUserFilterDefault(ESUserFilter.FIELDNO(ESUserFilter."Default TransTo Location")));

'UF_TSFRLOC':
EXIT(GetUserFilterDefault(ESUserFilter.FIELDNO(ESUserFilter."Default TransFr Location")));

ELSE
ESDynamicFilter.ShowCalculationError;
END;
END;

PROCEDURE InsertFilters@1240520002(CalculationCodeunitID@1240520003 : Integer);
VAR
ESDynamicFilter@1240520002 : Record 14123818;
ESUserFilter@1000000000 : Record 14123819;
BEGIN
// Add Code to insert new Dynamic Filters
// ESDynamicFilter.InsertDynamicFilter('MYTIME',CalculationCodeunitID,'Current Time');

ESDynamicFilter.InsertDynamicFilter(
'UF_CUSTNAM',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Customer Name"));


ESDynamicFilter.InsertDynamicFilter(
'UF_MORESPO',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Production Resp. Ctr. Filter"));
ESDynamicFilter.InsertDynamicFilter(
'UF_TSRESPO',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Transfer Resp. Ctr. Filter"));

//#003 >>
ESDynamicFilter.InsertDynamicFilter(
'UF_MODFLOC',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Default Prod. Location"));
ESDynamicFilter.InsertDynamicFilter(
'UF_SODFLOC',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Default SO Location"));
ESDynamicFilter.InsertDynamicFilter(
'UF_ASMDLOC',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Default Assembly Location"));
ESDynamicFilter.InsertDynamicFilter(
'UF_PODFLOC',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Default Purch Location"));
ESDynamicFilter.InsertDynamicFilter(
'UF_TSTOLOC',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Default TransTo Location"));
ESDynamicFilter.InsertDynamicFilter(
'UF_TSFRLOC',CalculationCodeunitID,ESUserFilter.FIELDCAPTION("Default TransFr Location"));
END;

PROCEDURE GetGroupFilter@1000000000(P_FieldNo@1000000001 : Integer) : Code[80];
VAR
GroupUserSetup@1000000003 : Record 14123817;
ESUserGroupFilter@1000000002 : Record 14123819;
L_RecordRef@1000000000 : RecordRef;
L_FieldRef@1000000004 : FieldRef;
L_Filter@1000000005 : Text[150];
BEGIN
L_Filter := '''''';

GroupUserSetup.RESET;
GroupUserSetup.SETRANGE(GroupUserSetup."Member User ID",USERID);
IF GroupUserSetup.FINDFIRST THEN BEGIN
IF ESUserGroupFilter.GetUser(GroupUserSetup."Group User ID") THEN BEGIN
L_RecordRef.GETTABLE(ESUserGroupFilter);
L_FieldRef := L_RecordRef.FIELD(P_FieldNo);
L_Filter := L_FieldRef.VALUE;
IF L_Filter <> '' THEN
EXIT(L_Filter)
ELSE
EXIT(''''''); 

END ELSE
EXIT(''''''); 

END ELSE
EXIT(''''''); 
END;

PROCEDURE GetUserFilter@1000000002(P_FieldNo@1000000001 : Integer) : Code[80];
VAR
GroupUserSetup@1000000003 : Record 14123817;
ESUserFilter@1000000002 : Record 14123819;
L_RecordRef@1000000000 : RecordRef;
L_FieldRef@1000000004 : FieldRef;
L_Filter@1000000005 : Text[150];
BEGIN
IF ESUserFilter.GetUser(USERID) THEN BEGIN
L_RecordRef.GETTABLE(ESUserFilter);
L_FieldRef := L_RecordRef.FIELD(P_FieldNo);
L_Filter := '';
L_Filter := L_FieldRef.VALUE;
IF L_Filter <> '' THEN
EXIT(L_Filter)
ELSE
EXIT(''''''); 

END ELSE BEGIN
EXIT(GetGroupFilter(P_FieldNo));
END;
END;

PROCEDURE GetGroupUserFilterDefault@1000000003(P_FieldNo@1000000001 : Integer) : Code[80];
VAR
GroupUserSetup@1000000003 : Record 14123817;
ESUserGroupFilter@1000000002 : Record 14123819;
L_RecordRef@1000000000 : RecordRef;
L_FieldRef@1000000004 : FieldRef;
L_Filter@1000000005 : Text[150];
BEGIN
//Default
L_Filter := '';

GroupUserSetup.RESET;
GroupUserSetup.SETRANGE(GroupUserSetup."Member User ID",USERID);
IF GroupUserSetup.FINDFIRST THEN BEGIN
IF ESUserGroupFilter.GetUser(GroupUserSetup."Group User ID") THEN BEGIN
L_RecordRef.GETTABLE(ESUserGroupFilter);
L_FieldRef := L_RecordRef.FIELD(P_FieldNo);
L_Filter := L_FieldRef.VALUE;
IF L_Filter <> '' THEN
EXIT(L_Filter)
ELSE
EXIT(''); 

END ELSE
EXIT(''); 

END ELSE
EXIT(''); 
END;

PROCEDURE GetUserFilterDefault@1000000001(P_FieldNo@1000000001 : Integer) : Code[80];
VAR
GroupUserSetup@1000000003 : Record 14123817;
ESUserFilter@1000000002 : Record 14123819;
L_RecordRef@1000000000 : RecordRef;
L_FieldRef@1000000004 : FieldRef;
L_Filter@1000000005 : Text[150];
BEGIN
IF ESUserFilter.GetUser(USERID) THEN BEGIN
L_RecordRef.GETTABLE(ESUserFilter);
L_FieldRef := L_RecordRef.FIELD(P_FieldNo);
L_Filter := '';
L_Filter := L_FieldRef.VALUE;
IF L_Filter <> '' THEN
EXIT(L_Filter)
ELSE
EXIT(''); 

END ELSE BEGIN
EXIT(GetGroupUserFilterDefault(P_FieldNo));//Default
END;
END;