Siebel CRM Desktop for IBM Notes Administration Guide > Customizing Siebel CRM Desktop > Customizing Field Behavior >

Adding Default Values to Fields


This topic describes how to configure Siebel CRM Desktop to add a default value to a field when the user creates a new record. The example in this topic configures CRM Desktop to add the following default value to the Opportunity Name field:

CRM Opportunity

To add a default value to a field

  1. Open IBM Domino Designer, and then open the SBL.BusinessLogic script library.

    For more information, see Opening IBM Domino Designer.

  2. Locate and then open the CreateMetaScheme function.
  3. Locate the following code:

    Set TypeDescr = MetaScheme.GetType("Opportunity")

    where:

    • MetaScheme.GetType. Identifies the name of the object type identifier of the object type that resides in the Ln_siebel_basic_mapping.xml file. This file includes definitions for object types. Each definition includes a Lotus Id attribute. This attribute is the object type identifier that you must use for the object_type. For more information, see Customizing Field Mapping.
  4. In the With block of code that IBM Domino Designer displays immediately before the End With line, add the following code:

    .Field("Name").InitialValue = "CRM Opportunity"

    where:

    • .Field("Name"). Identifies the name of a field that resides in the object type definition in the Ln_siebel_basic_mapping.xml file.
    • CRM Opportunity. Defines the default value that CRM Desktop adds.

Setting Default Values

This topic describes the values that you can use to specify the source of the default value. You specify this value in the InitialValue setter property of the CreateMetaScheme function.

Setting Fixed Default Values

To set a fixed value, you set the InitialValue setter property of the CreateMetaScheme function to the following value:

initial_value

You typically use this format with a number that does not require a translation, such as a Boolean number or an empty string where the default value is empty. You use the following format:

.Field("field_name").InitialValue = "value"

Example 1

To set the Appt PIM Flag field that resides in the Action object, you use the following code:

.Field("PIMOriginated").InitialValue = "1"

This example sets the default value to true. It does not use a list of values. The Appt PIM Flag field is a text field.

Example 2

To set the country code for the phone number to a default value when the user creates a new account, you can use the following code:

.Field("MainPhone").InitialValue = "+31"

Setting Default Values That Are Language Dependent

To get a language dependent value from the resource file, you set the InitialValue variable of the CreateMetaScheme function to the following value:

initial_value_res

This value uses the value that Siebel CRM Desktop defines in the Ln_package_res.xml file and in each language-specific Ln_package_res_XX_yy.xml file. It allows you to use a different default value for each language. If the MLOVs (multi-value lists of values) are correctly configured on the Siebel Server, then CRM Desktop stores the correct Language-Independent Code on the server. You use the following format:

.Field("field_name").InitialValue = "initial_value_res"

Example

The following example specifies to set the default value of the Display field that resides in the Activity object to the value that the lang_action_display_activities_only resource key contains:

.Field("Display").InitialValue = "[!loc:lang_action_display_activities_only:loc!]"

The following values in the resource file determine the default value:

  • The English resource file includes the following code:

    <str key="lang_action_display_activities_only" >Activities Only</str>

    At run time CRM Desktop sets the default value in the English client to Activities Only.

  • The French resource file includes the following code:

    str key="lang_action_display_activities_only">Activités uniquement</str>

    At run time CRM Desktop sets the default value in the Dutch client to Alleen activiteiten.

Setting Default Values for Functions

To set the default value for a function, you set the InitialValueCallback setter property of theCreateMetaScheme function to the following value:

initial_value_fn

This value uses a function that returns a value. It allows you to do more complex lookups. You use the following format:

Set.Field("field_name").InitialValueCallback = initial_value_fn

Example

The following example comes predefined with Siebel CRM Desktop. It calls the following DefaultCurrencyIdCb function to determine the currency code that CRM Desktop sets for the account:

Ret.GetType("Account").Field("CurrencyCodeId").InitialValueCallback = DefaultCurrencyIdCb

The following predefined code defines the CallbackDefaultCurrencyId class:

Public Class CallbackDefaultCurrencyId As CallbackObject
  Public Function Invoke (params As DynamicArguments)
    Invoke = GetSession().Defaults.Property("CRMDSibelCurrencySymbol")
  End Function
End Class

where:

  • CRM Desktop defines CallbackDefaultCurrencyId class as the following:

    Dim DefaultCurrencyIdCb As New CallbackDefaultCurrencyId

Setting Default Values For Links

To set the default links that Siebel CRM Desktop uses for an object type, you set the InitialLinksCallback property of the descriptor that this object type uses to an instance of the class that CRM Desktop gets from the CallbackObject class. CRM Desktop uses this property to create the initial links. The following example uses a multi-value group that returns multiple records:

Set.InitialLinksCallback = New CallbackInitialLinksAccount

In this example, the following code describes the CallbackInitialLinksAccount class:

Public Class CallbackInitialLinksAccount As CallbackInitialLinks
  Public Function Invoke (params As DynamicArguments)
    Dim PositionId As String
    Dim OrganizationId As String
    
    'Prefill team
    PositionId = GetSession().GetCurrentUser().Property("CRMDPositionId")
    Me.Container(params).Push CreateLinkContainer(PositionId, "Position", LINK_TAG_DIRECT)
    Me.Container(params).Push CreateLinkContainer(PositionId, "Position", LINK_TAG_MVG)
    
  End Function
End Class

This example uses a multi-value group that associates multiple records. To add multiple team members instead of setting a single value, you can use a function that you specify elsewhere and use the following source:

InitialLinksCallback

Siebel CRM Desktop for IBM Notes Administration Guide Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.