Bookshelf Home | Contents | Index | PDF |
Configuring Siebel Open UI > Customizing Siebel Open UI for Siebel Mobile Disconnected > Methods You Can Use to Customize Siebel Mobile Disconnected > Methods You Can Use in the Business Component ClassThis topic describes methods that you can use that reside in the Business Component class. It includes the following information:
The ActivateField method activates a business component field. It returns nothing. It uses the following syntax: this.ActivateField(field_name); bc.ActivateField("field_name");// calling from another JavaScript file A field is inactive except in the following situations, by default:
The following example uses the ActivateField method to activate the Login Name field that resides in the Contact business component: var currRetValue={err:false}, retObj; var model= SiebelApp.S_App.GetModel(); var boContact = model.GetBusObject("Contact"); var bcContact = boContact.GetBusComp("Contact"); currRetValue=bcContact.ActivateField("Login Name"); bcContact.SetSearchSpec("Login Name", sLoginName); retObj=currRetValue=bcContact.ExecuteQuery(); The ActivateMultipleFields method activates more than one field. It returns nothing. It uses the following syntax: BusComp.ActivateMultipleFields(SiebelPropertySet);
The following example uses the ActivateMultipleFields method to activate all the fields that the property set contains, including the Account Products, Agreement Name, Project Name, Description, and Name fields: var ps = SiebelApp.S_App.NewPropertySet(); ps.setProperty("Account Products",""); ps.setProperty("Agreement Name",""); ps.setProperty("Project Name",""); ps.setProperty("Description",""); BusComp.ActivateMultipleFields(ps); The following example in Siebel eScript queries the Contact business component and returns the First Name and Last Name of the first contact that it finds: var currRetValue={err:false}, retObj; var model= SiebelApp.S_App.GetModel(); var ContactBC = model.GetBusObject("Contact"); var ContactBC = boContact.GetBusComp("Contact"); var fieldsPS = SiebelApp.S_App.NewPropertySet(); var valuesPS = SiebelApp.S_App.NewPropertySet(); fieldsPS. SetProperty("Last Name", ""); fieldsPS.SetProperty("First Name", ""); ContactBC.ActivateMultipleFields(fieldsPS); currRetValue=ContactBC.ExecuteQuery(); retObj=currRetValue=ContactBC.FirstRecord(); ContactBC .GetMultipleFieldValues(fieldsPS, valuesPS); var slName = valuesPS.GetProperty("Last Name"); var sfName = valuesPS.GetProperty("First Name"); The Associate method adds an association between the active record that resides in the child association business component and the parent business component. You can customize or override this method. It returns the retObj object with err set to one of the following values:
SiebelApp.S_App.FindApplet(appletName).BusComp().Associate(); An association business component is a type of business component that includes an intertable. For more information, see GetAssocBusComp Method. The ClearToQuery method clears the current query. It returns nothing. It uses the following syntax:
The following example uses the ClearToQuery method: var model= SiebelApp.S_App.GetModel(); var oEmpBusObj= model.GetBusObject("Employee"); var oEmpBusComp = oEmpBusObj.GetBusComp("Employee "); oEmpBusComp.SetSearchSpec("Login Name", sLoginName); For another example usage of the ClearToQuery method, see CountRecords Method. The CountRecords method returns the number of records that a business component contains according to the search specification and query specification that Siebel Open UI runs on this business component. It uses the following syntax: The following example uses the CountRecords method: var currRetValue={err:false}, retObj; var model= SiebelApp.S_App.GetModel(); var bo = model.GetBusObject("Opportunity "); var bc = bo.GetBusComp("Opportunity"); bc .SetSearchSpec ("Name", "A"); retObj=currRetValue=bc.ExecuteQuery(); var count = bc .CountRecords(); currRetValue={err:false,retVal:count}; For more information, see ClearToQuery Method. The DeactivateFields method deactivates fields from the SQL query statement of a business component. It deactivates fields that are currently active. DeactivateFields applies this behavior except in the following situations:
The DeactivateFields method returns nothing. SiebelApp.S_App.FindApplet(appletName).BusComp().DeactivateFields(); You must use the ActivateField method to activate a field before you configure Siebel Open UI to perform a query for a business component. After Siebel Open UI deactivates a field, you must configure it to query the business component again or the Siebel application fails. The DeleteRecord method deletes the current record from the local database. It returns one of the following values: The ExecuteQuery method runs a query according to the current value of the Search Specification property, the current value of the Sort Specification property, or according to both of these properties. The business component contains these properties. ExecuteQuery runs this query on the local database. It returns one of the following values:
The FirstRecord method moves the record pointer to the first record in a business component, making this record the current record. It uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp().FirstRecord(); The GetAssocBusComp method returns an instance of the association business component. It uses the following syntax: For more information, see Associate Method. You can use an association business component to manipulate an association. You can use the GetAssocBusComp method and the Associate method only with a many-to-many relationship that uses an intersection table. For example, with accounts and contacts.
If a many-to-many link exists, and if Siebel CRM defines an association applet for the child applet, then you can use the GetAssocBusComp method with the child business component of a parent-child view. The following example associates a contact that includes the ContactID Id with an account that includes the AccountId Id: var currRetValue={err:false}, retObj; var Model =SiebelApp.S_App.GetModel() varaccount BO = Model.GetBusObj("Account"); var accountBC = accountBO.GetBusComp("Account"); var contactBC = accountBO.GetBusComp("Contact"); accountBC.SetSearchSpec("Id",[AccountId]); currRetValue=accountBC.ExecuteQuery (); currRetValue=accountBC.FirstRecord();// positions on the account record currRetValue=contactBC.ExecuteQuery (); currRetValue=contactBC.FirstRecord(); var assocBC = contactBC.GetAssocBusComp(); assocBC.SetSearchSpec("Id",[ContactID]); currRetValue=assocBC. ExecuteQuery (); currRetValue=assocBC.FirstRecord();// positions on the contactbc currRetValue=contactBC.Associate(); // adds the association The GetFieldValue method returns the value of a field for the current record or for the record object that Siebel Open UI examines. It uses the following syntax: Buscomp.GetFieldValue("field_name",pRecord)
For example, the following code returns the value of the Account Name field from the current record of the business component: Buscomp.GetFieldValue "Account Name") For another example, the following code returns the field value of the Account Name field. A business component can include more than one record, but only one of these records is the active record. You can use pRecord to get the value of a field from a record that is not the active record: Buscomp.GetFieldValue("Account Name",recordObject) The GetFieldValue method returns an object that includes an error code and a return value. For more information, see Configuring Error Messages for Disconnected Clients and SetErrorMsg Method. For more examples that use the GetFieldValue method, see the following topics:
You can configure Siebel Open UI to override the GetFieldValue method. The GetLinkDef method returns the link definition of the child business component. This business component is the child in the parent and child relationship of a link. It returns this definition after Siebel Open UI processes data for the child business component. This definition includes values for the following properties:
If the value of a property is empty, then GetLinkDef does not return this property in the return object. The GetLinkDef method uses the following syntax: linkdef = busComp.GetLinkDef(); var sourcefieldName = linkdef.srcFieldName; The GetLastErrCode method returns the error code for the most recent error that the disconnected client logged. It uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp().GetLastErrCode(); This method includes no arguments. The error code that this method returns is a short integer. An error code of 0 (zero) indicates no error occurred. The GetLastErrText method returns a string that contains the text message for the most recent error that the disconnected client logged. It uses the following syntax: ActiveBusObject().GetLastErrText(); This method includes no arguments. The GetMultipleFieldValues method returns a value for each field that a property set specifies. It uses the following syntax: BusComp.GetMultipleFieldValues(fieldNamesPropSet, fieldValuesPropSet)
If an error occurs, then GetMultipleFieldValues returns err with an error message. For example: {err: "Error Message",retVal: ""} If an error does not occur, then GetMultipleFieldValues returns an empty err message. For example: You cannot use the same instance of a property set for the fieldNamesPropSet argument and for the fieldValuesPropSet argument. The following example uses the GetMultipleFieldValues method: var oPsDR_Header = SiebelApp.S_App.NewPropertySet(); // Cannot use the same property set in GetMultipleFieldValues, must use a // different one for the values. The process will not error, but Siebel Open UI // will not place the values in the property set. var lPS_values = SiebelApp.S_App.NewPropertySet(); oPsDR_Header.SetProperty("Last Name",""); oPsDR_Header.SetProperty("First Name",""); oPsDR_Header.SetProperty("Middle Name",""); var currRetValue={err:false}, retObj; var model= SiebelApp.S_App.GetModel(); var boContact = model.GetBusObject("Contact"); var bcContact = boContact.GetBusComp("Contact"); bcContact.ActivateMultipleFields(oPsDR_Header); bcContact.SetSearchSpec("Last Name", "Mead*"); // Use a different property set for the values. If you use the same one // for arguments you get no values back. currRetValue=GetMultipleFieldValues(oPsDR_Header, lPS_values); // Get the value from the output property set. SiebelJS.Log("FullName is " +lPS_values.GetProperty("First Name") + lPS_values.GetProperty("Middle Name")+ lPS_values.GetProperty("Last Name")); The GetPicklistBusComp method returns a pick business component that Siebel CRM associates with a field that resides in the current business component. If no picklist is associated with this field, then this method returns an error. It uses the following syntax: BusComp.GetPicklistBusComp(FieldName) You can use the GetPicklistBusComp method to manipulate a picklist, and you can use the name of the pick business component that the GetPicklistBusComp method returns. If Siebel CRM uses the GetPickListBusComp method or the Pick method to pick a record that resides in a constrained picklist, then the constraint is active. The pick business component that these methods return contains only the records that meet the constraint. This topic describes how to configure Siebel Open UI to pick a value from a picklist. To configure Siebel Open UI to pick a value from a picklist
The GetSearchExpr method returns a string that contains the current search expression that Siebel Open UI defines for a business component. The following search expression is an example of a string that GetSearchExpr might return: [Revenue] > 10000 AND [Probability] > .5 The GetSearchExpr method uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp().GetSearchExpr(); The GetSearchExpr method includes no arguments. If an instance of the business component does not exist, then the GetSearchExpr method returns nothing. The GetSearchSpec method returns a string that contains the search specification that Siebel Open UI defines for a business component field in. For example, it might return the following search specification: The GetSearchSpec method uses the following syntax: BusComp.GetSearchSpec(FieldName); SiebelApp.S_App.FindApplet(appletName).BusComp().GetSearchSpec (FieldName); The GetUserProperty method gets the value of a business component user property. It uses the following syntax: BusComp.GetUserProperty(business_component_user_property)
For example, the following code gets the value of the Deep Copy business component user property: SiebelApp.S_App.FindApplet(appletName).BusComp().GetUserProperty ("Deep Copy"); The GetViewMode method returns a Siebel ViewMode constant or the corresponding integer value for this constant. This constant identifies the current visibility mode of a business component. This mode determines the records that a query returns according to the visibility rules. The GetViewMode method uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp().GetViewMode(); The InvokeMethod method that you can use with business components works the same as the InvokeMethod method that you can use with applets. For more information about the InvokeMethod method that you can use with applets, see InvokeMethod Method for Applets. The Name method returns the name of a business component. It uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp() The NextRecord method moves the record pointer to the next record that the business component contains, making this next record the current record. It adds the next record that the current search specification and sort specification identifies, and then sets the active row to this record. It adds this record to the current set of records. It does this work only if the current set of records does not already contain this next record. It returns this next record. It uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp().NextRecord(); The ParentBusComp method returns the parent business component of a business component. It uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp().ParentBuscomp() The Pick method places the currently chosen record that resides in a pick business component into the appropriate fields of the parent business component. It uses the following syntax: The Pick method includes no arguments. You cannot use the Pick method to modify the record in a picklist field that is read-only. For usage information, see Configuring Siebel Open UI to Pick a Value from a Picklist. For more information about pick business component, see Configuring Siebel Business Applications. The RefreshBusComp method runs the current query again for a business component and makes the record that was previously active the active record. The user can view the updated view, but the same record remains highlighted in the same position in the list applet. This method returns nothing. BusComp.InvokeMethod("RefreshBusComp") currRetValue=buscomp.InvokeMethod("RefreshBusComp"); The RefreshRecord method updates the currently highlighted record and the business component fields in the Siebel client. It positions the cursor on the highlighted record. It does not update other records that are currently available in the client. This method returns nothing. BusComp.InvokeMethod("RefreshRecord ") currRetValue=buscomp.InvokeMethod("RefreshRecord"); The SetFieldValue method sets a field value in a record. It returns one of the following values depending on whether it successfully set the field value:
SetFieldValue(fieldName, fieldValue);
For examples that use the SetFieldValue method, see the following topics:
The SetMultipleFieldValues method sets new values in the fields of the current record of a business component. It uses the following syntax: BusComp.SetMultipleFieldValues (oPropertySet) The FieldName argument that the property set contains must match the field name that Siebel Tools displays. This match must be exact, including upper and lower case characters. In the following example, the FieldName is Name and the FieldValue is Acme: oPropertySet.SetProperty ("Name","Acme")
The following example in Siebel eScript uses the SetMultipleFieldValues method to set the values for all fields that the property set identifies, including the Name, Account, and Sales Stage: var currRetValue={err:false}, retObj; varmodel = SiebelApp.S_App.GetModel(); var bo = model.GetBusObj("Opportunity"); var bc = bo.GetBusComp("Opportunity"); var ps =SiebelApp.S_App.NewPropertySet(); ps.SetProperty ("Name", "Call Center Opportunity"); ps.SetProperty ("Account", "Marriott International"); ps.SetProperty ("Sales Stage", "2-Qualified"); bc.ActivateMultipleFields(ps); currRetValue=bc.SetMultipleFieldValues(ps); currRetValue=bc.WriteRecord(); The SetSearchSpec method sets the search specification for a business component. It returns nothing. It uses the following syntax: BusComp.SetSearchSpec(FieldName,searchSpec); SiebelApp.S_App.FindApplet(appletName).BusComp().SetSearchSpec("Id", strCallId);
You must configure Siebel Open UI to call the SetSearchSpec method before it calls the ExecuteQuery method. To avoid an unexpected compound search specification on a business component, it is recommended that you configure Siebel Open UI to call the ClearToQuery method before it calls the SetSearchSpec method. The SetViewMode method sets the visibility type for a business component. It returns nothing. It uses the following syntax: SiebelApp.S_App.FindApplet(appletName).BusComp().SetViewMode(inMode); The UndoRecord method reverses any unsaved modifications that the user makes on a record. This includes reversing unsaved modifications to fields, and deleting an active record that is not saved. It returns one of the following values:
SiebelApp.S_App.FindApplet(appletName).BusComp().UndoRecord(); You can use the UndoRecord method in the following ways:
The UpdateRecord method places the current record in the commit pending state so that Siebel Open UI can modify it. It returns the retObj object with retVal set to one of the following values:
For example, the following code calls the CanUpdate method. If CanUpdate indicates that Siebel Open UI can update the active row, then this code places the current record in the commit pending state for the business component that The UpdateRecord method can run in a Siebel Mobile disconnected client. For more information, see CanUpdate Method. The WriteRecord method writes any modifications that the user makes to the current record. If you use this method with:
The WriteRecord method returns one of the following values:
The WriteRecord method uses the following syntax: buscomp.writerecord(bAddSyncQ)
For examples that use the WriteRecord method, see the following topics:
You must first configure Siebel Open UI to create new records and set values for fields. You can then use the following code to call the WriteRecord method to save the new record to the offline database: var currRetValue={err:false}, retObj; var model= SiebelApp.S_App.GetModel(); var bo = model.GetBusObject("Opportunity "); var bc = bo.GetBusComp("Opportunity"); var strDEAExpDate = 02/12/2013; currRetValue=bc.SetFieldValue("DEA#", strDEANumber); currRetValue=bc.SetFieldValue("DEA Expiry Date", strDEAExpDate); currRetValue=bc.SetFieldValue("DEA Expiry Date", strDEAExpDate); |
Configuring Siebel Open UI | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |