9Customizing Siebel Open UI for Siebel Mobile Disconnected

Overview of Customizing Siebel Open UI for Siebel Mobile Disconnected

This topic describes an overview of customizing Siebel Open UI for Siebel Mobile Disconnected. It includes the following information:

Operations You Can Customize When Clients Are Offline

You can customize the following operations when the client is offline:

  • Create, read, update, and delete parent objects and child objects.

  • Modify user interface behavior according to data characteristics, such as read only, required, and can invoke. Siebel Open UI uses the IsReadonly, IsRequired, and CanInvoke methods to achieve this behavior.

You can customize the following items when the client is offline:

  • Association applets

  • Applet menu and applet menu items

  • Pick applets

  • Picklists

  • Static picklists

  • Error statuses

  • Static drill downs

  • Expressions

  • Searches

Operations You Cannot Customize When Clients Are Offline

You cannot customize the following operations when the client is offline:

  • Multivalue fields.

  • Multivalue groups.

  • Dynamic controls. A dynamic control is a type of control that Siebel Open UI creates dynamically at run time. The Siebel repository does not specify a dynamic control. For example, a view might contain a placeholder for a control that Siebel Open UI dynamically creates and displays at run time.

  • Dynamic drilldowns.

  • Toggle applets.

  • Language-dependent code conversion to language-independent code. The Siebel Server does this conversion during synchronization.

  • Custom layout modification.

  • Effective dating. The Siebel EAI Adapter allows Siebel Open UI to access effective dating data. Effective dating data is data that identifies the start date and the end date for a field or link. A third-party application can request and receive effective dating data from the Siebel application. For more information about effective dating, see Overview: Siebel Enterprise Application Integration and Siebel Public Sector Guide.

  • Siebel Application Response Measurement (SARM) usage.

  • Siebel eScript or Siebel Visual Basic usage. Scripts that reside on the Siebel Server do not work in an offline client, so you must migrate them to JavaScript that resides on the client. Some business service scripts do work in offline clients.

  • Drilldown visibility. Siebel Open UI comes predefined to use the visibility that the drill down definition specifies. If this definition does not exist, or if it contains no values, then Siebel Open UI uses the view to determine drilldown behavior. If the view does not specify drilldown behavior, then Siebel Open UI uses business component visibility in the following order to determine drilldown behavior:

    • SalesRep

    • Personal

    • Org

  • Numeric totals in applets. Some applets display the total for a series of numbers that reside in a column in a list applet or for all records. Siebel Open UI cannot display these totals while the client is offline.

  • COM object usage, such as run-time events, data maps, or variable maps.

  • Cascade delete.

  • Search specification on a link.

  • Sort specification that includes a date field.

  • User properties for various objects except for the user properties associated with items described in Operations You Can Customize When Clients Are Offline.

  • Default applet menu items.

  • Workflow processes.

  • CreateRecord method.

  • New record creation from an association popup applet. Siebel Open UI comes predefined to disable this creation. You can customize Siebel Open UI to enable it.

Note the following offline behaviors:

  • Siebel Open UI displays only the data that it downloads during a full download for any business component field that it populates through a join that joins different tables.

  • If more than one business component references the same table, and if Siebel Open UI modifies a business component record for one of these business components, then it does not populate this modification to the other business components until the user goes online and synchronizes the client with the Siebel Server.

  • If the Owner Delete property of a business component is set to TRUE, then the user cannot delete a record in this business component even if this user owns or creates this record. This user must go online to the delete the record. For more information about this property, see Siebel Object Types Reference.

Process of Customizing Siebel Open UI for Siebel Mobile Disconnected

It is recommended that you use the sequence of steps that this topic describes to customize Siebel Open UI to use a Siebel application in a Disconnected client. Siebel Pharma and Siebel Service are each an example of a Siebel application. To view examples that use these steps, see Customizing Siebel Pharma for Siebel Mobile Disconnected Clients and Customizing Siebel Service for Siebel Mobile Disconnected Clients.

To customize Siebel Open UIfor Siebel Mobile Disconnected

  1. Configure the manifest, if necessary.

    For more information, see Modifying Manifest Files for Siebel Mobile Disconnected.

  2. Create a new JavaScript file or copy an existing one.

    You must place all custom presentation models and physical renderers in a custom folder. For more information about this folder, see Organizing Files That You Customize.

  3. Register your custom JavaScript method or Siebel business service.

    For more information, see Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects.

  4. Add your custom code:

    1. Declare your variables.

    2. Use the CanInvokeMethod method to make sure Siebel Open UI can call your custom method or business service.

    3. Specify the logic for your custom JavaScript method or Siebel business service.

    4. Use InvokeMethod to call your custom JavaScript method or Siebel business service.

    For more information, see Using Custom JavaScript Methods.

  5. Test your modifications.

Modifying Manifest Files for Siebel Mobile Disconnected

The cache manifest file specifies the resources that Siebel Open UI must download to the disconnected client for offline use. Each application uses a separate cache manifest file that uses the following format:

application_name.manifest

where:

  • application_name identifies the name of the Siebel application, such as Siebel Service for Mobile. Siebel Open UI converts this name to lower case and replaces each space that the name contains with an underscore. For example, siebel_service_for_mobile.manifest is the cache manifest file that Siebel Open UI uses for Siebel Service for Siebel Mobile Disconnected.

Manifest files reside in the following folder on the Mobile Web Client:

\SWEApp\applicationcontainer\webapps\siebel\language_code\siebel_service_for_mobil
e.manifest

Siebel Open UI includes only the cache manifest files that it requires to support the Siebel application that you deploy.

For more information about the language_code, see Languages That Siebel Open UI Supports.

To modify manifest files for Siebel Mobile Disconnected

  1. Add resources to the cache manifest file that your application uses, as necessary.

    If your deployment requires custom resources to run an application offline, then you must add these resources to the cache manifest file that this application uses. For example, assume you must configure Siebel Open UI to run Siebel Service for Siebel Mobile Disconnected so that it can download the following resources, and then use them while the client is offline:

    • my_style.css

    • my_image.png

    • my_script.js

    In this situation, you can create a file named my_cache.manifest that includes the following information:

    CACHE MANIFEST   
    
    # 2012-4-27:v1   
    
    # Explicitly cached 'master entries'.   
    
    CACHE:   
    
    files/my_style.css   
    
    images/my_image.png   
    
    scripts/my_script.js
    

    The cache manifest file must use the HTML 5 standard. This standard allows you to run a Perl script in Step 4 that merges your custom cache manifest files into the predefined application cache manifest files. Siebel Open UI includes this script starting with the Siebel CRM 8.1.1.10 Quick Fix release.

  2. Make a backup copy of the predefined manifest file that you must modify.

    For example, siebel_service_for_mobile.manifest. You modify this file in Step 4.

    It is recommended that you do this backup because the script that you run in this task modifies the siebel_service_for_mobile.manifest file. You can use this backup if you encounter a problem when running this script.

  3. Open a Windows command line on the computer where the manifest files reside, and then navigate to the following folder:

    \SWEApp\applicationcontainer\webapps\siebel\language_code\
    

    The SWEApp folder resides on the Mobile Web Client. If you are doing this task on the Siebel Server, then navigate to the following folder:

    \<Install_Dir>\applicationcontainer\webapps\siebel\language_code
    
  4. Enter the following command:

    Perl mergemanifest.pl -s my_cache.manifest-d application_name.manifest
    

    where:

    • my_cache.manifest specifies the source manifest file. If you do not include the -s switch, then Siebel Open UI uses the custom.manifest file, by default.

    • application_name.manifest specifies the destination manifest file. You must include the -d switch.

    For example:

    Perl mergemanifest.pl -s my_cache.manifest -d siebel_service_for_mobile.manifest
    

    This command merges the custom manifest file that you modified in Step 1 into the predefined siebel_service_for_mobile.manifest file. Note the following:

    • You must run this script any time you modify your cache manifest file or do an upgrade.

    • You must make sure the source and destination files exist.

    • This script adds the CACHE, NETWORK, and FALLBACK sections that reside in the my_cache.manifest, if they exist, to the end of the corresponding sections that reside in the siebel_service_for_mobile.manifest file. Your custom entries take precedence over the predefined Oracle entries that reside in this file.

    • If a file contains more than one CACHE section, NETWORK section, or FALLBACK section, then this script merges these sections into one section. For example, if two CACHE sections exist, then this script merges these CACHE sections into a single CACHE section. This merge does not modify the sequence where the entries reside in the files.

    • The script does not add duplicate entries to the destination file. If the merge results in duplicate entries, then Siebel Open UI removes the first duplicate from the destination file. It adds this removed entry to the destination.log file that resides in the folder where the destination file resides.

    • The script does not include empty lines in the destination file.

    • This script creates the destination .log file every time it runs.

    • If the script finishes the merge, and if the result of this merge is identical to the destination file, then the script does not update the destination file, and the destination file retains its original timestamp.

