Siebel CRM Configuring Siebel Open UI Siebel Innovation Pack 2015 E52417-01 |
|
Previous |
Next |
View PDF |
This topic describes the methods that exist in the Application Programming Interface that you can use to customize Siebel Mobile Disconnected in Siebel Open UI. It includes the following information:
You can configure Siebel Open UI to override or customize some of the methods that this topic describes. For more information about how to customize or override a method, see "Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects".
This topic describes methods that you can use that reside in the Applet class. It includes the following information:
The BusComp method returns the business component that the applet references. It uses the following syntax:
Applet.BusComp()
For example, the following code gets the metadata for the business component that the active applet references:
SiebelApp.S_App.FindApplet(appletName).BusComp();
Each applet references a business component. If you configure Siebel Open UI to call BusComp on an applet, then it returns the business component that this applet references.
The BusComp method includes no arguments.
For information about using BusComp in the context of a business object, see "GetBusComp Method for Business Objects".
The BusObject method returns the business object that the business component references. It uses the following syntax:
Applet.BusObject()
For example:
SiebelApp.S_App.FindApplet(appletName).BusObject();
The BusObject method includes no arguments.
The CanInvokeMethod method determines whether or not Siebel Open UI can call a method. It returns the following properties. If you use CanInvokeMethod, then you must configure it so that it returns these properties:
Invoked. This property returns one of the following values:
true. Siebel Open UI examined the method.
false. Siebel Open UI did not examine the method.
RetVal. This property returns one of the following values:
true. Siebel Open UI can call the method.
false. Siebel Open UI cannot call the method.
The CanInvokeMethod method uses the following syntax:
Applet.CanInvokeMethod(methodName)
where:
methodName is a string that contains the name of the method that CanInvokeMethod examines. CanInvokeMethod gets this string as a property that resides in an input property set.
For examples that use CanInvokeMethod, see the following topics:
The InvokeMethod method calls a method. If you use InvokeMethod, then you must configure it so that it returns a property set that includes one of the following values:
true. Siebel Open UI called the method.
false. Siebel Open UI did not call the method.
It uses the following syntax:
Applet.InvokeMethod(methodName);
where:
MethodName is the value of an input property that identifies the method that InvokeMethod calls.
For example, InvokeMethod in the following code calls the method that the value of the svcMthdName variable contains:
Applet.InvokeMethod(svcMthdName);
For examples that use InvokeMethod, see "Using Custom JavaScript Methods" and "Allowing Users to Commit Part Tracker Records".
The Name method for an applet returns the name of an applet. It uses the following syntax:
Applet.Name()
For example:
SiebelApp.S_App.GetActiveView().GetActiveApplet().Name();
The Name method includes no arguments.
This 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
where:
field_name identifies the name of a business component field.
A field is inactive except in the following situations, by default:
The field is a system field, such as Id, Created, Created By, Updated, or Updated By.
The Force Active property of the field is TRUE.
The Link Specification property of the field is TRUE.
An active applet includes the field, and this applet references a business component that is active.
The field resides in an active list applet, and the Show In List property of the list column that displays this field in the applet is TRUE.
Note the following:
Siebel CRM calls the ActivateField method on the field, and then runs the ExecuteQuery method.
If Siebel CRM calls the ActivateField method after it calls the ExecuteQuery method, then the ActivateField method deletes the query context.
The ActivateField method causes Siebel CRM to include the field in the SQL statement that the ExecuteQuery method starts. If Siebel CRM activates a field, and if a statement in the GetFieldValue method or the SetFieldValue method references the file before Siebel CRM performs a statement from the ExecuteQuery method, then the activation has no effect.
The following example uses the ActivateField method to activate the Login Name field that resides in the Contact business component:
var model= SiebelApp.S_App.GetModel(); var boContact = model.GetBusObject("Contact"); var bcContact = boContact.GetBusComp("Contact"); bcContact.ClearToQuery(); bcContact.ActivateField("Login Name"); var sLoginName = "SPORTER"; bcContact.SetSearchSpec("Login Name", sLoginName); bcContact.ExecuteQuery(); $.callback(this, function () { if (!retObj.err) { model.ReleaseBO(boContact); } }
The ActivateMultipleFields method activates more than one field. It returns nothing. It uses the following syntax:
BusComp.ActivateMultipleFields(SiebelPropertySet);
where:
SiebelPropertySet
is a property set that identifies a collection of properties. These properties identify the fields that Siebel CRM must activate.
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",""); ps.setProperty("Name",""); 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 model= SiebelApp.S_App.GetModel(); var ContactBC = model.GetBusObject("Contact"); var ContactBC = boContact.GetBusComp("Contact"); if (ContactBC) { var fieldsPS = SiebelApp.S_App.NewPropertySet(); var valuesPS = SiebelApp.S_App.NewPropertySet(); fieldsPS. SetProperty("Last Name", ""); fieldsPS.SetProperty("First Name", ""); ContactBC.ActivateMultipleFields(fieldsPS); ContactBC .ClearToQuery(); ContactBC .ExecuteQuery(); $.callback(this, function () { if (!retObj.err) { ContactBC .FirstRecord(); $.callback(this, function () { if (!retObj.err) { 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:
true. The Associate method successfully added the record.
false. The Associate method did not successfully add the record.
It uses the following syntax:
BusComp. Associate()
where:
BusComp
identifies an instance of the child business component.
For example:
SiebelApp.S_App.FindApplet(appletName).BusComp().Associate();
It includes no arguments.
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:
BusComp.ClearToQuery();
It includes no arguments.
Note the following:
The ClearToQuery method does not clear the sort specification that Siebel Open UI defines in the Sort Specification property of a business component.
You must use the ActivateField method to activate a field before you can use the ClearToQuery method. For more information see "ActivateField Method".
Any search specifications and sort specifications that Siebel Open UI sends to a business component are cumulative. The business component performs an AND operation for the queries that accumulate since the last time Siebel CRM performed the ClearToQuery method. An exception to this configuration occurs if Siebel Open UI adds a new search specification to a field, and if this field already includes a search specification. In this situation, the new search specification replaces the old search specification.
The following example uses the ClearToQuery method:
var model= SiebelApp.S_App.GetModel(); var oEmpBusObj= model.GetBusObject("Employee"); var oEmpBusComp = oEmpBusObj.GetBusComp("Employee "); var sLoginName; oEmpBusComp.ClearToQuery(); oEmpBusComp.SetSearchSpec("Login Name", sLoginName); oEmpBusComp.ExecuteQuery();
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:
BusComp.CountRecords();
It includes no arguments.
The following example uses the CountRecords method:
var model= SiebelApp.S_App.GetModel(); var bo = model.GetBusObject("Opportunity "); var bc = bo.GetBusComp("Opportunity"); if (bc) { bc .ClearToQuery(); bc .SetSearchSpec ("Name", "A"); bc .ExecuteQuery(); $.callback(this, function () { if (!retObj.err) { var count = bc .CountRecords(); $.setReturnValue({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 Force Active property is TRUE.
A link requires the field to remain active.
A business component class requires the field to remain active.
The DeactivateFields method returns nothing.
It uses the following syntax:
BusComp.DeactivateFields()
For example:
SiebelApp.S_App.FindApplet(appletName).BusComp().DeactivateFields();
It includes no arguments.
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:
error:false. DeleteRecord deleted the record.
error:true. DeleteRecord did not delete the record.
It uses the following syntax:
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:
If an error occurs, then it returns err with an error message. For example:
{err: "Error Message",retVal: ""}
If an error does not occur, then it returns an empty err message. For example:
{err: "",retVal: ""}
It uses the following syntax:
busComp.ExecuteQuery();
where:
busComp
identifies the business component that ExecuteQuery uses to get the search specification or sort specification. You can use busComp
as a literal or a variable. For more information, see "How This Book Indicates Code That You Can Use as a Variable and Literal".
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:
BusComp.FirstRecord();
For example:
SiebelApp.S_App.FindApplet(appletName).BusComp().FirstRecord();
The GetAssocBusComp method returns an instance of the association business component. It uses the following syntax:
BusComp.GetAssocBusComp();
It includes no arguments.
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.
Note the following:
To associate a new record, you add it to the child business component.
To add a record, you use the GetAssocBusComp method and the Associate method.
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 Model =SiebelApp.S_App.GetModel() varaccount BO = Model.GetBusObj("Account"); var accountBC = accountBO.GetBusComp("Account"); var contactBC = accountBO.GetBusComp("Contact"); accountBC.SetSearchSpec("Id",[AccountId]); accountBC. ExecuteQuery (); $.callback(this,function(){ accountBC.FirstRecord();// positions on the account record $.callback(this,function(){ contactBC. ExecuteQuery (); $.callback(this,function(){ contactBC.FirstRecord(); $.callback(this,function(){ var assocBC = contactBC.GetAssocBusComp(); assocBC.SetSearchSpec("Id",[ContactID]); assocBC. ExecuteQuery (); $.callback(this,function(){ assocBC.FirstRecord();// positions on the contactbc $.callback(this,function(){ 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)
where:
field_name is a string that contains the name of a field. Siebel Open UI returns the value that this field contains.
pRecord
is an optional argument that returns the entire record that Siebel Open UI examines. If you do not specify pRecord, or if it is empty, then GetFieldValue returns only a value in field_name of the active record.
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:
Name
RecordNum
childBusCompName
destFieldName
interChildColName
interParentColName
interTableName
parentBusCompName
primeIdFieldName
searchSpec
sortSpec
srcFieldName
NoDelete
NoInsert
NointerDelete
NoUpdate
SrcFieldValue
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:
BusComp.GetLastErrCode()
For example:
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:
BusComp.GetLastErrText()
For example:
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)
where:
fieldNamesPropSet
is a property set that identifies a collection of fields.
fieldValuesPropSet
is a property set that includes values for the fields that the fieldNamesPropSet argument specifies.
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:
{err: "",retVal: ""}
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 model= SiebelApp.S_App.GetModel(); var boContact = model.GetBusObject("Contact"); var bcContact = boContact.GetBusComp("Contact"); bcContact.ActivateMultipleFields(oPsDR_Header); bcContact.SetSearchSpec("Last Name", "Mead*"); ExecuteQuery(); $.callback(this,function(){ FirstRecord(); $.callback(this,function(){ // Use a different property set for the values. If you use the same one // for arguments you get no values back. GetMultipleFieldValues(oPsDR_Header, lPS_values); // Get the value from the output property set. $.callback(this,function(){ 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
Use a JavaScript editor to open the JavaScript file that you must modify. This file resides on the client.
Add code that uses the Pick method to pick the value.
For example, add the following code to the method that Siebel Open UI uses to register the service:
this.GetFieldValue("City") $.callback(this,function(retObj){ if(retObj.retVal === "San Mateo") { var oBCPick = this.GetPicklistBusComp("State"); oBCPick.SetSearchSpec("Value", "CA"); oBCPick.ExecuteQuery(ForwardOnly); $.callback(this,function(){ oBCPick.FirstRecord(); $.callback(this,function(){ if(oBCPick.CheckActiveRow()){ oBCPick.Pick(); } }); }); }
This code configures Siebel Open UI to use the GetPicklistBusComp method to create an instance of the picklist business component. For more information, see "Pick Method".
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:
BusComp.GetSearchExpr();
For example:
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:
> 10000
The GetSearchSpec method uses the following syntax:
BusComp.GetSearchSpec(FieldName);
For example:
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)
where:
business_component_user_property is a string that identifies the name of a 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:
BusComp. GetViewMode()
It includes no arguments.
For example:
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()
It includes no arguments.
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:
BusComp.NextRecord()
For example:
SiebelApp.S_App.FindApplet(appletName).BusComp().NextRecord();
It includes no arguments.
The ParentBusComp method returns the parent business component of a business component. It uses the following syntax:
BusComp. ParentBusComp()
It includes no arguments.
For example:
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:
BusComp.Pick()
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.
It uses the following syntax:
BusComp.InvokeMethod("RefreshBusComp")
For example:
"buscomp. InvokeMethod("RefreshBusComp") $.callback(this, function (retObj) { if (!retObj.err){}});"
It includes no arguments.
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.
It uses the following syntax:
BusComp.InvokeMethod("RefreshRecord ")
For example:
"buscomp. InvokeMethod("RefreshRecord") $.callback(this, function (retObj) { if (!retObj.err){ }});"
It includes no arguments.
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:
Successfully set the field value. Returns an empty error code.
Did not successfully set the field value. Returns an error code.
It uses following syntax.
SetFieldValue(fieldName, fieldValue);
where:
fieldName is a string that contains the name of the field that SetFieldValue updates.
fieldValue is a string that contains the value that SetFieldValue uses to update the field.
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")
Note the following:
If an error occurs in the values of any of fields that the property set specifies, then Siebel Open UI stops the process it is currently running.
You can use the SetMultipleFieldValues method only on a field that is active.
You must not use the SetMultipleFieldValues method on a field that uses a picklist.
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:
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); bc.NewRecord(); $.callback(this,function(){ bc.SetMultipleFieldValues(ps); $.callback(this,function(){ ps = null; 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);
For example:
SiebelApp.S_App.FindApplet(appletName).BusComp().SetSearchSpec("Id", strCallId);
where:
FieldName is a string that identifies the name of the field where Siebel Open UI sets the search specification.
searchSpec is a string that contains the search specification.
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:
BusComp.SetViewMode(inMode);
where:
inMode
identifies the view mode. It contains one of the following integers:
0. Sales Representative.
1. Manager.
2. Personal.
3. All.
4. None.
5. Organization.
6. Contact.
For example:
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:
true. UndoRecord successfully deleted the record.
false. UndoRecord did not successfully delete the record.
It uses the following syntax:
BusComp.UndoRecord();
It includes no arguments.
For example:
SiebelApp.S_App.FindApplet(appletName).BusComp().UndoRecord();
You can use the UndoRecord method in the following ways:
To delete a new record. Use it after Siebel CRM calls the NewRecord method and before it saves the new record to the Siebel database.
To reverse modifications that the user makes to field values. Use it before Siebel CRM uses the WriteRecord method to save these changes, or before the user steps off the record.
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:
true. The UpdateRecord method successfully placed the current record in the commit pending state.
false. The UpdateRecord method did not successfully place the current record in the commit pending state.
It uses the following syntax:
this.UpdateRecord();
where:
this
identifies a business component instance.
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 this
specifies:
this. UpdateRecord(false)
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:
A connected client. WriteRecord writes these modifications to the Siebel Database that resides on the Siebel Server.
Siebel Mobile disconnected.
WriteRecord writes these modifications to the local database that resides on the client.
The WriteRecord method returns one of the following values:
error:false. WriteRecord successfully wrote the modifications to the local database.
error:true. WriteRecord did not successfully write the modifications to the local database.
The WriteRecord method uses the following syntax:
buscomp.writerecord(bAddSyncQ)
where:
bAddSyncQ
is an optional argument that specifies to synchronize the modification that WriteRecord makes to the Siebel Server. You can set this argument to one of the following values:
true. Siebel Open UI synchronizes the modification. This is the default setting.
false. Siebel Open UI does not synchronize the modification.
For examples that use the WriteRecord method, see the following topics:
"Registering Methods to Make Sure Siebel Open UI Runs Them in the Correct Sequence"
"Customizing Siebel Pharma for Siebel Mobile Disconnected Clients"
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 model= SiebelApp.S_App.GetModel(); var bo = model.GetBusObject("Opportunity "); var bc = bo.GetBusComp("Opportunity"); varstrDEANumber = 9089; var strDEAExpDate = 02/12/2013; bc.SetFieldValue("DEA#", strDEANumber); $.callback(this, function () { if (!retObj.err) { bc.SetFieldValue("DEA Expiry Date", strDEAExpDate); $.callback(this, function () { if (!retObj.err) { bc.SetFieldValue("DEA Expiry Date", strDEAExpDate); $.callback(this, function () { if (!retObj.err) { bc.WriteRecord(); } } } }
This topic describes methods that you can use that reside in the Business Object class. It includes the following information:
The GetBusComp method returns the business component instance that a business object references. It uses the following syntax:
SiebelApp.S_App.Model.GetBusObj(business_object).GetBusComp(business_component)
where:
business_object identifies the name of a business object.
business_component identifies the name of a business component.
Each view references a business object, and each business object references one or more business components. If you configure Siebel Open UI to call GetBusComp in the context of a business object, then you must do the following:
use the business_object argument to specify the name of the business object that the view references.
use the business_component argument to specify the name of a business component that the business object references.
For example, the following code gets the business component instance for the Order Entry - Orders business component that the Service Request business object references:
SiebelApp.S_App.Model.GetBusObj("ServiceRequest").GetBusComp("Order Entry - Orders")
For information about using BusComp in the context of an applet, see "BusComp Method for Applets". For more information about views, business objects, and business components, and how they reference each other, see Configuring Siebel Business Applications.
The GetLastErrCode method returns the error code for the most recent error that the disconnected client logged. It uses the following syntax:
BusObj.GetLastErrCode()
For example:
ActiveBusObject().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:
BusObj.GetLastErrText()
For example:
ActiveBusObject().GetLastErrText();
This method includes no arguments.
The Name method returns the name of a business object. It uses the following syntax:
BusObject.Name();
This method includes no arguments.
This topic describes methods that you can use that reside in the Business Service class. It includes the following information:
The Invoke method that you can use with a business service calls the CanInvokeMethod business service and the InvokeMethod business service. It returns a property set. It uses following syntax:
service.Invoke(method_name, psPropertySet);
where:
method_name is a string that identifies the business service method that the Invoke method calls. The Invoke method also calls the following methods:
CanInvokeMethod. Determines whether or not Siebel Open UI can call the business service method that method_name identifies. Any custom business service file you create must include the CanInvokeMethod business service method.
InvokeMethod. Calls the business service method that method_name identifies. Any custom business service file you create must include the InvokeMethod business service method.
For more information about using these methods, see "Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects".
psPropertySet
is a property set that the Invoke method sends to the method that method_name identifies.
The following example calls the CanAddSample method of the LS Pharma Validation Service business service:
var service = SiebelApp.S_App.GetService("LS Pharma Validation Service"); var outputSet = service.Invoke("CanAddSample", psPropertySet);
For an example that uses the Invoke method with a business service, see "Using Custom Siebel Business Services".
The ServiceRegistry method registers a custom business service method that you define. You must use it any time that you configure Siebel Open UI to call a custom business service method. It returns one of the following values:
true. Siebel Open UI successfully registered the method.
false. Siebel Open UI did not successfully register the method.
It uses following syntax:
SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
where:
inputObj
is an object that specifies a set of properties, where each property specifies a name and a value. The number of properties varies according to object type. For a list of properties that you can use, see "Properties You Must Include to Register Custom Business Services". The inputObj argument uses the following syntax:
inputObj [oconsts.get("name")] = "value";
where:
name specifies the property name
value specifies the property value
For example, the following code specifies the DOUIREG_OBJ_NAME property with a value of Pharma Call Entry Mobile:
inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";
The following code specifies the property name:
oconsts.get("DOUIREG_OBJ_NAME")
Siebel Open UI registers a method for a custom service when it loads the script files that it uses for this custom service. This configuration makes sure that Siebel Open UI calls the ServiceRegistry method from the correct location in the code. To view this code in the context of a complete example, see "Using Custom JavaScript Methods".
Table 9-1 describes the properties that you must include in the inputObj argument of the ServiceRegistry method when Siebel Open UI registers a custom business service. The local constants.js file defines each of these properties as a constant.
Table 9-1 Properties You Must Include to Register Custom Business Services
Properties | Value |
---|---|
DOUIREG_OBJ_NAME |
The name of a custom business service. For example: LS Pharma Validation Service |
DOUIREG_SRVC_NAME |
The name of the JavaScript class that the custom business service references. For example: PharmaCallValidatorsvc |
Table 9-2 describes the properties you must include in the inputObj argument of the ServiceRegistery method when Siebel Open UI registers a custom business service that references a predefined applet or a predefined business component.
Table 9-2 Required Input Properties for Custom Business Services That Reference Predefined Applets or Business Components
Property | Value |
---|---|
DOUIREG_OBJ_TYPE |
Specifies that this business service method references an applet or a business component. You must use one of the following values:
|
DOUIREG_OBJ_MTHD |
Name of the predefined business service method that you must customize. For example, WriteRecord. |
DOUIREG_SRVC_NAME |
The name of the JavaScript class that the Class property of the business service method references. For example: pharmacallsvc |
DOUIREG_SRVC_MTDH |
Name of the business service method that you customized. For example, WriteRecord. |
DOUIREG_EXT_TYPE |
You can use one of the following values:
|
This topic describes methods that you can use that reside in the Application class. It includes the following information:
The ActiveBusObject method returns the business object that the active view references. It uses the following syntax:
Application. ActiveBusObject()
It includes no arguments.
For example:
SiebelApp.S_App.ActiveBusObject();
The ActiveViewName method returns the name of the active view. It uses the following syntax:
Application. ActiveViewName()
It includes no arguments.
For example:
SiebelApp.S_App. ActiveViewName();
The CurrencyCode method returns the currency code that Siebel CRM associates with the division of the user position. For example, USD for U.S. dollars, EUR for the euro, or JPY for the Japanese yen. It uses the following syntax:
Application. CurrencyCode()
It includes no arguments.
For example:
SiebelApp.S_App. CurrencyCode();
The FindApplet method returns the active applet. It uses the following syntax:
Application. FindApplet(appletName)
where:
appletName
is a string that contains the name of the active applet.
For example, if the Contact List Applet is the current applet, then the appletName variable in the following code returns the name of this applet as a string:
SiebelApp.S_App.FindApplet(appletName);
The GetBusObject method creates a new instance of a business object. It returns this new business object instance. It is not synchronous. It uses the following syntax:
Application. GetBusObject(business_object_name)
where:
business_object_name is a string that identifies the name of a business object
For example, the following code creates a new instance of the Opportunity business object:
SiebelApp.S_App. GetBusObject(Opportunity);
The GetLastErrCode method returns the error code for the most recent error that the disconnected client logged. It uses the following syntax:
Application.GetLastErrCode()
For example:
TheApplication().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:
Application.GetLastErrText()
For example:
TheApplication().GetLastErrText();
This method includes no arguments.
The GetService method creates an instance of a business service object. It allows you to use the Invoke method to call this business service object. It uses the following syntax:
SiebelApp.S_App.GetService("business_service_name");
where:
business_service_name is a string that identifies the name of the business service that GetService uses to create the business service object. You must use the same name that you use when you register this business service. For more information about registering a business service, and for an example that uses the GetService method, see "Using Custom Siebel Business Services".
The following example creates a business service instance of the LS Pharma Validation Service business service:
var service = SiebelApp.S_App.GetService("LS Pharma Validation Service");
The LoginId method returns the login ID of the user who started the Siebel application. It uses the following syntax:
Application. LoginId()
It includes no arguments.
For example:
SiebelApp.S_App. LoginId();
The LoginName method returns the login name of the user who started the Siebel application. This login name is the name that the user enters in the login dialog box. It uses the following syntax:
Application. LoginName()
It includes no arguments.
For example:
SiebelApp.S_App. LoginName();
The Name method returns the name of the Siebel application. It uses the following syntax:
Application. Name()
It includes no arguments.
For example:
SiebelApp.S_App. Name();
The NewPropertySet method creates a new property set, and then returns this property set to the code that called this method. It uses the following syntax:
Application. NewPropertySet()
It includes no arguments.
For example:
SiebelApp.S_App. NewPropertySet();
The PositionId method returns the position ID of the user position. This position ID is the ROW_ID from the S_POSTN table. Siebel CRM sets this value when the Siebel application starts, by default. It uses the following syntax:
Application. PositionId()
It includes no arguments.
For example:
SiebelApp.S_App. PositionId();
The PositionName method returns the name of the current user position. Siebel CRM sets this value when it starts the Siebel application, by default. It uses the following syntax:
Application. PositionName()
It includes no arguments.
For example:
SiebelApp.S_App. PositionName();
This topic describes methods that you can use that reside in the Model class.
The GetLoginId method returns the login Id of the offline user who is currently logged in to the Siebel Mobile disconnected client. It uses the following syntax:
Var loginid = SiebelApp.S_App.Model.GetLoginId();
The ReleaseBO method releases the current business object instance. It returns an instance of the current applet or current business component. It uses the following syntax:
SiebelApp.S_App.Model.ReleaseBO(objBO);
where:
objBO
is a variable that identifies the business object instance that Siebel Open UI must release.
This topic describes the method that you can use that resides in the Service Model class.
The GetContext method gets the context that exists when a JavaScript service or a Siebel business service calls a method. It returns the current applet or business component depending on this context. It uses the following syntax:
serviceObj.GetContext()
You cannot configure Siebel Open UI to override this method.
This topic describes methods that you can use that reside in the offline classes. It includes the following information:
These methods reside in the OfflineAppMgr class, except for SetErrorMsg. It resides in the OfflineErrorObject class.
The setReturnValue method sets the return value that Siebel Open UI sends to the method that calls the setReturnValue method. It uses the following syntax:
$.setReturnValue(return_value)
where:
return_value identifies an object that includes the following information:
Error status of the code that Siebel Open UI called
retVal contains the return value of the code that Siebel Open UI called
For example:
$.setReturnValue({err: errCode,retVal:bRet})
where:
errCode
contains the error code that Siebel Open UI returns to the caller. For more information, see "SetErrorMsg Method".
If you do not use setReturnValue, then Siebel Open UI sends a retObj with err set to null and retVal set to empty, by default.
For examples that use the setReturnValue method, see "Registering Methods to Make Sure Siebel Open UI Runs Them in the Correct Sequence" and "SetErrorMsg Method".
The callback method registers the done handler. it uses the following syntax:
$.callback (scope,done_handler)
where:
scope identifies the object that Siebel Open UI uses to call the asynchronous method. You typically use the following scope: You typically use the following scope:
this
done_handler identifies the method that Siebel Open UI calls at the end of the asynchronous method that Siebel Open UI calls. The done_handler that Siebel Open UI registers with the callback method expects a return object. You use the setReturnValue method to return this object.
For example:
PharmaCallSubmitsvc.prototype.Submit = function () { bc.ExecuteQuery(); $.callback(this,function(retObj){ err = retObj.err;
For another example that uses this method, "Registering Methods to Make Sure Siebel Open UI Runs Them in the Correct Sequence".
The eachAsyncOp method iteratively calls an asynchronous method. It uses the following syntax:
$.eachAsyncOp(scope,configObj)
where:
configObj
identifies the configuration object. A configuration object is a type of object that includes information that Siebel Open UI uses to send as input properties to a method.
For example:
$.eachAsyncOp(this,configobj);
The eachAsyncOp method handles the done handlers for each iteration. It requires a configuration object that includes the following properties as inputs:
executeScope. Scope of the asynchronous method that Siebel Open UI must call.
execute. Asynchronous method that Siebel Open UI must call.
preExecute. Optional property that specifies the method that Siebel Open UI runs before it calls the asynchronous method. You can also use preExecute to send information that the asynchronous method requires. You must write this method so that it returns the following information:
Arguments that Siebel Open UI must send to the asynchronous method
Returns these arguments in an array.
The preExecute property can use the iteration value as an input.
postExecute. Optional property that specifies the method that Siebel Open UI runs after the asynchronous call finishes.
iterations. Optional property that specifies the total number of iterations that eachAsyncOp runs. If you do not include this property, then Siebel Open UI runs the asynchronous method only one time.
The SetErrorMsg method defines an error message for a business service that you customize. It returns nothing. It uses the following Syntax:
SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);
where:
messageKey contains the error message key. A message key is a text string that includes variable characters. %1 is an example of a variable character.
errParamArray
is an optional array that contains error properties that SetErrorMsg includes in the error message. SetErrorMsg replaces each variable character that the messageKey contains with a value from errParamArray.
For an example that uses SetErrorMsg, see "Configuring Error Messages for Disconnected Clients". For an example that uses SetErrorMsg in the context of a call to a custom business service, see "Registering Methods to Make Sure Siebel Open UI Runs Them in the Correct Sequence".
This topic describes other methods that you can use with Siebel Mobile Disconnected. It includes the following topics:
The GetBusObj method creates a new instance of a business object. It returns this new business object instance. It uses the following syntax:
SiebelApp.S_App.Model.GetBusObj(business_object_name)
where:
business_object_name identifies the name of the business object that GetBusObj uses to create the new business object instance.
For example, the following code creates a new instance of the Service Request business object:
var pServiceRequestBC = SiebelApp.S_App.Model.GetBusObj(""Service Request"")"
The GetBusObj method resides in the model.js file.
You cannot configure Siebel Open UI to override this method.
The GetLovNameVal method gets the value that Siebel Open UI currently displays in the client for a list of values. It uses the following syntax:
SiebelApp.S_App.Model.GetLovNameVal(LOV_name, LOV_type)
where:
LOV_name identifies the name of a list of values.
LOV_type identifies the type of list of values that LOV_name identifies.
For example, the following code gets the value that Siebel Open UI currently displays in the client for the Samples Request list of values:
SiebelApp.S_App.Model.GetLovNameVal(""Samples Request"", ""TODO_TYPE"")"
The GetLovNameVal method resides in the model.js file.
You cannot configure Siebel Open UI to override this method.
The GetLovValName method gets the name of a value that resides in a list of values. It uses the following syntax:
SiebelApp.S_App.Model.GetLovValName(value_name,LOV_type)
where:
value_name identifies the name of a value that resides in a list of values.
LOV_type identifies the type of list of values that contains the value that value_name contains.
For example, the following code gets the value that Siebel Open UI currently displays in the client for the Call value:
SiebelApp.S_App.Model.GetLovValName("Call","TODO_TYPE")
The GetLovValName method resides in the model.js file. You cannot configure Siebel Open UI to override this method.