You should be aware that the rights to custom tabs may differ from the rights to other tabs. Below is a list of the rights relating to common and personal tabs and custom fields.
Personal custom tabs
Personal custom tabs are visible only to the user who creates them. Users are only able to add fields to a personal custom tab if these fields originate from tabs to which they have View rights as a minimum. Fields of tabs to which they do not have rights are not displayed on the Field chooser subtab. Users have Edit rights to all fields on their personal custom tabs. This means that they may have View rights to fields on the original tab, but Edit rights to the corresponding fields on their personal custom tab.
If rights change, fields may appear on a personal custom tab that originate from a tab to which the user no longer has rights. This means that the user will no longer have access to the original tab, but will still be able to use its fields on his or her own custom tab. Run the Check rights to custom tabs process to identify and solve these issues.
Common custom tabs
The program code associated with the tab determines which users are able to use a common custom tab. If a common custom tab does not have a program code associated with it, then all of the company's users may view and change the fields on the common custom tab. An associated program code allows you to control which users (or user groups) have View or Edit rights to the tab. A user may have View rights to a field on the original tab, but Edit rights to the same field on the common custom tab, or vice versa (the user has more rights to the original tab than to the custom tab).
Common custom tab allow you to add fields from tabs to which users do not have rights. The program code associated with the tab again determines the rights users have to the common custom tab.
Custom fields
When you link a custom field to a group, you can control which users are allowed to add the custom field to a custom tab. Without a group link, all of the company's users may do so. The tab rights determine whether the users may view or change the custom field (see explanation of personal custom tabs and common custom tabs).
It is possible to add custom fields to presets. You can use the code examples below in the stored procedure required for this. The code examples are based on:
- The Customers form. All elements printed in bold relate to the Customers form. To create a preset for a different form, you need to replace these elements by elements that relate to that form.
- The field types 'Options' and 'Boolean'. All other field types are similar to 'Boolean'. For the field types, enter the code of the custom field instead of <FieldDefCode>, for example:
T_Code_CustomField = N'BL026'
Note: Using custom fields in presets can slow down the opening of forms.
Code examples
DECLARE @Statement nvarchar(max)
, @Lbl1 dbo.T_Description_30
, @Lbl2 dbo.T_Description_30
/* Your own fields (FieldDefCodes) */
, @F1 T_Code_CustomField = N'<FieldDefCode>' /* Possibility */
, @F2 T_Code_CustomField = N'<FieldDefCode>' /* Boolean */
;
SELECT @LangCode = LangCode FROM T_UserRegistrationInfo WHERE UserCode = @IsahUserCode;
SELECT @BasicLangCode = BasicLangCode FROM T_Setting WHERE SettingCode = 1;
SELECT @IsahTableId = IsahTableId FROM T_IsahTable WHERE IsahTableName = N'T_Customer';
/* Determine the column headers. */
SELECT @Lbl1 = ISNULL(USERLANG.[Description], BASELANG.[Description])
FROM T_CustomFieldDefDescription AS BASELANG
LEFT OUTER JOIN T_CustomFieldDefDescription AS USERLANG
ON USERLANG.FieldDefCode = BASELANG.FieldDefCode
AND USERLANG.LangCode = @LangCode
WHERE BASELANG.FieldDefCode = @F1
AND BASELANG.LangCode = @BasicLangCode;
SELECT @Lbl2 = ISNULL(USERLANG.[Description], BASELANG.[Description])
FROM T_CustomFieldDefDescription AS BASELANG
LEFT OUTER JOIN T_CustomFieldDefDescription AS USERLANG
ON USERLANG.FieldDefCode = BASELANG.FieldDefCode
AND USERLANG.LangCode = @LangCode
WHERE BASELANG.FieldDefCode = @F2
AND BASELANG.LangCode = @BasicLangCode;
SELECT @F1 = N'''' + @F1 + N'''';
SELECT @F2 = N'''' + @F2 + N'''';
/* Dynamic SQL: First the required fields for a preset for the customer form, then two of your own fields. */
SET @Statement =
N'SELECT C.CustID
, C.Mnem
, C.LOBCode
, (SELECT CFP.Description
FROM T_CustomFieldPossibilityDesc CFP
WHERE CFP.LangCode = ' + '''' + @LangCode + '''' + '
AND CFP.PossibilityID = ISNULL(F1.PossibilityValue, LINK1.DefaultPossibility)) AS [' + @Lbl1 + N']' + '
, ISNULL(F2.BooleanValue, LINK2.DefaultBoolean) AS [' + @Lbl2 + N']' + '
FROM T_Customer AS C' + '
INNER JOIN T_CustomFieldEntityLink AS LINK1
ON LINK1.IsahTableId = ' + CONVERT(NVARCHAR, @IsahTableId) + '
AND LINK1.FieldDefCode = ' + @F1 + '
LEFT OUTER JOIN T_CustomFieldValue AS F1
ON F1.IsahTableId = LINK1.IsahTableId
AND F1.IsahPrimKey = C.CustID
AND F1.FieldDefCode = LINK1.FieldDefCode' + '
INNER JOIN T_CustomFieldEntityLink AS LINK2
ON LINK2.IsahTableId = ' + CONVERT(NVARCHAR, @IsahTableId) + '
AND LINK2.FieldDefCode = ' + @F2 + '
LEFT OUTER JOIN T_CustomFieldValue AS F2
ON F2.IsahTableId = LINK2.IsahTableId
AND F2.IsahPrimKey = C.CustID
AND F2.FieldDefCode = LINK2.FieldDefCode';
EXEC (@Statement);