13Example Workflow Processes That Call a Business Service

Example Workflow Processes That Call a Business Service

Examples That Use the Server Requests Business Service

This topic describes example workflow processes that use the Server Requests business service. For more information, see Server Requests Business Service.

    Using the Server Requests Business Service to Start a Workflow Process from a Script

    The following example code uses the Server Requests business service to start a workflow process from a script and passes field values to process properties:

    //Example: Passing Field Values to Process Properties and start workflow from script 
    using the Server Request BS 
    //function Invoke_Process() 
    { 
    var svc = TheApplication().GetService("Workflow Process Manager(Server Request)"); 
    var Input = TheApplication().NewPropertySet(); 
    var Output = TheApplication().NewPropertySet(); 
    var bo = TheApplication().ActiveBusObject(); 
    var bc = bo.GetBusComp("Opportunity"); 
    var rowId = bc.GetFieldValue("Id"); 
    var accountId = bc.GetFieldValue("Account Id"); 
    Input.SetProperty("ProcessName", "My Opportunity Process"); 
    Input.SetProperty("Object Id", rowId); 
    // Pass the value of the Account Id field to the Account Id process property 
    Input.SetProperty("Account Id", accountId); 
    svc.InvokeMethod("RunProcess", Input, Output); 
    } 
    

      Using the Server Requests Business Service to Call EIM

      The example in this topic uses the Server Requests business service in a workflow process to call EIM. You can use a workflow process to start a server task. For example, you can use EIM to export base tables to IF tables or to load IF tables into base tables. Siebel CRM must pass the server component parameters that EIM requires in a child property set. You can use a wrapper business service for EIM, such as the Synchronous Assignment Manager Requests business service, or you can use the Server Requests business service.

      Because the Server Requests business service can call a variety of server tasks, it does not contain definitions for parameters that are specific to a particular server component. Instead, it passes these parameters in a child property set that is not declared in the repository. To use Siebel Workflow to pass values in a child property set, you use the following dot notation:

      [type].[property]
      

      In this example, the Server Request Manager service does not care about the child type. It uses the first child it encounters and you can pass every parameter in the same child. For example

      EIM.Config
      

      To use the Server Requests business service to call EIM

      1. In Siebel Tools,, in the Workflow Processes list, create a new workflow process using values described in the following table.

        Property

        Value

        Process Name

        EIM Export to IF (Tools)

        Business Object

        Account

        Workflow Mode

        Service Flow

        For an example, see Creating the Workflow Process.

      2. Open the Process Designer for the workflow process you defined in Using the Server Requests Business Service to Call EIM, and then create a workflow that resembles the workflow in the following figure:

        example_workflow_server_reqests.png"

        For more information, see Overview of Workflow Process Steps, and Diagramming a Workflow Process.

      3. Click the Export EIM workflow step, and then use the Properties window to define values described in the following table.

        Property

        Value

        Business Service Name

        Synchronous Server Requests

        Business Service Method

        SubmitRequest

      4. Make sure the Export EIM workflow step is still chosen in the Process Designer.

      5. In the MVPW, add a new input argument using values from the following table.

        Field

        Value

        Input Argument

        Component

        Type

        Output Argument

        Value

        EIM

        For more information, see Arguments That You Can Define for a Process Property.

      6. Add another input argument to the Export EIM workflow step using values from the following table.

        Field

        Value

        Input Argument

        EIM.Config

        Type

        Output Argument

        Value

        accnt.ifb

      7. Make sure the Server section of the client .cfg file contains the configuration described in the following table.

        Variable

        Value

        GatewayAddress

        Gateway_Machine_Name

        EnterpriseServer

        Enterprise_Server_Name

        RequestComponent

        SRMSynch

        RequestServer

        Siebel_Server_Name

      8. To prepare the workflow process for testing, set up the accnt.ifb file in the following directory:

        Siebel_Server\Admin
        
      9. Validate, and then simulate the workflow process.

        For more information, see Process of Testing a Workflow.

        If the workflow runs successfully, then it finishes without errors. Siebel CRM creates an EIM task log in the Server Tasks screen in the Siebel client each time you step through the Process Simulator.

      10. Deploy the workspace.

        After the workflow process is active, you can start it from a workflow policy, a script, or as a sub process from another workflow process. For more information, see Process of Deploying a Workflow Process.

        Examples That Use the Outbound Communications Manager Business Service

        This topic includes the following topics:

        You can configure Siebel CRM to use the Outbound Communications Manager business service to send notifications through fax or email, such as notifications to contacts or employees. For more information about methods and arguments, see Siebel CTI Administration Guide.

          Using the Outbound Communications Manager with a Substitution

          The example in this topic uses a substitution variable when it calls the Outbound Communications Manager business service in a workflow process.

          To use the Outbound Communications Manager with a substitution

          1. In Siebel Tools, create a new workflow process using values from the following table.

            Property Value

            Process Name

            Send SR Notification

            Workflow Mode

            Service Flow

            Business Object

            Service Request

            For an example, see Creating the Workflow Process.

          2. Add steps and connectors until your workflow process resembles the workflow illustrated in the following figure:

            "example_workflow_outbound_comm_mgr_substituion.png"

            For more information, see Overview of Workflow Process Steps, and Diagramming a Workflow Process.

          3. Click the Send Notification business service step, and then use the Properties window to define values described in the following table.

            Property

            Value

            Business Service Name

            Outbound Communications Manager

            Business Service Method

            SendMessage

          4. Make sure the Send Notification step is still chosen in the Process Designer.

          5. Click the MVPW, then add a new input argument using values from the following table.

            Input Argument Type Value Business Component Name

            MsgBody

            Expression

            "The Service Request Number" + [SR Number] + "was created with the abstract" + [SR Abstract]

            Service Request

            For more information, see Arguments That You Can Define for a Process Property.

          6. Add another input argument to the Send Notification step using values from the following table.

            Input Argument Type Value

            CommProfile

            Literal

            Enter the appropriate profile. The profile must correspond to a profile that the Siebel client displays in the Profiles view of the Administration-Communications, All Configurations screen. When you enter the profile, you must use the exact same format that the Siebel client uses when it displays this profile.

          7. Validate, and then simulate the workflow process.

            For more information, see Process of Testing a Workflow.

          8. Implement this configuration in your production workflow.

            Using the Outbound Communications Manager to Sendan Email to the Owner of a Product Defect

            The example in this topic uses the Outbound Communications Manager to send an email to the owner of a product defect. To develop this example, do the following tasks:

            1. Defining the Custom Recipient Group

            2. Defining the Product Defect and Employee Link

            3. Defining a Template for the Email Message

            4. Defining a Workflow Process That Calls the Email Template

              Defining the Custom Recipient Group

              This topic is a task in Using the Outbound Communications Manager to Sendan Email to the Owner of a Product Defect.

              This topic describes how to define the custom recipient group for a product defect owner. For more information, see Siebel CTI Administration Guide.

              To define the custom recipient group
              1. In the Siebel client, navigate to the Administration-Data screen, and then the List of Values view.

              2. Create a new record using values from the following table.

                Property Value

                Type

                COMM_RECIP_SRC

                Display Value

                Product Defect

                Language - Independent Code

                Product Defect

                Parent LIC

                Leave this field empty.

              3. Define a second record using values from the following table.

                Property Value

                Type

                COMM_RECIP_SRC

                Display Value

                Product Defect Owner

                Language - Independent Code

                Comm Employee

                Parent LIC

                Product Defect

              4. In Siebel Tools, make sure the Object Explorer displays the Applet Toggle object type.

              5. For more information, see Displaying Object Types You Use to Develop a Workflow Process.
              6. Navigate to the Applets list, and then query the Name column for Comm Source List Applet.

              7. Choose the Edit menu, and then click Copy Record.

              8. Define properties using values from the following table.

                Property Value

                Name

                Comm Source Product Defect List Applet

                Class

                CSSFrameListCommSrc

              9. In the Applets list, query the Name column for Comm Source List Applet, right-click the record, and then choose Lock Object.

              10. In the Object Explorer, expand the Applet tree, click Applet Toggle, and then add a new record in the Applet Toggles list using values from the following table.

                Property Value

                Applet

                Comm Source Product Defect List Applet

              11. In the Object Explorer, click Link, and then add a new record in the Links list using values from the following table. Make sure you define properties in the order that this table lists them.

                Property Value

                Name

                Comm Request/Product Defect

                Parent Business Component

                Comm Request

                Child Business Component

                Product Defect

                Inter Table

                S_COMM_REQ_SRC

                Inter Parent Column

                COMM_REQ_ID

                Inter Child Column

                SRC_ROW_ID

              12. Navigate to the Business Objects list, query the Name column for Comm Request, right-click the record, and then click Lock Object.

              13. In the Object Explorer, expand the Business Object tree, click Business Object Component, and then add a new record in the Business Object Components list using values from the following table.

                Property Value

                BusComp

                Product Defect

                Link

                Comm Request/Product Defect

                Defining a Template for the Email Message

                This topic is a task in Using the Outbound Communications Manager to Sendan Email to the Owner of a Product Defect.

                In this topic, you define a template for the email message.

                To define a template for the email message
                1. In the Siebel client, navigate to the Communications screen, and then the My Templates view.

                2. Add a new record using values from the following table.

                  Property Value

                  Name

                  eMail Notification - Product Defect

                  Channel Type

                  Email

                3. Click the Advanced view tab, and then set the Recipient Group property to Product Defect Owner.

                4. Define other information in the Advanced form, as required.

                  For more information, see Siebel CTI Administration Guide.

                  Defining a Workflow Process That Calls the Email Template

                  This topic is a task in Using the Outbound Communications Manager to Sendan Email to the Owner of a Product Defect.

                  In this topic, you define a workflow process that calls the email template.

                  To define a workflow process that calls the email template
                  1. In Siebel Tools, in the Workflow Processes list, create a new workflow process using values from the following table.

                    Property

                    Value

                    Process Name

                    Email Notification of Product Defect

                    Business Object

                    Service Request

                    Workflow Mode

                    Service Flow

                    For an example, see Creating the Workflow Process.

                  2. Open the Process Designer for the workflow process you defined and define a workflow process that resembles the workflow in the following figure:

                    "example_workflow_send_email_for_product_defect.png"

                    For more information, see Overview of Workflow Process Steps, and Diagramming a Workflow Process.

                  3. Click the Call Template step, and then use the Properties window to define values described in the following table.

                    Property Value

                    Business Service Name

                    Outbound Communications Manager

                    Business Service Method

                    CreateRequest

                  4. Make sure the Call Template step is still chosen in the Process Designer.

                  5. In the MVPW, define three new input arguments using values from the following table.

                    Input Argument Type Value

                    PackageNameList

                    Literal

                    eMail Notification - Product Defect

                    RecipientGroup

                    Literal

                    Product Defect Owner

                    RequestName

                    Literal

                    Comm Request created by AP Send Updated CR Email

                    For more information, see Arguments That You Can Define for a Process Property.

                  6. In the MVPW, define one more input argument using values from the following table.

                    Input Argument Type Value

                    SourceIdList

                    Process Property

                    Object Id

                  7. Validate, and then simulate the workflow process.

                    For more information, see Process of Testing a Workflow.

                  8. Implement this configuration in your production workflow.

                    Externalizing Properties When Using a Business Service

                    The example in this topic externalizes properties when using a business service. It topic includes the following topics:

                    The example in this topic allows a workflow process to use a business service that interacts with an external system. It does not require a repository change when migrating Siebel CRM between development, test, and production environments.

                      Overview of Externalizing Properties

                      If you migrate a repository between the development environment, test environment, and the production environment, then you must modify any workflow process that uses a business service that interacts with an external system.The EAI HTTP Transport business service is an example of a business service that interacts with an external system. The HTTPRequestURLTemplate input argument requires the URL of the external system. A workflow process that uses the EAI HTTP Transport business service references the following items:

                      • The URL for an external test system in the testing environment

                      • The URL for an external production system in the production environment

                      This example does the following work:

                      • Stores the input arguments of the business service that the workflow process uses. It stores these arguments in a file.

                        To set the input arguments of the business service, a script uses the values it reads from the file.

                        • A script on the Service_PreInvokeMethod event of the business service step reads the values of the substitutable input arguments of the business service that the workflow process uses.

                      This configuration uses values stored in files in the following ways:

                      • The file that resides on an instance of the development server contains the values for the external system that the development environment uses.

                      • The file that resides on an instance of the test server contains the values for the external system that the test environment uses.

                      • The file that resides on an instance of the production server contains the values for the external system that the production environment uses.

                      This example does not hard code values for the input arguments of the business service that the workflow process references. Instead, the script on the Service_PreInvokeMethod Event method reads the file at run time.

                      The file that this configuration uses must use a particular file name and must be available to each Siebel Server. If not, then the business service fails and Siebel Workflow creates an error at the business service step, which is the required behavior.

                      If you add a script to the Service_PreInvokeMethod event of a business service, then you must define an input argument named ExternalSystem, and the value for this argument must match the XML tag name of the child of the root element in the file. This script uses the child elements as input arguments. These child elements are children of the parent element that resides at the second level of the file.

                        Benefits of Externalizing Properties

                        You can realize the following benefits if you externalize properties:

                        • Simplifies the migration of repository workflow processes between development, test, and production environments. It is not necessary for you to modify workflow processes as you migrate them between environments.

                        • Supports current business services and future requirements.

                        • Supports business service in various workflow processes.

                        • Reduces the total cost of ownership for running the Siebel Server.

                          Defining Input Arguments for an EAI Business Service

                          The EAI HTTP Transport and EAI SQL Adapter business services include input arguments that might require changes if you migrate the repository between development, test, and production environments. The following table describes these potential changes.

                          Table Input Arguments That Might Require Changes when Migrating Repository Data

                          Business Service Business Service Method Business Service Method Input Arguments

                          EAI HTTP Transport

                          Send

                          SendReceive

                          HTTPRequestURLTemplate

                          EAI SQL Adapter

                          Query

                          ExtDBODBCDataSource

                          ExtDBPassword

                          ExtDBTableOwner

                          ExtDBUserName

                          Assume a Siebel Server includes integration points with a third party human resources or finance system. If you add a business service step in a workflow process that references the EAI HTTP Transport business service or the EAI SQL Adapter business service, then you must define the input arguments in the workflow process.

                            Example of Defining Input Arguments in an XML Hierarchy

                            The following code for an XML Hierarchy includes input arguments and input argument values for the EAI HTTP Transport business service and the EAI SQL Adapter business service. The parameters in the Finance and HR sections are for illustration purposes only. The file is named ebizint.xml:

                            <?xml version="1.0" encoding="UTF-8" ?>
                            <Systems>
                            <Finance>
                            <TargetWebAddress>http://finance</TargetWebAddress>
                            <ExtDBODBCDataSource>financesource</ExtDBODBCDataSource>
                            <ExtDBUserName>financeuser</ExtDBUserName>
                            <ExtDBPassword>financepassword</ExtDBPassword>
                            <ExtDBTableOwner>financeowner</ExtDBTableOwner>
                            </Finance>
                            <HR>
                            <TargetWebAddress>http://hr</TargetWebAddress>
                            <ExtDBODBCDataSource>hrsource</ExtDBODBCDataSource>
                            <ExtDBUserName>hruser</ExtDBUserName>
                            <ExtDBPassword>hrpassword</ExtDBPassword>
                            <ExtDBTableOwner>hrowner</ExtDBTableOwner>
                            </HR>
                            </Systems>
                            

                              Example of Defining Input Arguments in Siebel e Script

                              To define input arguments for an EAI Business Service, you can add the following example Siebel eScript code to the Service_PreInvokeMethod event of the EAI HTTP Transport business service or to the EAI SQL Adapter business service. This code uses the XML hierarchy described in Example of Defining Input Arguments in an XML Hierarchy:

                              function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
                              {
                              var ExtSystem, XMLReadSvc, XMLReadSvcInputs, XMLReadSvcOutputs;
                              var ExtSystemParent, Child
                              var errorStr;
                              try
                              {
                              XMLReadSvcInputs = TheApplication () .NewPropertySet ();
                              XMLReadSvcOutputs = TheApplication () .NewPropertySet ();
                              XMLReadSvcInputs.SetProperty("FileName�?, “C:\\ebizint.xml�?);
                              XMLReadSvcInputs.SetProperty("EscapeNames�?, “false�?);
                              XMLReadSvc = TheApplication () .GetService ("EAI XML Read from File�?);
                              ExtSystem = inputs.GetProperty (“ExternalSystem�?);
                              XMLReadSvc.InvokeMethod(“ReadXMLHier�?, XMLReadSvcInputs, XMLReadSvcOutputs);
                              //ExtSystem = {“HR�?, “Finance�?, “HRSensitive�?}
                              ExtSystemParent = XMLReadSvcOutputs.GetChild(0) .GetChild(0);
                              for (var i =0; i < ExtSystemParent.GetChildCount(); i++)
                              {
                              Child = ExtSystemParent.GetChild(i);
                              if (Child.GetType() == ExtSystem)
                              {
                              for (var j=0; j < Child.GetChildCount(); j++)
                              {
                              var ExtType = Child.GetChild(j) .GetType();
                              var ExtValue = Child.GetChild(j) .GetValue();
                              Inputs.SetProperty (ExtType, ExtValue);
                              }
                              }
                              }
                              }
                              catch (e)
                              {
                              errorStr = e.toString();
                              TheApplication () .Trace(errorStr);
                              TheApplication () .RaiseErrorText(errorStr);
                              return (CancelOperation);
                              }
                              finally
                              {
                              ExtSystem = null;
                              XMLReadSvc = null;
                              XMLReadSvcInputs = null;
                              XMLReadSvcOutputs = null;
                              ExtSystemParent = null;
                              Child = null;
                              errorStr = null;
                              }
                              return (ContinueOperation);
                              }
                              

                                Maintaining the XML File

                                If you change a value in the ebizint.xml file, then you must update this file with the correct values on the Siebel Servers. Changing the URL that references the external system is an example that requires an update to the ebizint.xml file.