Contact Preference API Use

This chapter covers the following topics:

Contact Preference APIs

PL/SQL Package Name: HZ_CONTACT_PREFERENCE_V2PUB

Java Class Name: HzContactPreferenceV2Pub

PL/SQL Record Structure for Contact Preference

TYPE contact_preference_rec_type        IS RECORD (
contact_preference_id                   NUMBER, 
contact_level_table                     VARCHAR2(30), 
contact_level_table_id                  NUMBER,
contact_type                            VARCHAR2(30),
preference_code                         VARCHAR2(30),
preference_topic_type                   VARCHAR2(30),
preference_topic_type_id                NUMBER, 
preference_topic_type_code              VARCHAR2(30),
preference_start_date                   DATE,
preference_end_date                     DATE,
preference_start_time_hr                NUMBER,
preference_end_time_hr                  NUMBER,
preference_start_time_mi                NUMBER, 
preference_end_time_mi                  NUMBER, 
max_no_of_interactions                  NUMBER,
max_no_of_interact_uom_code             VARCHAR2(30),
requested_by                            VARCHAR2(30),
reason_code                             VARCHAR2(30),
status                                  VARCHAR2(1),
created_by_module                       VARCHAR2(150),
application_id                          NUMBER
)

Java Inner Class for Contact Preference

public static class ContactPreferenceRec {
    public BigDecimal                contact_preference_id;
    public String                    contact_level_table;
    public BigDecimal                contact_level_table_id;
    public String                    contact_type;
    public String                    preference_code;
    public String                    preference_topic_type;
    public BigDecimal                preference_topic_type_id;
    public String                    preference_topic_type_code;
    public java.sql.Timestamp        preference_start_date;
    public java.sql.Timestamp        preference_end_date;
    public BigDecimal                preference_start_time_hr;
    public BigDecimal                preference_end_time_hr;
    public BigDecimal                preference_start_time_mi;
    public BigDecimal                preference_end_time_mi;
    public BigDecimal                max_no_of_interactions;
    public String                    max_no_of_interact_uom_code;
    public String                    requested_by;
    public String                    reason_code;
    public String                    status;
    public String                    created_by_module;
    public BigDecimal                application_id;    

    public ContactPreferenceRec();
    public ContactPreferenceRec(boolean __RosettaUseGMISSValues);
}

Create Contact Preference API

Description

This routine creates a Contact Preference. The API creates a record in the HZ_CONTACT_PREFERENCES table. Contact preference can be created for the Party, Party Site or Contact Point.

PL/SQL Procedure

PROCEDURE create_contact_preference (
    p_init_msg_list                 IN         VARCHAR2:= FND_API.G_FALSE,
    p_contact_preference_rec        IN         CONTACT_PREFERENCE_REC_TYPE, 
    x_contact_preference_id         OUT        NUMBER,
    x_return_status                 OUT        VARCHAR2,
    x_msg_count                     OUT        NUMBER,
    x_msg_data                      OUT        VARCHAR2
)

Java Method

public static void createContactPreference(
    OracleConnection_connection,
    String                          p_init_msg_list,
    ContactPreferenceRec            p_contact_preference_rec,
    BigDecimal [ ]                  x_contact_preference_id,
    String [ ]                      x_return_status,
    BigDecimal [ ]                  x_msg_count,
    String [ ]                      x_msg_data
) throws SQLException;

Parameter Description and Validation

The following table lists information about the parameters in the Create Contact Preference API. The table includes the parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
contact_preference_id IN NUMBER No Validation: Unique if passed in, else generated from sequence
contact_level_table IN VARCHAR2 Yes Validation:
  • Mandatory attribute

  • Non updateable

  • Validated against AR lookup type SUBJECT_TABLE

contact_level_table_id IN NUMBER Yes Validation:
  • Mandatory attribute

  • Not updateable

  • Is the foreign key of contact_level_table

contact_type IN VARCHAR2 Yes Validation:
  • Mandatory Attribute.

  • Non-updateable

  • contact_type is lookup code in lookup type CONTACT_TYPE

preference_code IN VARCHAR2 Yes Validation:
  • Mandatory attribute

  • Should be validated against the PREFERENCE_CODE lookup type

