Siebel – ActivateField() split wide open
by Himanshu BajpaiIn Siebel, we generally tend to use the fields on the BC level in a number of ways, one of them being their use in Siebel scripts. The most common functions for operating on BC fields are GetFieldValue() and SetFieldValue() used for getting a value, or setting a value of the corresponding field in the BC. However, Siebel requires using ActivateField() before operating on any field of the BC.
Fields that are not active at runtime should not be used in script. Runtime errors, flawed logic and lost data may be the result of such a practice.
Following are the fields that are active by default.
• System fields (Id, Created, Created By, Updated, Updated By)
• Fields with their Link Spec property (on the business component object) set to TRUE
• Fields with their Force Active property (on the business component object) set to TRUE
• Fields included in the definition of an applet on the active view, even if the field’s Show In List property (for List Applets in Siebel 7.x) or its Visible property (for Form Applets in Siebel 7.x) is set to FALSE (on the applet object).
Note that a list column must be bound to a web template to actually be included in the SQL. Simply defining the column in the applet’s definition will not make a field active as of 7.5.2.200.
• Fields activated with BusComp.ActivateField(“”) are active for the lifetime of the BusComp object variable or until deactivated explicitly by the DeactivateFields method.
• Fields that are used as part of a calculated field calculation when the calculated field is retrieved for use on the active applet.
If any of the above circumstances is not true then the field will not be retrieved in the SQL statement for the business component. This means that no value is available to GetFieldValue and subsequent updates with WriteRecord will not have a database column to update since it was not included in the original SQL statement.
Both cases have a severe impact. Whether
• The ActivateField() method is used incorrectly, or
• The ActivateField() method causes the specified field to be included in the SQL statement for the subsequent ExecuteQuery() method call. A call to ActivateField() is relevant only if followed by a call to the ExecuteQuery() method.
Retrieving and updating fields using BC.GetFieldValue() or BC.SetFieldValue() methods before a query has been executed will not work as expected. If the script calls GetFieldValue before a field has been properly activated and retrieved, GetFieldValue will return a runtime error will occur for the use of GetFieldValue or SetFieldValue where a field has not been activated.
While working with the Siebel Data Server from an external VB/Java application, for example, the Siebel Data Server is not aware of any applet definitions and, therefore, will not include the fields defined on an applet. Script must use the ActivateField method to retrieve the desired fields in a query in this case. This is also true when interacting with the Siebel Database using the Siebel Business Objects Interface Type Library.
Let’s wait for more on ActivateField().
Related posts:
- Siebel – Make MVG Field required Siebel supports the concept of Multi Valued Fields, or the...
- Siebel – Run Case Insensitive queries This is a nice tip I ran across. All the...
- Siebel – Fetch Active view properties – II We discussed about fetching the values from the active view...
- Siebel – InvokeServiceMethod() on Calculated Fields InvokeServiceMethod() is used to invoke Business Services and take values...
- Siebel – DefaultFocus – User Property In Siebel Application, whenever you navigate to a screen, the...
- Siebel – Make a field Required, conditionally There was a requirement in our project to make Account...
- Siebel – millisecond dates on Applet I had discussed in my previous posts about invoking a...
Nice post, Himanshu. I am glad to see that you have covered a very important aspect related to EAI here which generally people tend to overlook.
When instantiating requests through EAI (either Workflows invoked from some other BCs than the BCs being processed, or even more importantly through the B2B Channel), people tend to overlook the fact that the corresponding view is not exposed here. So, the fields which are active because of being exposed on the UI, or the BCs / BOs of the view are not active. These must explicitly be activated if being used through eScript.
If standard Siebel Operation steps, or other vanilla Business Services are used for this processing, then ActivateField() may not be used.
activatefield in script gives a lot of problems. sometimes it does not work. it gives error that the field is not activated despite already using activatefield. also it gives script error and all. we must try to use activatefield first. if it does not work use force active property on bc field. this works best.
Force Active comes with its own set of problems. The force activated field will be fetched evertime a query is made on that BC. It can give to serious performance issues in later stages of the project.
We have the same problem with activating fields on the Applet server script. It doesn’t work and also force active on the BusComp level doesn’t work for the particular field. We were trying to adjust the data by a business service, but also there the field is not able to activate..Seems to be quite problems with the field activation..