Registering Methods to Make Sure Siebel Open UI Runs Them in the Correct Sequence

Siebel Mobile Disconnected uses a local database, which is a database that resides in the browser that stores the data that Siebel Open UI requires.

To register methods to make sure Siebel Open UI runs them in the correct sequence

  1. On the client computer, use a JavaScript editor to open the file that includes the business service call that you must modify.

    For more information, see Using Custom JavaScript Methods.

  2. Locate the code that includes the business service call that you must modify.

  3. You can use the ExecuteQuery and FirstRecord methods. Assume you locate the following code in Step 2:

    business_service.prototype.Submit = function () {   
      retObj = bc.ExecuteQuery();   
      err = retObj.err;   
      if(!err){   
        retObj = bc.FirstRecord();   
        if(!retObj.err){   
          //Do an operation here that sets the return value to bRet   
          return({err:false,retVal:bRet});   
        }   
      }   
      else{   
        SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);   
        return({err:true});   
      }   
    };
    
    • where business_service identifies the name of the business service that your custom code calls. For example, PharmaCallSubmitsvc.

      For more information, see SetErrorMsg Method, FirstRecord Method and ExecuteQuery Method.

      In this example, you replace the code that you located in Step 2 with the following code:

      PharmaCallSubmitsvc.prototype.Submit = function () {   
        var currRetValue={err:false}, retObj;
        retObj=bc.ExecuteQuery();
          err = retObj.err;
          if(!err){
            retObj=bc.FirstRecord();
              if(!retObj.err){   
                //Do an operation here that sets the return value to bRet
                currRetValue={err:false,retVal:bRet};
              }
            }
          else{   
            SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);
            currRetValue={err:true};
          }
        return currRetValue;
      };
      

Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects

This topic describes how to use a Siebel business service or a JavaScript service to customize a predefined, Siebel CRM applet or business component.

Customizing Predefined Business Components

The example in this topic describes how to register and call a custom JavaScript method that customizes a predefined business component. You must configure Siebel Open UI to register a custom method before Siebel Open UI can call it.

To customize predefined business components
  1. Use a JavaScript editor to create a new JavaScript file.

  2. Specify the input properties that Siebel Open UI must send to the ServiceRegistry method.

    The ServiceRegistry method uses input properties to register your custom method. For more information, see Properties You Must Include to Register Custom Business Services.

    You add the following code:

    1. Create the namespace for the JavaScript class. In this example, you create a namespace for the pharmacallsvc class:

      if (typeof (SiebelApp.pharmacallsvc) === "undefined") {   
      
        SiebelJS.Namespace('SiebelApp.pharmacallsvc');
      
    2. Define the variables:

      var oconsts = SiebelApp.Offlineconstants;   
      
      var inputObj = {};
      
    3. Specify the business component where Siebel Open UI applies your customization. In this example, you specify the Pharma Professional Call - Mobile business component:

      inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Professional Call - Mobile";
      
    4. Specify the type of object that you are customizing. In this example, you are customizing a business component:

      inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = 
      
      oconsts.get("DOUIREG_OBJ_TYPEBUSCOMP");
      
    5. Specify the name of the predefined method that you are customizing. In this example, you are customizing the WriteRecord method:

      inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "WriteRecord";
      
    6. Specify the name of the JavaScript class where the method you are customizing resides. In this example, this method resides in the pharmacallsvc class:

      inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
      
    7. Specify the name of the custom service method that contains the customization of the WriteRecord method:

      inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "WriteRecord";
      
    8. Specify the type of customization:

      inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
      
  3. Register the custom JavaScript method that you specified in Step 2. This code calls the ServiceRegistry method:

    SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
    
  4. Define the constructor:

    SiebelApp.pharmacallsvc = (function () {   
    function pharmacallsvc() {   
    }
    
  5. Extend the custom JavaScript class:

    SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
    
  6. Specify the custom WriteRecord method:

    pharmacallsvc.prototype.WriteRecord = function (psInputArgs) {//get the inputs   
    
    var psOutArgs = SiebelApp.S_App.NewPropertySet();   
    
    return psOutArgs;//return the outputs   
    };   
    return pharmacallsvc;   
    
    } ());   
    
    }
    

    The custom method must include your customization logic. This code gets the property set from the predefined WriteRecord method and uses it as input to your custom WriteRecord method. The custom WriteRecord method then returns an output property set to the predefined WriteRecord method.

    The following code is the completed code for this topic:

    if (typeof (SiebelApp.pharmacallsvc) === "undefined") {   
      SiebelJS.Namespace('SiebelApp.pharmacallsvc');   
      var oconsts = SiebelApp.Offlineconstants;   
      var inputObj = {};   
      inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Professional Call - Mobile";   
      inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = 
    oconsts.get("DOUIREG_OBJ_TYPEBUSCOMP");   
      inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "WriteRecord";   
      inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";   
      inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "WriteRecord";   
      inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");    
      SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);   
      SiebelApp.pharmacallsvc = (function () {   
      function pharmacallsvc() {   
        }   
        SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);   
        pharmacallsvc.prototype.WriteRecord = function (psInputArgs) {//get the inputs   
          var psOutArgs = SiebelApp.S_App.NewPropertySet();   
        return psOutArgs;//return the outputs   
      };   
      return pharmacallsvc;   
      } ());   
    }
    
  7. If you want Siebel Open UI to anonymously register existing applet and business component objects you can use anonymous registration. This allows administrators to have a common customization across all applets or all business components.

    For example, in order to have the ability to print or click on a specific button in any applet, the following registration will give the handle of invoke a method in any applet, because the ObjectName is deliberately omitted:

    inputArgs[oconsts.get("DOUIREG_OBJ_NAME")] = "";   
    
    inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]=oconsts.get("DOUIREG_OBJ_TYPEAPPLET");   
    
    inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";   
    
    inputArgs[oconsts.get("DOUIREG_SRVC_NAME")] = "CustomDMService";   
    
    inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethodPrint";   
    
    inputArgs[oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
    

    In this case, InvokeMethodPrint will be called for all applets as PRE whenever InvokeMethod is called for any applet.

Customizing Predefined Applets

The example in this topic registers a custom method that customizes a predefined applet. The work you do in this topic is very similar to the work you do in Customizing Predefined Business Components. The only difference occurs when you specify the input object for the applet and the type of object.

To customize predefined applets
  • Do Step 1 through Step 6 in the topic Customizing Predefined Business Components with the following differences:

    • For Step 2, Step c, in the topic Customizing Predefined Business Components specify the applet where Siebel Open UI applies your customization. In this example, you specify the Pharma Call Entry Mobile applet:

      inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";
      
    • For Step 2, Step d, in the topic Customizing Predefined Business Components specify the type of object that you are customizing. You specify an applet instead of a business component:

      inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = 
      oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
      

      The following code is the completed code for this topic:

      if (typeof (SiebelApp.pharmacallsvc) === "undefined") {   
      
        SiebelJS.Namespace('SiebelApp.pharmacallsvc');   
      
        var oconsts = SiebelApp.Offlineconstants;   
      
        var inputObj = {};   
      
        inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";   
      
        inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] =   
      
      oconsts.get("DOUIREG_OBJ_TYPEAPPLET");   
      
        inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";   
      
        inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";   
      
        inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethod";   
      
        inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");   
      
        SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);   
      
        SiebelApp.pharmacallsvc = (function () {   
      
        function pharmacallsvc() {   
      
          }   
          SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);   
      
          pharmacallsvc.prototype.InvokeMethod = function (psInputArgs) {//get the inputs   
      
            var psOutArgs = SiebelApp.S_App.NewPropertySet();   
      
          return psOutArgs;//return the outputs   
      
        };   
      
        return pharmacallsvc;   
      
        } ());   
      
      }
      

Using Custom JavaScript Methods

The example in this topic describes how to call a custom JavaScript method that does not customize a predefined method. Siebel Open UI does not require you to register a custom JavaScript method. Instead, you configure Siebel Open UI to do the following work:

  • Override the InvokeMethod to call your custom method.

  • Override the CanInvokeMethod method to enable or disable your custom method.

The offline_predefined_js_call_example.js file contains the code that this example describes. To get a copy of this file, see Article ID 1494998.1 on My Oracle Support.

To use custom JavaScript methods

  1. Use a JavaScript editor to create a new JavaScript file.

  2. Register the InvokeMethod and CanInvokeMethod methods. You add the following code:

    if (typeof (SiebelApp.pharmacallsvc) === "undefined") {   
      SiebelJS.Namespace('SiebelApp.pharmacallsvc');   
      var inputObj = {};   
      var oconsts = SiebelApp.Offlineconstants;   
      inputObj[oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";   
      inputObj[oconsts.get("DOUIREG_OBJ_TYPE")] = 
    oconsts.get("DOUIREG_OBJ_TYPEAPPLET");   
      inputObj[oconsts.get("DOUIREG_OBJ_MTHD")] = "CanInvokeMethod";   
      inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";   
      inputObj[oconsts.get("DOUIREG_SRVC_MTDH")] = "CanInvokeMethod";   
      inputObj[oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");   
      SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);   
      inputObj[oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";   
      inputObj[oconsts.get("DOUIREG_OBJ_TYPE")] = 
    oconsts.get("DOUIREG_OBJ_TYPEAPPLET");   
      inputObj[oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";   
      inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";   
      inputObj[oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethod";   
      inputObj[oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");   
      SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);   
      SiebelApp.pharmacallsvc = (function () {   
        function pharmacallsvc(pm) {   
        }   
        SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel); //Extending   
        pharmacallsvc.prototype.InvokeMethod = function (psInputArgs) {   
          var svcMthdName = "";   
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
    

    For more information about this code, see the description about the inputObj argument in ServiceRegistry Method. Also see CanInvokeMethod Method and Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects.

  3. Get the value of the MethodName argument from the psInputArgs method:

    svcMthdName = psInputArgs.GetProperty("MethodName").toString();
    
  4. Call the Submit method:

    if (svcMthdName === "Submit") {
    
      retObj=this.Submit();
    
  5. Do one of the following:

    • If InvokeMethod handles the submit call that you define in Step 4, then you use the following code to set the Invoked property to true:

          if (!retObj.err) {
            psOutArgs.SetProperty("Invoked", true);
            currRetValue=({err: "", retVal: psOutArgs});
          }
          else {
            psOutArgs.SetProperty("Invoked", true);
            currRetValue=({err: retObj.err, retVal: psOutArgs});
          }
        });
      return currRetValue;}
      
    • If InvokeMethod does not handle the submit call that you define in Step 4, then you must use the following code to configure Siebel Open UI to set the Invoked property to false. This code is required for any InvokeMethod method that you configure Siebel Open UI to override:

        else {
          psOutArgs.SetProperty("Invoked", false);
          currRetValue=({err: "", retVal: psOutArgs});
        }
        return(currRetValue);
      };
      
    • If the current, overridden CanInvokeMethod Method handles the submit call that you define in Step 4, then you must set the Invoked property to true. Siebel Open UI includes the return value in the RetVal property for the method from CanInvokeMethod. You can set this method according to your requirements:

      pharmacallsvc.prototype.CanInvokeMethod = function (psInputArgs) {
        var currRetValue={err:false}, retObj;
        var psOutArgs = SiebelApp.S_App.NewPropertySet();
        var svcMthdName = "";
        svcMthdName = psInputArgs.GetProperty("MethodName").toString();
        if (svcMthdName === "Submit") {
          psOutArgs.SetProperty("Invoked", true);
          psOutArgs.SetProperty("RetVal", true);
          currRetValue=({err: "", retVal: psOutArgs});
        }
      
  6. If the current, overridden CanInvokeMethod method does not handle the submit call, then use the following code to set the Invoked property to false:

        else {
          psOutArgs.SetProperty("Invoked", false);
          psOutArgs.SetProperty("RetVal", false);
          currRetValue=({err: "", retVal: psOutArgs});
        }
        return(currRetValue);
      };
     pharmacallsvc.prototype.Submit= function (psInputArgs) {
        var psOutArgs = SiebelApp.S_App.NewPropertySet();
        return(psOutArgs);
      };
      return pharmacallsvc;
    } ());
    

Using Custom Siebel Business Services

This topic describes how to call a Siebel business service that you customize. You must configure Siebel Open UI to register this business service before Siebel Open UI can call it.

To use custom Siebel business services

  1. Use a JavaScript editor to create a new JavaScript file.

  2. Register your custom business service. You add the following code:

    var inputObj = {};   
    inputObj[oconsts.get("DOUIREG_OBJ_NAME")]= "business_service";   
    inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "class";   
    SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
    

    where:

    • business_service identifies the name of a custom business service.

    • class identifies the JavaScript class that the custom business service references.

      For example:

      if (typeof (SiebelApp.PharmaCallValidatorsvc) === "undefined") {   
        SiebelJS.Namespace('SiebelApp.PharmaCallValidatorsvc');   
         
         var oconsts = SiebelApp.Offlineconstants;   
        var inputObj = {};   
          
        inputObj[oconsts.get("DOUIREG_OBJ_NAME")]= "LS Pharma Validation Service";   
        inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "PharmaCallValidatorsvc";   
        SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);   
        SiebelApp.PharmaCallValidatorsvc = (function () {   
         
          function PharmaCallValidatorsvc() {   
            SiebelApp.PharmaCallValidatorsvc.superclass.constructor.call(this);   
          }   
          SiebelJS.Extend(PharmaCallValidatorsvc, SiebelApp.ServiceModel);
      

      For more information about the methods that this step uses, see the following topics:

  3. Use CanInvokeMethod to determine if Siebel Open UI can call your custom business service method.

    For example, the following code determines if Siebel Open UI can call the CallValidate business service method:

    PharmaCallValidatorsvc.prototype.CanInvokeMethod = function (svcMthdName) {
      var currRetValue={err:false}, retObj;
     if (svcMthdName === "CallValidate") {
        currRetValue={ err: false, retVal: true };
        return currRetValue;
      }
      else {
        return SiebelApp.PharmaCallValidatorsvc.superclass.CanInvokeMethod.call(this, 
    svcMthdName);
      }
    };
    

    For more information about the methods that this step uses, see CanInvokeMethod Method.

  4. Depending on whether you want to make a call from service to service, or to a standalone service, use one of the following methods:

    1. To make a call from one service to another service, use InvokeMethod. This method will call your custom business service method.

      For example, the following code calls the CallValidate business service method:

          PharmaCallValidatorsvc.prototype.InvokeMethod = function (svcMthdName, 
      psinpargs) {
            var currRetValue={err:false}, retObj;
            var psOutArgs = SiebelApp.S_App.NewPropertySet();
            if (!svcMthdName) {
              currRetValue=({err: "", retVal: true});
              return currRetValue;
            }
            if (svcMthdName === "CallValidate") {
                  retObj=this.CallValidate(psinpargs);
                  psOutArgs = retObj.retVal;
                  this.CleanUp();
                  currRetValue=({err:false,retVal:psOutArgs});
                   return currRetValue;
                  }
            else {
              return 
      SiebelApp.PharmaCallValidatorsvc.superclass.InvokeMethod.call(this, 
      svcMthdName, psinpargs);
            }
          }
            PharmaCallValidatorsvc.prototype.CallValidate = function (psinpropset) {
              var currRetValue={err:false}, retObj;
              var psOutArgs = SiebelApp.S_App.NewPropertySet();
              //Some Logic
              currRetValue=({err:false,retVal:psOutArgs});
              return currRetValue;
              };
          };
        return PharmaCallValidatorsvc;
        } ());
      }
      
    2. To make a call to a standalone service use the InvokeMethod method. Use the Client- Service Call method to customize the disconnected mobile client. This allows a service call to be made from the client, typically from a physical model.

      The call from any other service file must be done as follows:

      var service = SiebelApp.S_App.GetService("LS Pharma Validation Service");var 
      outputSet = service.Invoke("CallValidate", psPropertySet);
      

      For example, the following code enables you to display the total number of products detailed in the tooltip. This would be the call from the physical model:

      var service = SiebelApp.S_App.GetService("LS Pharma Validation Service");   
      var inPropSet = SiebelApp.S_App.NewPropertySet();
      if (service) {
               retObj=currRetValue=service.InvokeMethod("CountPDMethod", inPropSet);
               var outPropSet = retObj.retVal;
      }
      

      In online mode, the call is to the standalone business service in a server, whereas in offline mode, this invokes the standalone offline business service code.

      For example, the following code is for the Sample Offline service:

      PharmaCallValidatorsvc.prototype.CanInvokeMethod = function (svcMthdName) {   
               var currRetValue={err:false}, retObj;
               if (svcMthdName === " CountPDMethod") {
                     currRetValue={ err: false, retVal: true };
                     return currRetValue;
                  }
                  else {
                     return 
      SiebelApp.PharmaCallValidatorsvc.superclass.CanInvokeMethod.call(this, 
      svcMthdName);
                  }
               };
            PharmaCallValidatorsvc.prototype.InvokeMethod = function (svcMthdName, 
      Inputs) {
               var currRetValue={err:false}, retObj;
               var psOutArgs = CCFMiscUtil_CreatePropSet();
               if (svcMthdName === " CountPDMethod") {
                  var BO = SiebelApp.S_App.GetBusObject("Pharma Professional Call - 
      Mobile");
                  var PDBC = BO.GetBusComp("Pharma Call Products Detailed");
                  PDBC.SetSearchExpr( "[Activity Id] = '" + Inputs.GetProperty("Id") + 
      "'";);
                  retObj=currRetValue=PDBC.ExecuteQuery();
                  retObj=currRetValue=PDBC.FirstRecord();
                  var result = PDBC.CountRecords();
                  Outputs.SetProperty("OutputText",result);
               }
      

For more information about the methods that this step uses, see the following topics:

Configuring Data Filters

It is recommended that you configure filters to reduce the amount of business component data that Siebel Open UI must download to do offline operations. Siebel Open UI comes predefined with a number of data filters. You can modify these filters. For more information about how to modify them, see the chapter about working with data filters in Siebel Mobile Guide: Disconnected.

Configuring Objects That Siebel Open UI Does Not Display in Clients

The Handheld Business Service only downloads fields, business component data, and business object data that Siebel Open UI displays in the client. You must configure Siebel Open UI to download these objects that it does not display in the client. To do this, you use the Settings tab of the Mobile Application view in the Administration - Siebel Remote screen in the administrative client. For more information, see the topic that describes configuring application settings in Siebel Mobile Guide: Disconnected.

Configuring Error Messages for Disconnected Clients

This topic describes how to configure Siebel Open UI to use the SetErrorMsg method in your custom code to return and display a custom error message in a disconnected client.

To configure error messages for disconnected clients

  1. Use an editor to open the file that calls a custom applet, business component, or business service.

    This is the same file that you create in Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects.

  2. Locate the code that might return an error message.

    For example, assume your deployment includes the following code, and that this code calls a method that might return an error message:

    BusComp.prototype.Caller = function ()
    
     var currRetValue={err:false}, retObj;
    
      retObj=currRetValue=this.Called();
    

    In this example, the Called method might return an error message. It calls the Caller method. These methods might reside in different locations in a production environment.

  3. Add the following code to the code that you located in Step 2:

        //Check for any errors
        if(retObj.err){
          currRetValue=retObj;
        }
        else{
          //Positive case
          currRetValue={err:false,retVal:false};
        }
      });
      return currRetValue;
    }
    

    This code determines whether or not the Called method returns an error message. If it:

    • Returns an error message, then this code calls the return value to some error.

    • Does not return an error message, then the following code sets the err return value to null:

      currRetValue={err:false,retVal :false};
      
  4. Add the following code to the code that you located in Step 3:

    BusComp.prototype.Called = function (){
      var currRetValue={err:false}, retObj;
      var errParamArray = [];
      errParamArray.push(value1, valueN);
    SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);   
    currRetValue={err:"AppropriateErrorCode",retVal:false};
    