preference_topic_type IN VARCHAR2 N Validation:
  • Should be validated against the PREFERENCE_TOPIC_TYPE lookup type.

  • The lookup contains the following lookup_codes against which the PREFERENCE_TOPIC_TYPE will be validated:


TABLES:
  • AMS_SOURCE_CODES,

  • AS_INTEREST_TYPES_B,

  • AS_INTEREST_CODES_B

  • LOOKUP_TYPE: CONTACT_USAGE

preference_topic_type_id IN NUMBER N Validation :
Valid if the value in the PREFERENCE_TOPIC_TYPE attribute is one of these values:
  • AMS_SOURCE_CODES

  • AS_INTEREST_TYPES_B

  • AS_INTEREST_CODES_B


The PREFERENCE_TOPIC_TYPE attribute is the foreign key of table selected PREFERENCE_TOPIC_TYPE.
preference_topic_type_code IN VARCHAR2 N Validation:
If PREFERENCE_TOPIC_TYPE = CONTACT_USAGE, then PREFERENCE_TOPIC_TYPE_CODE should be a lookup code of lookup type CONTACT_USAGE. Validation exists to ensure that this lookup code exists.
If PREFERENCE_TOPIC_TYPE is FND_BUSINESS_PURPOSES_B, then PREFERENCE_TOPIC_TYPE_CODE is the name of a column in FND_BUSINESS_PURPOSES_B. No validation exists to ensure that the value passed is a proper column name.
preference_start_date IN DATE Y Validation:
Mandatory attribute.
preference_end_date IN DATE N Validation:
  • Cannot be updated to a day before the sysdate

  • PREFERENCE_END_DATE should be greater than or equal to PREFERENCE_START_DATE

  • If the STATUS column in the HZ_CONTACT_POINTS table is set to a value other than A for Active (such as I for Inactive, M for Merged, of D for deleted), then PREFERENCE_END_DATE is not passed in these situations, it should default to the system date. If a value other than the system date is passed, it should fail.

preference_start_time_hr IN NUMBER N Validation:
In 0 to 24 hour format.
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
preference_end_time_hr IN NUMBER N Validation:
In 0 to 24 hour format.
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
preference_start_time_mi IN NUMBER N Validation:
In 0 to 59 minute format
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
preference_end_time_mi IN NUMBER N Validation:
In 0 to 59 minute format
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
max_no_of_interactions IN NUMBER N Validation: none
max_no_of_interact_uom_code IN VARCHAR2 N Validation: The MAX_NO_OF_INTERACT_UOM_CODE column should be validated against the new MAX_NO_OF_INTERACT_UOM_CODE lookup.
requested_by IN VARCHAR2 Y Validation:
  • Mandatory attribute

  • Should be validated against the REQUESTED_BY lookup type

reason_code IN VARCHAR2 N Validation : Validated against the REASON_CODE lookup type.
status IN VARCHAR2 N Validation :
Should be validated against the CODE_STATUS lookup type.
The PREFERENCE_END_DATE attribute should be set to the sysdate when STATUS has a value other than A.
created_by_module IN VARCHAR2 Y Validation: Mandatory attribute. Validated against AR lookup type HZ_CREATED_BY_MODULE.
application_id IN NUMBER N Comment: Text to indicate application from which creation of record is initiated.
x_contact_preference_id OUT NUMBER N Comment: Returns contact_preference_id of the record created.

Other Validations

Update Contact Preference API

Description

This routine updates a Contact Preference. The API updates a record in the HZ_CONTACT_PREFERENCES table for Party, Party Site or Contact Point.

PL/SQL Procedure

PROCEDURE update_contact_preference (
    p_init_msg_list                      IN          VARCHAR2:= FND_API.G_FALSE,
    p_contact_preference_rec             IN         CONTACT_PREFERENCE_REC_TYPE,
    p_object_version_number              IN OUT      NUMBER,
    x_return_status                      OUT         VARCHAR2,
    x_msg_count                          OUT         NUMBER,
    x_msg_data                           OUT         VARCHAR2
)

Java Method

public static void updateContactPreference(
    OracleConnection_connection,
    String                               p_init_msg_list,
    ContactPreferenceRec                 p_contact_preference_rec,
    BigDecimal [ ]                       p_object_version_number,
    String [ ]                           x_return_status,
    BigDecimal [ ]                       x_msg_count,
    String [ ]                           x_msg_data
) throws SQLException;

