Friday, September 9, 2011

Restricting Duplication of record by Validation using Configuration:

Description:

Validating a record existance by  checking the combination of some defined fields, pops an error message if the record already exists with that field values.

Requirement:

An attempt to create a new ‘Contact’  should fail  if the provided values for ‘First Name’ and ‘Last Name’ for Contact  are same as that of any existing record. An error message should pop  up while trying to save such a record.

Configuration Steps:

1.       Create a New calculated field in Contact BC, where the calculated value contains the functionality with below search criteria.
Name: Test_Duplicate
Calculated: True
Calculated Value: 
BCHasRows("Contact", "Contact","[First Name] = '"+[First Name]+ "'" +  "AND" + "[Last Name] = '"+[Last Name]+"'" , "All")

BCHasRows function  is specified with 4 parameters like
BCHasRows( “BO”,” BC”, “Searchspec”, “Visibility” ).


The calculated value for Test_Duplicate is returned as ‘Y’ if the search specification is satisfied, else it returns ‘N’.

2.       Add the validation criteria and validation message to one of the  search criteria fields(Either First Name or Last Name) or the required fields of the BC, so that validation is checked before the record gets saved.
a.         Query for Last Name field in Contact BC.
b.        Update the record with the following values:
Validation : [Test_Duplicate] <> "Y"
Validation Message: Record Exists

If the Validation is satisfied, i.e. if the value for the Test_Duplicate field  is ‘N’ , the new record gets saved because the combination of the values entered for First Name and Last Name doesn’t match with any of existing records.

If the Validation is not satisfied, i.e. if the value for the Test_Duplicate field is ‘Y’ , error message “Record exists”  is popped up and the record will not get saved, until you give new values to ‘First Name’ and ‘Last Name’.


 

SBL-DAT-00215: This operation is not allowed when there are no records displayed. Please execute a query that returns at least one record or add a new record.

We mostly come acoss this error during application development.Below are few explanations and Corrective actions provided by Oracle.

Explanation


1. A particular operation, usually an update, has failed because there are no records available in the current query. Either the query needs to be changed to ensure it returns records, or the operation should be prevented if the query does not return records. The operation and its preceding query may have been initiated through any of the following: user actions directly in the UI, Enterprise Integration Manager (EIM), eBusiness Application Integration (EAI), business services or other scripting, workflow processes, object interfaces such as COM or CORBA, or Data Quality activities.

2. A query may be returning no records due to incorrect configuration in Siebel Tools objects, workflow process, scripting, or a business service.

3. If the operation is triggered by an automated action such as a script, there should be a check to ensure there are records in the current query and prevent the operation if no records are present.

4. If the error occurs on a copied buscomp or applet which uses a special class, there may be specialized functionality which does not work properly on the copied object. For example, there may be user properties referencing the original buscomp name.

5. The error may occur when importing workflow processes, due to one or both of the following:
(a) An issue with the Front Office Workflow definition in Siebel Tools
(b) Multiple exception connectors have been defined with the same name

6. The error may occur when updating baseline data in Sales Volume Planning if the Populate Locks action has not been run on the Sales Volume Planning Administration view.

Corrective Action



1. Use SQL logging to identify the query run and operation attempted. The SQL logging method will differ depending upon which action is triggering this error. If possible, use additional logging to determine the buscomp upon which the query and attempted operation were run.

2. In Siebel Tools, look up the buscomp against which the query ran. Check the search specification and view mode properties on the buscomp, applet, and view. If any joins are defined on the buscomp, make sure the Outer Join Flag is appropriately set. If the query was run by a script, make sure you have used SetViewMode and SetSearchSpec or SetSearchExpr appropriately. If the query is run using a Siebel Operation in a workflow process, check the search specification defined in the Workflow Process Designer.

3. If the query and operation are performed from a custom script or business service, make sure there is validation in the script to ensure that records were returned by the query before attempting the operation.

4. If the error occurs on a copied object using a special class, check for special user properties such as On Field Update Invoke which may be automatically trying to invoke a specialized method. Avoid copying specialized objects, as noted in Siebel Bookshelf version 7.7 > Configuring Siebel eBusiness Applications > Overview of Configuring Siebel Applications > About Configuring Siebel Applications > About Copying Objects.

5. If the error occurs when importing workflow processes:
(a) Follow the steps documented in Alert 594 on SupportWeb.
(b) Check the workflow processes you are attempting to import to ensure they do not have multiple exception connectors defined with the same name.

6. If the error occurs when updating baseline data in Sales Volume Planning, review FAQ 2071 on SupportWeb and ensure that the Populate Locks action has been run.