where:

  • value1 is a property that Siebel Open UI sends to the SetErrorMsg method. You can configure Siebel Open UI to send up to eight properties.

  • messageKey is a key that Siebel Open UI maps to the message string that it displays.

    For more information, see SetErrorMsg Method.

    In this example, the following code calls the SetErrorMsg method:

    SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("AppropriateErrorCode", 
    errParamArray);
    

    The following code makes sure Siebel Open UI returns an err value. This value contains the error code:

    currRetValue = {err:"AppropriateErrorCode",retVal:false};
    
    return currRetValue;
    

    The following code is the completed code that this example uses:

    BusComp.prototype.Caller = function ()
      var currRetValue={err:false}, retObj;
      retObj=currRetValue=this.Called();
        //Check for any errors
        if(retObj.err){
          currRetValue=(retObj);
        }
        else{
          //Positive case
          currRetValue={err:false,retVal :false};
        }
      return currRetValue;
    }
    BusComp.prototype.Called = function (){
      var currRetValue={err:false}, retObj;
      var errParamArray = [];
      errParamArray.push(fieldName);
      SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("ErrorCode",   errParamArray);   
      currRetValue={err:"AppropriateErrorCode",retVal:false};
      return currRetValue;
    }
    

where:

  • ErrorCode identifies a messageKey. Siebel Open UI gets the message text for the message key from the swemessages_language_code.js file that resides in an local folder. For example, swemessages_enu.js. For more information about the language_code, see Languages That Siebel Open UI Supports.

  • fieldName identifies the name of a business component field. This field contains the values that Siebel Open UI displays in the error message. For example, the predefined BCErrNoSuchField message key includes the following message text in the swemessages_enu.js file:

    "Field '%1' not found in BusComp."
    

SetErrorMsg replaces %1 with the value that Siebel Open UI passes in the errParamArray. For example:

errParamArray.push("Name");   

SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("BCErrNoSuchField",errParamArray)

In this example, Siebel Open UI replaces "%1" with the value Name:

"Field 'Name' not found in BusComp."

About Siebel Mobile Application Logging

Users can enable logging for Siebel Mobile applications on their devices. For information about Siebel Mobile Application logging, see Siebel Mobile Guide: Disconnected.

Customizing Siebel Pharma for Siebel Mobile Disconnected Clients

This topic includes an example of customizing Siebel Pharma in Siebel Open UI for display in a Siebel Mobile Disconnected client. For more information about the functionality that these customizations modify, see the chapter that describes how to use the Siebel Mobile Disconnected Application for Siebel Pharma in Siebel Mobile Guide: Disconnected.