Parameter Description and Validation

The following table lists information about the parameters in the Update Contact Preference API. The table includes the parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
contact_preference_id IN NUMBER Yes Validation: Valid contact_preference_id should be passed in
Comment: Pass contact_preference_id from hz_contact_preferences table
contact_level_table IN VARCHAR2 No Validation: Non updateable
contact_level_table_id IN NUMBER No Validation: Non updateable
contact_type IN VARCHAR2 No Validation: Non updateable
preference_code IN VARCHAR2 No Validation: Should be validated against the PREFERENCE_CODE AR lookup type
preference_topic_type IN VARCHAR2 No Validation:
Should be validated against the PREFERENCE_TOPIC_TYPE lookup type.
The lookup contains the following lookup_codes against which the PREFERENCE_TOPIC_TYPE will be validated
TABLES
  • AMS_SOURCE_CODES

  • AS_INTEREST_TYPES_B

  • AS_INTEREST_CODES_B

  • LOOKUP_TYPE

preference_topic_type_id IN NUMBER No Validation:
If the value in the PREFERENCE_TOPIC_TYPE attribute is one of these values:
  • AMS_SOURCE_CODES

  • AS_INTEREST_TYPES_B

  • AS_INTEREST_CODES_B


The PREFERENCE_TOPIC_TYPE attribute is the foreign key of table selected in the attribute PREFERENCE_TOPIC_TYPE.
preference_topic_type_code IN VARCHAR2 No Validation:
If PREFERENCE_TOPIC_TYPE = CONTACT_USAGE, then PREFERENCE_TOPIC_TYPE_CODE should be a lookup code of lookup type CONTACT_USAGE. Validation exists to ensure that this lookup code exists.
If PREFERENCE_TOPIC_TYPE is FND_BUSINESS_PURPOSES_B, then PREFERENCE_TOPIC_TYPE_CODE is the name of a column in FND_BUSINESS_PURPOSES_B. No validation exists to ensure that the value passed is a proper column name.
preference_start_date IN DATE No Validation:
The value of the PREFERENCE_END_DATE attribute should be greater than or equal to the value of the PREFERENCE_START_DATE attribute.
preference_end_date IN DATE No Validation:
  • PREFERENCE_END_DATE can not update to a day before sysdate

  • PREFERENCE_END_DATE should be greater than or equal to PREFERENCE_START_DATE,

preference_start_time_hr IN NUMBER No Validation:
In 0 to 24 hour format
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
preference_end_time_hr IN NUMBER No Validation:
In 0 to 24 hour format
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
preference_start_time_mi IN NUMBER No Validation:
In 0 to 59 minute format
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
preference_end_time_mi IN NUMBER No Validation:
In 0 to 59 minute format
PREFERENCE_END_TIME_HR: PREFERENCE_END_TIME_MI should be greater than or equal to PREFERENCE_START_TIME_MI: PREFERENCE_START_TIME_MI
max_no_of_interactions IN NUMBER No Validation: none
max_no_of_interact_uom_code IN VARCHAR2 No Validation: The MAX_NO_OF_INTERACT_UOM_CODE column should be validated against the new MAX_NO_OF_INTERACT_UOM_CODE lookup.
requested_by IN VARCHAR2 No Validation: REQUESTED_BY should be validated against the REQUESTED_BY AR lookup type
reason_code IN VARCHAR2 No Validation:
Should be validated against the REASON_CODE lookup type
status IN VARCHAR2 No Validation:
  • Should be validated against the CODE_STATUS lookup type

  • The PREFERENCE_END_DATE attribute should be set to sysdate when the STATUS column has a value other than A

  • Can not be set to NULL during update

created_by_module IN VARCHAR2 No Validation: Non updateable if value exists, else validated against AR lookup type HZ_CREATED_BY_MODULE.
application_id IN NUMBER No Validation: Not updateable if value exists
p_object_version_number IN
OUT
NUMBER Yes Validation:
  • Mandatory attribute

  • Validated against value in the database for the existing record


Comment:
  • Pass the current object_version_number of the contact preference record

  • Return new value after update

Other Validations