Siebel Mobile Connector Guide > Working with the Siebel Mobile Connector > Real-Time Access to Data >

Updating and Synchronizing Data


This section describes how to update and synchronize data by using the XML Web Interface.

Adding Records

The following procedure describes how to add records to a list. You must first navigate to a screen that allows rows to be inserted, send requests to SWE to execute a new record, and write the data to the record. The commands used are NewRecord and WriteRecord.

To add a record

  1. Login to SWE and navigate to the screen to which you want to go.

    For more information, see Logging In and Navigating to a Screen.

  2. Execute a new record by using the NewRecord command.

    Example:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=SMC+Contact+List+Applet&SWEView=SMC+Contact+View&SWENeedContext=true&SWEReqRowId=0&SWEMethod=NewRecord&SWESetMarkup=XML

    NOTE:  For a NewRecord command, the SWERowID parameter should be empty. The XML returned from this command will contain the new RowID for the record created. You will use the new RowID value returned from SWE in the next step. For an example of XML output from SWE that contains a RowID, see the example in Step 5.

  3. Fill in the fields in the user interface, and then write the data to the record. Use the WriteRecord command.

    Example:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=SMC+Contact+List+Applet&SWEView=SMC+Contact+View&SWERowId=99-4CESH&SWENeedContext=true&SWEReqRowId=1&SWEMethod=WriteRecord&Last+Name=Haven&First+Name=Chris&SWESetMarkup=XML

Modifying Records

The following procedure describes how to modify a record. You must first navigate to a screen that allows records to be modified, perform a new query, execute the query, invoke the edit record method, and write the record.

To modify a record

  1. Login to SWE and navigate to the screen, view and applet to which you want to go.

    For more information, see Logging In, Navigating to a Screen and Navigating Within a Screen.

  2. Query for the record you want to modify.

    For more information, see Querying Items.

    Caution:  If you do not use a primary key to perform the query, several records may be returned in the response. The record you want to modify may not be the one selected.

  3. Write the record. You must invoke the WriteRecord method to modify the record.

    In the following example, modify a Job Title to read QA:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=SMC+Contact+List+Applet&SWEView=SMC+Contact+View&SWERowId=99-27NLD&SWENeedContext=true&SWEReqRowId=1&SWEMethod=WriteRecord&SWESetMarkup=XML&Job+Title=QA

    In the following example modify a record with the fields Job Title, Work Phone #, and Email Address:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=SMC+Contact+List+Applet&SWEView=SMC+Contact+View&SWERowId=99-27NLD&SWENeedContext=true&SWEReqRowId=1&SWEMethod=WriteRecord&SWESetMarkup=XML&Job+Title=QA+Engineer&Work+Phone #=4255551212&Email+Address=someone@siebel.com

Deleting Records

The following procedure describes how to delete a record. You must first navigate to a screen that allows records to be modified, perform a new query, execute the query, and delete the selected record.

To delete a record

  1. Login to SWE and navigate to the screen, view and applet to which you want to go.

    For more information, see Logging In, Navigating to a Screen and Navigating Within a Screen.

  2. Query for the record you want to delete.

    For more information, see Querying Items.

    Caution:  If you do not use a primary key to perform the query, several records may be returned in the response. The record you want to delete may not be the one selected.

  3. Delete the selected record by using the DeleteRecord to access the record by its primary key (in this case, the RowID).

    Example:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=SMC+Contact+List+Applet&SWEView=SMC+Contact+View&SWERowId=0-10LMD&SWENeedContext=true&SWEReqRowId=0&SWEMethod=DeleteRecord&SWEC=5

Synchronizing Records One-Way

In some instances, a third-party application may require that a local copy of a subset of Siebel data be synchronized with data residing on the third-party application server. Such one-way synchronization of records must be handled by third-party applications. It is necessary for such applications to track the date and time that a user last synchronized data on the mobile device with the application server, and the date stamp must be passed in the GetSMCUpdate method to obtain any changed records since the date stamp.

An example of how synchronization could be used is a voice application. In order to recognize unique names or words (such as accounts or contacts), the speech recognition system must compile these words into phonemes. This is usually done on a batch process based on how frequently the data is expected to change. Using the GetSMCUpdate method, you can compile a smaller subset of information for a user giving them the ability to get real-time information from the Siebel eBusiness application.

For more information about the GetSMCUpdate method, see GetSMCUpdate.

NOTE:  The ability to automatically synchronize data records is a feature that may be available in future releases of the Siebel Mobile Connector.

Uploading Files

Applications may require that files be uploaded to the Siebel database. For example, mobile voice applications may allow users to update descriptions or add comments by capturing speech in an audio file and attaching it to the record.

NOTE:  This procedure cannot be done by sending HTTP requests in a browser. Instead, uploading files must be done programmatically, so the application that uploads the files can modify the Content-Type of the HTTP request and send the file according in the appropriate format for file uploads.