This topic customizes Siebel Pharma to submit a Pharma Call record depending on whether or not Siebel Open UI already submitted this call. It makes sure Siebel Open UI does not overwrite a call that it already submitted to the Siebel Server. To submit a call in Siebel Pharma, the user must do the following work:

  • Enter all information for the call.

  • Add at least one sample for the call.

  • Get the required signature for the samples that the call includes.

  • Set the status for the call to Planned or Signed.

  • Tap Submit.

Siebel Pharma locks a call after it submits this call, and then the user can no longer edit or update the call. You can modify some of this behavior. For more information about the work you do in this topic, see Process of Customizing Siebel Open UI for Siebel Mobile Disconnected. For more information about the methods that this example uses, see Methods You Can Use to Customize Siebel Mobile Disconnected.

To customize Siebel Pharma for Siebel Mobile Disconnected clients

  1. Create a new JavaScript file.

    You can use any file name that is meaningful to your deployment. For example, you can use a short name that indicates what the business service accomplishes. It is recommended that the file name end with svc.js or service.js. For example, callsvc.js. To get a copy of this file, see Article ID 1494998.1 on My Oracle Support. For more information about the folders you can use to store your customizations, see Organizing Files That You Customize.

  2. Add the following code:

    SiebelApp.pharmacallsvc = (function () {   
      function pharmacallsvc(pm) {   
      }   
      SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
    

    This code adds the pharmacallsvc method to the pharmacallsvc business service.

  3. Specify the logic for your method.

  4. Add the following code immediately after the code you added in Step 3:

    pharmacallsvc.prototype.InvokeMethod = function (psInputArgs) {
      var currRetValue={err:false}, retObj;
      var svcMthdName = "";
      var psOutArgs = SiebelApp.S_App.NewPropertySet();
      svcMthdName = psInputArgs.GetProperty("MethodName").toString();
      if (svcMthdName === "Submit") {
        retObj=currRetValue=this.Submit();
        psOutArgs.SetProperty("Invoked", true);
        currRetValue={err: false, retVal: psOutArgs};
        }
      return currRetValue;
    };
    

    This code configures Siebel Open UI to run InvokeMethod on the business service if the svcMthdName variable that you defined in Step 3 contains a value of Submit.

  5. Define the method that includes your customization logic. You add the following code immediately after the code you added in Step 4:

    pharmacallsvc.prototype.Submit = function () {
      var currRetValue={err:false}, retObj;
      var model= SiebelApp.S_App.GetModel();
      var pBusObj = model.GetBusObject("boName");
      var pBusComp = pBusObj.GetBusComp("bcName");
      var now = new Date();
      var strStatusField = pBusComp.GetUserProperty("Status Field");
      var pickName = 
    SiebelApp.S_App.GetActiveView().GetActiveApplet().GetControl("Status").GetPickAppl
    et();
      retObj=currRetValue=pBusComp.SetFieldValue(strStatusField, "submit", true);
      retObj=currRetValue=pBusComp.WriteRecord();
      return currRetValue;
    }
    

    This code defines the Submit method. It sets the value for the Status field to Submitted. It uses the following methods:

  6. Test your modifications:

    1. Tap Calls on the application banner to display the Calls list.

    2. Tap a call in the list that you know you have not submitted, and then tap Submit to submit the call.

    3. Verify that Siebel Open UI does the following:

      • Modifies the call status to Submitted.

      • Locks the call

      • Decreases the sample inventory for the sales representative according to the samples and promotional items that the call dropped off

      • Closes the call.

      • Allows you to review, but not edit the call details.

    4. Tap a call in the list that you know you have already submitted, and then tap Submit to submit the call.

      Make sure Siebel Open UI does not overwrite this call. Make sure it displays a dialog box that describes that you have already submitted this call.

Configuring Interactive Detailing in the Siebel Open UI Application for Siebel Pharma

Configuring interactive detailing involves configuring the Detail button to appear on an applet in the application. By default, the Detail button appears only for Calls in the Siebel Open UI application for Siebel Pharma. Selecting the Detail button starts the eDetailer player which is used to deliver personalized content to customers, to demonstrate information about products to customers, and to obtain feedback from customers about product presentations and personalized content delivered. For more information about using the eDetailer player in the Siebel Open UI application for Siebel Pharma, see Siebel Mobile Connector Guide.

Customizing Siebel Service for Siebel Mobile Disconnected Clients

This topic includes some examples that describe how to customize Siebel Service in Siebel Open UI for a Siebel Mobile Disconnected client. It includes the following information:

For more information about:

Allowing Users to Commit Part Tracker Records

The example in this topic describes how to enable the Commit button so that users can commit a Part Tracker record. To set the Commit Flag for a Part Tracker record, the user navigates to the Activities - Part Tracker view, chooses a Part Tracker record, and then clicks Commit. If the part is:

  • Not already committed, then Siebel Open UI commits the part.

  • Already committed, then Siebel Open UI displays a message that the part is already committed.

To allow users to commit Part Tracker records

  1. In Windows Explorer, navigate to the following folder:

    INSTALL_DIR\applicationcontainer\webapps\siebel\scripts\siebel\offline
    
  2. Copy the servicecommitpartconsumed.js file to the following folder:

    INSTALL_DIR\applicationcontainer\webapps\siebel\files\custom\
    

    For more information, see Organizing Files That You Customize.

  3. Use a JavaScript editor to open the file you created in Step 2.

  4. Locate the following code that resides near the beginning of the file:

    if (typeof (SiebelApp.commitpartconsumed) === "undefined") {   
    
    SiebelJS.Namespace('SiebelApp.commitpartconsumed');
    
  5. Add the following code immediately after the code that you located in Step 4:

    var inputArgs = {};   
      var oconsts = SiebelApp.Offlineconstants;   
      inputArgs[oconsts.get("DOUIREG_OBJ_NAME")]= "SHCE Service FS Activity Part 
    Movements List Applet - Mobile";   
    inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]= oconsts.get("DOUIREG_OBJ_TYPEAPPLET");   
      inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")]= "CommitPartMvmtClient";   
      inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]= "commitpartconsumed";   
      inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")] = "CommitPartMvmtClient";   
      inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]= null;   
        SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);
    

    This code registers the service. For more information, see ServiceRegistry Method.

  6. Add the following CanInvokeMethod method immediately after the code that you added in Step 5:

    commitpartconsumed.prototype.CanInvokeMethod = function (svcMthdName) {   
      if (svcMthdName === "CommitPartMvmtClient") {   
        return true;   
      }   
      else    
        return SiebelApp.commitpartconsumed.superclass.CanInvokeMethod.call(   
          this,svcMthdName);   
    };
    

    This code determines whether or not Siebel Open UI can call a method in the current context of the business component.

  7. Add the following InvokeMethod method immediately after the code that you added in Step 6:

    commitpartconsumed.prototype.InvokeMethod = function (svcMthdName, psinpargs) {   
      var psOutArgs = SiebelApp.S_App.NewPropertySet();   
      if (!svcMthdName) {   
        return (false);   
      }   
      if (svcMthdName === "CommitPartMvmtClient") {   
          psOutArgs = this.CommitPartMvmtClient();   
      }   
      else {   
          return SiebelApp.commitpartconsumed.superclass.InvokeMethod.call(   
            this,svcMthdName, psinpargs);   
        }   
        return (psOutArgs);   
      };
    

    This code calls the CommitPartMvmtClient service method if the user clicks the Commit button.

  8. Add the following code immediately after the code that you added in Step 7:

    commitpartconsumed.prototype.CommitPartMvmtClient = function () {   
      SiebelJS.Log('Invoked CommitPartMvmtClient Method.');   
      var pServiceInvBC;   
      var cszCommitFlag;   
      var pModel;   
    pModel = SiebelApp.S_App.Model;   
    var pServiceInvBO = pModel.GetBusObject("boName");   
    pServiceInvBC = pServiceInvBO.GetBusComp("bcName");   
    cszCommitFlag = pServiceInvBC.GetFieldValue("Commit Txn Flag");   
    if (cszCommitFlag === 'Y'){   
        SiebelJS.Log('Consumed Part Is Already In Committed State');   
      }   
      else   
      {   
        // pServiceInvBC.ActivateField("Commit Txn Flag");   
        //pServiceInvBC.UpdateRecord();   
        pServiceInvBC.SetFieldValue("Commit Txn Flag", "Y", true);   
        pServiceInvBC.WriteRecord();   
      }   
    };
    

    This code determines whether or not the record is already committed. The DoInvoke method calls the CommitPartMvmtClient method, and then the CommitPartMvmtClient method examines the value of the Commit Txn Flag field. If this value is:

    • Y. Siebel Open UI has already committed the record and displays a Consumed Part Is Already In Committed State message.

    • N. Siebel Open UI has not committed the record and writes the record to the local database.

    For more information about the methods that this code uses, see GetFieldValue Method, SetFieldValue Method, and WriteRecord Method.