To upload a file

  1. Log in to SWE and navigate to the screen, view and applet to which you want to go.

    For more information, see Logging In, Navigating to a Screen and Navigating Within a Screen.

    The Content-Type of the HTTP request must be set to application/x-www-form-urlencoded for each step of this procedure, except where noted.

  2. Create a new record by invoking the NewRecord method to make a record for the file you want to attach.

    In the following example Content-Type is application/x-www-form-urlencoded:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=Account+Attachment+Applet&SWEView=Account+Attachment+View&SWERowId=&SWENeedContext=true&SWERowIds=SWERowId0=10-5NIG6U&SWEReqRowId=0&SWEMethod=NewRecord&SWEC=3&SWESetMarkup=XML

    NOTE:  The SWERowId parameter is not required here and can be empty (a value for this parameter will be returned). However, SWERowId0 is a required parameter. SWERowID0 is the id of the parent row and SWERowId is the child's id. The Row IDs of the parent and child can be obtained from the XML output returned from the previous request.

  3. Edit the field by invoking the EditField method and modifying the record for the file you want to attach.

    In the following example, Content-Type is application/x-www-form-urlencoded:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=Account+Attachment+Applet&SWEW=0&SWEView=Account+Attachment+View&SWERowId=&SWEField=AccntFileName&SWEDIC=true&SWENeedContext=true&SWERowIds=SWERowId0=10-5NIG6U&SWEH=0&SWEReqRowId=1&SWESP=true&SWEMethod=EditField&SWEC=4&SWESetMarkup=XML

    NOTE:  You will need to supply the SWERowID parameter returned in the XML output from Step 2. SWE requests that require a RowID will not work if the SWERowId parameter is not supplied.

  4. Attach the file to the record by invoking the WriteRecord method. Set the Content-Type of the HTTP request containing the attachment to multipart/form-data for this step of the procedure.

    In the following example, Content-Type is multipart/form-data:

    Content-Type: multipart/form-data; boundary=BbC04y

    --BbC04y

    Content-Disposition: name="SWECmd"

    InvokeMethod

    --BbC04y

    Content-Disposition: name="SWEApplet"

    File Popup Applet

    --BbC04y

    Content-Disposition: name="SWEView="

    Account Attachment View

    --BbC04y

    Content-Disposition: name="SWERowId"

    10-5O167A

    --BbC04y

    Content-Disposition: name="SWENeedContext"

    false

    --BbC04y

    Content-Disposition: name="SWERowIds"

    SWERowId0=10-5NIG6U

    --BbC04y

    Content-Disposition: name="SWEReqRowId"

    1

    --BbC04y

    Content-Disposition: name="SWEP"

    19_Account+Attachment+Applet9_EditField9_10-5O167AD_AccntFileName1_4

    --BbC04y

    Content-Disposition: name="SWEMethod"

    WriteRecord

    --BbC04y

    Content-Disposition: name="SWESetMarkup"

    XML

    --BbC04y

    Content-Disposition: name="SWEC"

    4

    --BbC04y

    Content-Disposition: name="_SweFileName"; filename="file1.txt"

    Content-Type: text/plain

    ... contents of file1.txt ...

    --BbC04y--

    TIP:  For additional information about HTTP file uploads, the relationship between multipart/form-data and other content types, performance issues, and so on, see the documentation available at http://www.w3.org/.

  5. After you upload the file, examine the XML content of the user data you get back from SWE and make a note of the SWERowId parameter.

    You will need the value of this parameter in the next step.

    In the following example, the RowId is 10-5O167A:

    - <ROW ROWID="10-5O167A" SELECTED="TRUE">

    <FIELD VARIABLE="AccntFileName" NAME="AccntFileName" />

    <FIELD VARIABLE="AccntFileSize" NAME="AccntFileSize" />

    <FIELD VARIABLE="AccntFileExt" NAME="AccntFileExt" />

    <FIELD VARIABLE="AccntFileDate" NAME="AccntFileDate" />

    <FIELD VARIABLE="AccntDockStatus" NAME="AccntDockStatus"><img width="11" alt="ENU_white.gif" src="images/white.gif" border="0" height="11"/></FIELD>

    <FIELD VARIABLE="AccntFileDockReqFlg" NAME="AccntFileDockReqFlg" />

    <FIELD VARIABLE="AccntFileAutoUpdFlg" NAME="AccntFileAutoUpdFlg" />

    <FIELD VARIABLE="Comment" NAME="Comment" />

    </ROW>

    NOTE:  Remember that SWERowId=10-5O167A. Also, that in the XML output there is no data in the FIELD tags because this is a new form and the user has not entered any data.

    TIP:  After you upload the file, you can also verify that the filename is present in the XML file you get back from SWE.

  6. Save the record by invoking the WriteRecord method with the value of the SWERowId parameter that you noted in the Step 5.

    In the following example, Content-Type is application/x-www-form-urlencoded:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=Account+Attachment+Applet&SWEView=Account+Attachment+View&SWERowId=10-5O167A&SWENeedContext=true&SWERowIds=SWERowId0=10-5NIG6U&SWEReqRowId=1&SWEMethod=WriteRecord&SWEC=5&SWESetMarkup=XML

    NOTE:  Be sure to set the HTTP Content-Type to application/x-www-form-urlencoded for this step.

Downloading Files

Applications may require that files be downloaded from the Siebel database to a mobile device or other platform. For example, mobile voice applications may allow users to listen to voice recordings stored as audio files.

To download a file

  1. Log in to SWE and navigate to the screen, view and applet to which you want to go.

    For more information, see Logging In, Navigating to a Screen and Navigating Within a Screen.

    The Content-Type of the HTTP request must be set to application/x-www-form-urlencoded for each step of this procedure, except where noted.

  2. Drill down in the record containing the attached file by invoking the Drilldown method and passing the value of the SWERowId parameter.

    Example:

    http://localhost/smc_enu/start.swe?SWECmd=InvokeMethod&SWEApplet=Account+Attachment+Applet&SWEView=Account+Attachment+View&SWERowId=10-5O167A&SWENeedContext=true&SWERowIds=SWERowId0=10-5NIG6U,SWERowId1=&SWEReqRowId=1&SWEMethod=Drilldown&SWEC=3&SWEField=AccntFileName&SWESetMarkup=XML

    NOTE:  SWERowID0 is the Row ID of the parent row and SWERowId is the child's ID. The Row IDs of the parent and child can be obtained from the XML output returned from the previous request. SWE requests that require a Row ID will not work if the SWERowId parameter is not supplied.

Siebel Mobile Connector Guide