Allowing Users to Return Parts

The example in this topic describes how to enable the RMA button so that a user can return a part. To return a part, the user creates a part tracker record, and then clicks the RMA button to create a Return Material Authorization (RMA) record. The work you do to allow a user to return a part is similar to the work you do to allow a user to commit a Part Tracker record. For example, registering the service, calling the CanInvoke method, DoInvoke method, and so on.

You add the code that specifies how to do the RMA return in Step 4 through Step 10. The rma_return.js file contains this code. To get a copy of this file, see Article ID 1494998.1 on My Oracle Support.

To allow users to return parts

  1. In Windows Explorer, navigate to the following folder:

    INSTALL_DIR\applicationcontainer\webapps\siebel\scripts\siebel\offline
    
  2. Use a JavaScript editor to open the servicecmtparts.js file.

  3. Add the following code to the InvokeMethod method:

    var model= SiebelApp.S_App.GetModel();   
    var pBusObj = model.GetBusObject("boName");   
    var pBusComp = pBusObj.GetBusComp("bcName");
    

    This code gets the active business component for the applet that displays the RMA button.

  4. Add the following code. This code declares the objects:

    if (typeof (SiebelApp.commitpartconsumed) === "undefined") {   
      SiebelJS.Namespace('SiebelApp.commitpartconsumed');   
      var inputArgs = {};   
      var oconsts = SiebelApp.Offlineconstants;   
        
      inputArgs[oconsts.get("DOUIREG_OBJ_NAME")]="SHCE Service FS Activity Part 
    Movements List Applet - Mobile";   
      
    inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]=oconsts.get("DOUIREG_OBJ_TYPEAPPLET");   
      inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")]="CanInvokeMethod";   
      inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]="commitpartconsumed";   
      inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")]="CanInvokeMethod";   
      inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]=oconsts.get("DOUIREG_EXT_TYPEPRE");   
      SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);   
       
      inputArgs={};   
        
      inputArgs[oconsts.get("DOUIREG_OBJ_NAME")]="SHCE Service FS Activity Part 
    Movements List Applet - Mobile";   
      
    inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]=oconsts.get("DOUIREG_OBJ_TYPEAPPLET");   
      inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")]="InvokeMethod";   
      inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]="commitpartconsumed";   
      inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")]="InvokeMethod";   
      inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]=oconsts.get("DOUIREG_EXT_TYPEPRE");   
        
      SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);   
       
      inputArgs={};
    

    For information about the methods that this code uses, see the following topics:

  5. Add the following code. This code calls the CanInvokeMethod method:

      SiebelApp.commitpartconsumed = (function () {
        function commitpartconsumed(pm) {
        }
        var commitObj = new commitpartconsumed();
        commitpartconsumed.prototype.CanInvokeMethod = function (psInputArgs) {
          var currRetValue={err:false}, retObj;
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
          var svcMthdName = "";
          svcMthdName = psInputArgs.GetProperty("MethodName").toString();
          if (svcMthdName === "CommitPartMvmtClient") {
            psOutArgs.SetProperty("Invoked", true);
            psOutArgs.SetProperty("RetVal", true);
            currRetValue={err:false,retVal:psOutArgs};
          }
          else if (svcMthdName === "OrderPartsRMA") {
            psOutArgs.SetProperty("Invoked", true);
            psOutArgs.SetProperty("RetVal", true);
            currRetValue={err:false,retVal:psOutArgs};
          }
          else{
            psOutArgs.SetProperty("Invoked", false);
            psOutArgs.SetProperty("RetVal", false);
            currRetValue={err:false,retVal:psOutArgs};
          }
          return currRetValue;
        };
    
  6. Add the following code. This code calls the InvokeMethod method:

        commitpartconsumed.prototype.InvokeMethod = function (psInputArgs) {
          var currRetValue={err:false}, retObj;
          var svcMthdName = "";
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
          svcMthdName = psInputArgs.GetProperty("MethodName").toString();
          if (svcMthdName === "CommitPartMvmtClient") {
            retObj=currRetValue=this.CommitPartMvmtClient();
            psOutArgs.SetProperty("Invoked", true);
            currRetValue={err:false,retVal:psOutArgs};
          }
          else{
            psOutArgs.SetProperty("Invoked", false);
            currRetValue={err:false,retVal:psOutArgs};
          }
          if (svcMthdName === "OrderPartsRMA") {
            retObj=currRetValue=this.OrderPartsRMA();
            psOutArgs.SetProperty("Invoked", true);
            currRetValue={err:false,retVal:psOutArgs};
          }
          else{
            psOutArgs.SetProperty("Invoked", false);
            currRetValue={err:false,retVal:psOutArgs};
          }
        return currRetValue;
      };
    
  7. Add the code that gets values for the following fields:

    • Product Id

    • Product Name

    • Used Quantity

    • Id

    • Status

    • Asset Number

    • Part Number

    You add the following code:

    commitpartconsumed.prototype.createRMAOrder = function (orderType) {
      var currRetValue={err:false}, retObj;
      var sOrderId;
      var cszOrderId;
      var sAssetNum;
      var sPartNum;
      var sStatus;
      var sProductId;
      var sProductName;
      var sQuantity;
      var sActivityPartMvmtID;
      var pModel;
      var pFSActivityPartsMovementBC;
      var pActionBC;
      var sSR_Id;
      var pServiceRequestBC;
      var pOrderEntry_OrdersBC;
      var pOrderEntry_LineItemBC;
      var errParamArray = [];
      pModel = SiebelApp.S_App.Model;
      var pBusObj = pModel.GetBusObject("boName")
      pFSActivityPartsMovementBC=pBusObj.GetBusComp("bcName");
      sOrderId=retObj.retVal;
      if (utils.IsEmpty(sOrderId)){
        retObj=currRetValue=pFSActivityPartsMovementBC.GetFieldValue("");
        var oPsDR_Header:PropertySet = 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:PropertySet = SiebelApp.S_App.NewPropertySet();
        oPsDR_Header.SetProperty("Product Id","");
        oPsDR_Header.SetProperty("Used Quantity","");
        oPsDR_Header.SetProperty("Id","");
        oPsDR_Header.SetProperty("Asset Number","");
        oPsDR_Header.SetProperty("Part Number","");
        sPartNum=retObj.retVal;
        pActionBC = 
    SiebelApp.S_App.GetActiveView().GetActiveApplet().BusComp().ParentBuscomp();
        retObj=currRetValue=pActionBC.GetFieldValue("Activity SR Id");
        sSR_Id = retObj.retVal;
        if(sSR_Id==""){
          //Activity has no associated SR... Hence the operation will be aborted   
          SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("IDS_ERR_FS_MISSING_SR", 
    errParamArray);
          currRetValue={err: "IDS_ERR_FS_MISSING_SR", retVal:""};
          return currRetValue;
        }
      }
      return currRetValue;
    }
    

    For information about the methods that this code uses, see GetFieldValue Method.

  8. Add the code that gets the parent business component and the following business components:

    • Service Request

    • Order Entry - Orders

    • Order Entry - Line Items

    This code also determines whether or not a service request is not associated with the activity. If not, then it aborts the operation. You add the following code:

    else{
      pModel = SiebelApp.S_App.Model;
      pServiceRequestBC = pModel.BusObj("Service Request").BusComp("Service Request");
      pOrderEntry_OrdersBC = SiebelApp.S_App.Model.GetBusObj("Service 
    Request").BusComp("Order Entry - Orders");
      pOrderEntry_LineItemBC = pModel.BusObj("Service Request").BusComp("Order Entry - 
    Line Items");
    //CREATE ORDER Header.
      retObj=currRetValue=pOrderEntry_OrdersBC.ExecuteQuery();
    
  9. Add the code that creates the Order Header record and sets the field values. For example, for the Order Type field. You add the following code:

    retObj=currRetValue=pOrderEntry_OrdersBC.NewRecord(true);
    sLocaleVal = SiebelApp.S_App.Model.GetLovNameVal(orderType, "FS_ORDER_TYPE");
    retObj=currRetValue=pOrderEntry_OrdersBC.SetFieldValue("Order Type", sLocaleVal, 
    true);
    retObj=currRetValue=pOrderEntry_OrdersBC.WriteRecord();
    retObj=currRetValue=pOrderEntry_OrdersBC.GetFieldValue("Id");
    sOrderItemId=retObj.retVal;
    retObj=currRetValue=pOrderEntry_OrdersBC.GetFieldValue("Id");
    m_sOrderHeaderId=retObj.retVal;
    retObj=currRetValue=pOrderEntry_LineItemBC.ExecuteQuery();
    

    For information about the methods that this code uses, see SetFieldValue Method, WriteRecord Method, NewRecord Method.

  10. Add the code that creates the order line item record, commits this record, and sets the value for the Order Item Id field in the active business component. This value is the row Id of the order header record that Siebel Open UI creates. This code sets the field value for each of the following fields:

    • Product

    • Quantity Requested

    • Asset #

    • Part #

    • Product Status Code

    • Order Header Id

    You add the following code:

    retObj=currRetValue=pOrderEntry_LineItemBC.NewRecord(true);
    retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Product Id", 
    retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Product", sProductName, 
    true);
    retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Quantity 
    Requested",sQuantity, true);
    if(!utils.IsEmpty(sAssetNum)){
      retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Asset Number", 
    sAssetNum, true);
    }
    if(!utils.IsEmpty(sPartNum)){
      retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Part Number", sPartNum, 
    true);
    }
    if(!utils.IsEmpty(sStatus)){
      retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Product Status 
    Code",sStatus, true);
    }
    retObj=currRetValue=pOrderEntry_LineItemBC.GetFieldValue("Id");
    sOrderItemId=retObj.retVal;
    retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Order Header Id", 
    m_sOrderHeaderId, true)
    retObj=currRetValue=pOrderEntry_LineItemBC.WriteRecord();
    retObj=currRetValue=pFSActivityPartsMovementBC.SetFieldValue("Order Item 
    Id",sOrderItemId, true);
    
    retObj=currRetValue=pFSActivityPartsMovementBC.WriteRecord();
    
  11. Save, and then close the servicecmtparts.js file.

  12. Test your modifications:

    1. Log in to the disconnected client.

    2. Click the Activities tab.

    3. Create an activity, and then click Part Tracker.

    4. Create a part tracker record.

    5. Click the RMA button to create a Return Material Authorization (RMA) record.

    6. Make sure Siebel Open UI creates the RMA record and displays the correct values in the fields of this record, such as the Product Id, Product Name, Used Quantity, Quantity Requested, Asset #, and so on.

Allowing Users to Set the Activity Status

The example in this topic describes how to enable the activity status so that the user can update this status during the service call life cycle. For example, a field service representative can examine an Activity that is set to Dispatched, set this status to Acknowledged to acknowledge that this representative examined the activity, set the status to EnRoute, travel to the customer site, set it to Arrive, set it to In Progress while working on the service call, and then set it to Finish after finishing the service call. Siebel Open UI includes the following status values:

  • Dispatched

  • Acknowledged

  • Declined

  • En Route

  • Arrive

  • In Progress

  • Hold

  • Resume

  • Finish

Siebel Open UI enables and disables the status depending on the current value of the status. For example, if the representative sets the status to Acknowledged, then Siebel Open UI allows the user to choose the EnRoute status and disables all other values.

The work you do to allow a user to set the status is similar to the work you do to allow a user to commit a Part Tracker record. For example, registering the service, and so on. For more information, see Allowing Users to Commit Part Tracker Records.

To allow users to set the activity status

  1. In Windows Explorer, navigate to the following folder:

    INSTALL_DIR\applicationcontainer\webapps\siebel\scripts\siebel\offline
    

    For more information about the language_code, see Languages That Siebel Open UI Supports.

  2. Use a JavaScript editor to open the serviceactstat.js file.

  3. Locate the following code:

    serviceactstat.prototype.InvokeSetActStatus=function(psInpArgs,svcMthdName){   
      var psOutArgs=SiebelApp.S_App.NewPropertySet();   
      if(!psInpArgs){   
        return (false);   
      }   
      if(psInpArgs.propArray.MethodName=="AcceptStatus")   
        {psOutArgs=this.SetActivityStatus("Acknowledged");   
      }   
      else if(psInpArgs.propArray.MethodName=="Start"||psInpArgs.propArray.   
        MethodName=="ArrivedStatus"){psOutArgs=this.SetActivityStatus("In   
        Progress","ArrivedStatus");   
      }   
      else if(psInpArgs.propArray.MethodName=="DeclineStatus"){   
        psOutArgs=this.SetActivityStatus("Declined");   
      }   
      else if(psInpArgs.propArray.MethodName=="EnrouteStatus"){   
        psOutArgs=this.SetActivityStatus("In Progress");   
      }   
      else if(psInpArgs.propArray.MethodName=="SuspendStatus"){   
        psOutArgs=this.SetActivityStatus("On Hold");   
      }   
      else if(psInpArgs.propArray.MethodName=="ResumeStatus"){   
        psOutArgs=this.SetActivityStatus("In Progress");   
      }   
      else if(psInpArgs.propArray.MethodName=="End"||psInpArgs.propArray.   
        MethodName=="FinishedStatus"){   
        psOutArgs = this.SetActivityStatus("Done","FinishedStatus");   
      }
    
  4. Add the following code immediately after the code you located in Step 3:

    serviceactstat.prototype.SetActivityStatus=function (pStatus,pDateMethodInv){
      var currRetValue={err:false}, retObj;
      SiebelJS.Log('Service Method SetActivityStatus...');
      var strstatvalue;
      var pickName;
      var pickListDef;
      var pModel;
      var pBusComp;
      pModel= SiebelApp.S_App.GetModel();
      var pBusObj = pModel.GetBusObject("boName");
      pBusComp = pBusObj.GetBusComp("bcName");
      
    pickName=SiebelApp.S_App.GetActiveView().GetActiveApplet().GetControl("Status").Ge
    tPickApplet();
      pickListDef=pickListDef = pBusComp.GetPickListInfo(pickName);
      pModel=SiebelApp.S_App.Model;
      strstatvalue=pModel.GetLovNameVal("Acknowledged", pickListDef.LOVType);
      currRetValue=pBusComp.ActivateField("Status");
      currRetValue=pBusComp.SetFieldValue("Status",strstatvalue,true);
      currRetValue=pBusComp.ActivateField("Status");
      currRetValue=pBusComp.SetFieldValue("Status",strstatvalue,true);
      if(pDateMethodInv!="")//Todo - Refine this condition for uninitialized/defined or 
    remove this condition
      {
        var now=new Date();
        if(pDateMethodInv == "ArrivedStatus") {
          currRetValue=pBusComp.SetFieldValue("Started",now,true);
          currRetValue=pBusComp.SetFieldValue("Done","",true);
        }
        else if(pDateMethodInv=="FinishedStatus") {
          currRetValue=pBusComp.SetFieldValue("Done",now,true);
          currRetValue=pBusComp.SetFieldValue("Percent Complete","100%",true);
        }
      }
      currRetValue=pBusComp.WriteRecord();
      return currRetValue;
    };
    

    For information about the methods that this code uses, see the following:

  5. Test your modifications:

    1. Log in to the disconnected client.

    2. Update the status of an activity.

      Make sure Siebel Open UI displays the correct status activity. For example, if you set the status to Acknowledged, then make sure Siebel Open UI allows you to choose the EnRoute status and disables all other values.

Methods You Can Use to Customize Siebel Mobile Disconnected

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.

Methods You Can Use in the Applet Class

This topic describes methods that you can use that reside in the Applet class. The methods are described in the following subtopics.

BusComp Method for Applets

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.

BusObject Method for Applets

The BusComp method returns the business component that the applet references. It uses the following syntax:

Applet.BusObject()

For example:

SiebelApp.S_App.FindApplet(appletName).BusObject();

The BusObject method includes no arguments.

CanInvokeMethod Method

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:

InvokeMethod Method for Applets

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.

Name Method for Applets

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.

Methods You Can Use in the Business Component Class

This topic describes methods that you can use that reside in the Business Component class. The methods are described in the following subtopics.

ActivateField Method

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.

Example

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");
bcContact.ClearToQuery();
currRetValue=bcContact.ActivateField("Login Name");
var sLoginName = "MYNAME";   
bcContact.SetSearchSpec("Login Name", sLoginName);
retObj=currRetValue=bcContact.ExecuteQuery();
if (!retObj.err) {
  model.ReleaseBO(boContact);
}

ActivateMultipleFields Method

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.

Example 1

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);
Example 2

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");
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();
  currRetValue=ContactBC.ExecuteQuery();
  if (!retObj.err) {
    retObj=currRetValue=ContactBC.FirstRecord();
    if (!retObj.err) {
      ContactBC .GetMultipleFieldValues(fieldsPS, valuesPS);
      var slName = valuesPS.GetProperty("Last Name");
      var sfName = valuesPS.GetProperty("First Name");
    }
  }
}
return currRetValue;

Associate Method

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.

ClearToQuery 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.

Example

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.

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.

Example

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");
if (bc)
  {
  bc .ClearToQuery();
  bc .SetSearchSpec ("Name", "A");
  retObj=currRetValue=bc.ExecuteQuery();
  if (!retObj.err) {
    var count = bc .CountRecords();
    currRetValue={err:false,retVal:count};
    }
  }
return currRetValue;

For more information, see ClearToQuery Method.

DeactivateFields 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.

DeleteRecord Method

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:

ExecuteQuery Method

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:

FirstRecord Method

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();

GetAssocBusComp Method

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.

Example of Using the GetAssocBusComp Method

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

GetFieldValue Method

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.

GetLinkDef 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;

GetLastErrCode Method for Business Components

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.

GetLastErrText Method for Business Components

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.

GetMultipleFieldValues Method

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.

Example of Using the GetMultipleFieldValues Method

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*");
currRetValue=ExecuteQuery();
currRetValue=FirstRecord();
// 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"));

GetPicklistBusComp Method

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.

How Siebel Open UI Uses the GetPickListBusComp Method With Constrained

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.

Configuring Siebel Open UI to Pick a Value from a Picklist

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
  1. Use a JavaScript editor to open the JavaScript file that you must modify. This file resides on the client.

  2. 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:

    retObj=currRetValue=this.GetFieldValue("City")
    if(retObj.retVal === "San Mateo")
    {
      var oBCPick = this.GetPicklistBusComp("State");
      oBCPick.SetSearchSpec("Value", "CA");
      oretObj=currRetValue=oBCPick.ExecuteQuery(ForwardOnly);
      retObj=currRetValue=oBCPick.FirstRecord();
      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.

GetSearchExpr 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.

GetSearchSpec Method

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);

GetUserProperty Method

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");

GetViewMode Method

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();

InvokeMethod for Business Components

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.

Name Method for Business Components

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.

NextRecord Method

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.

ParentBusComp Method

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()

Pick Method

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.

RefreshBusComp Method

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:

currRetValue=buscomp.InvokeMethod("RefreshBusComp");
retObj=currRetValue;
if (!retObj.err){)

It includes no arguments.

RefreshRecord Method

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:

currRetValue=buscomp.InvokeMethod("RefreshRecord");
retObj=currRetValue;
if (!retObj.err){ }

It includes no arguments.

SetFieldValue Method

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:

SetMultipleFieldValues Method

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.

Example

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.NewRecord();
currRetValue=bc.SetMultipleFieldValues(ps);
ps = null;
currRetValue=bc.WriteRecord();

SetSearchSpec Method

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.

SetViewMode 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);

UndoRecord Method

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.

UpdateRecord Method

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.

WriteRecord 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:

Example

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");
varstrDEANumber = 9089;
var strDEAExpDate = 02/12/2013;
currRetValue=bc.SetFieldValue("DEA#", strDEANumber);
retObj=currRetValue;
if (!retObj.err) {
  currRetValue=bc.SetFieldValue("DEA Expiry Date", strDEAExpDate);
  retObj=currRetValue;
  if (!retObj.err) {
    currRetValue=bc.SetFieldValue("DEA Expiry Date", strDEAExpDate);
    retObj=currRetValue;
    if (!retObj.err) {
      currRetValue=bc.WriteRecord();
    }
  }
}

Methods You Can Use in the Business Object Class

This topic describes methods that you can use that reside in the Business Object class. The methods are described in the following subtopics.

GetBusComp Method for Business Objects

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.

GetLastErrCode Method for Business Objects

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.

GetLastErrText Method for Business Objects

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.

Name Method for Business Objects

The Name method returns the name of a business object. It uses the following syntax:

BusObject.Name();

This method includes no arguments.

Methods You Can Use in the Business Service Class

This topic describes methods that you can use that reside in the Business Service class. The methods are described in the following subtopics.

Invoke Method for Business Services

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.

ServiceRegistry Method

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.

Properties You Must Include to Register Custom Business Services

The following table 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 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

The following table 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 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:

  • Use DOUIREG_OBJ_TYPEAPPLET for an applet.

  • Use DOUIREG_OBJ_TYPEBUSCOMP for a business component.

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:

  • DOUIREG_EXT_TYPEPRE. Siebel Open UI runs the custom business service method, and then runs the predefined business service method. You must configure Siebel Open UI to set the Invoked property to true after it processes DOUIREG_EXT_TYPEPRE so that it does not make any more calls to this method.

  • DOUIREG_EXT_TYPEPOST. Siebel Open UI runs the predefined business service method, and then runs the custom business service method.

Methods You Can Use in the Application Class

This topic describes methods that you can use that reside in the Application class. The methods are described in the following subtopics.

ActiveBusObject Method

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();

ActiveViewName Method

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();

CurrencyCode Method

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();

FindApplet Method

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);

GetBusObject Method

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);

GetLastErrCode Method for Applications

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.

GetLastErrText Method for Applications

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.

GetService Method

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");

LoginId Method

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();

LoginName Method

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();

Name Method for Applications

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();

NewPropertySet Method

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();

PositionId Method

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();

PositionName Method

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();

Methods You Can Use in the Model Class

This topic describes methods that you can use that reside in the Model class. The methods are described in the following subtopics.

GetLoginId Method

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();

ReleaseBO Method

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.

Methods You Can Use in the Service Model Class

This topic describes the method that you can use that resides in the Service Model class.

GetContext Method

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.

Methods You Can Use in Offline Classes

This topic describes a method you can use that resides in the offline classes. The command is described in the following section.

This method resides in the OfflineErrorObject class.

SetErrorMsg Method

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.

Other Methods You Can Use with Siebel Mobile Disconnected

This topic describes other methods that you can use with Siebel Mobile Disconnected. The methods are described in the following subtopics.

GetBusObj Method

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.

GetLovNameVal 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.

GetLovValName 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.