GotoView Method for an Application

The GotoView method does the following work:

  1. Deactivates any business object, business component, applet, or control that is active.

  2. Activates a view.

  3. Creates an instance of the business object that the view references. This business object instance becomes the active business object.

  4. Activates the primary applet of the view and the business component that this applet references.

  5. Activates the first tab sequence control of the primary applet.

This method does not return any information.

Format

Application.GotoView(ViewName[, BusinessObjectName])

The following table describes the arguments for the GotoView method.

Argument Description

ViewName

The name of the view that the Siebel application must display.

BusinessObjectName

Optional. The business object that Siebel CRM uses to display the view. You cannot specify the current active business object. If you do not provide this argument, or if you specify Nothing in this argument, then Siebel CRM activates a new business object in the normal way.

Usage

If an instance of the business object does not exist, then you must set the value for the BusinessObjectName argument to Nothing.

You cannot use the GotoView method in the following events:

  • Application_Navigate

  • Application_PreNavigate

  • Application_Start

  • Navigate

  • PreNavigate

  • WebApplet_Load

The following Siebel VB script uses GotoView to programmatically navigate to the Opportunity List view:

TheApplication.GotoView "Opportunity List View", Nothing

If your Siebel application already started an instance of an Opportunity object with the object reference of objOppty, then the following usage in Siebel VB is acceptable:

TheApplication.GotoView "Opportunity List View", objOppty

If you use the GotoView method in a Siebel VB or Siebel eScript script, then Siebel CRM runs the method last. This situation is true regardless of where you use this method in the script.

If script on a control uses the GotoView method, then do not set the Show Popup property on this control to TRUE. If you set the Show Popup to TRUE in this situation, then Siebel CRM opens the view in a new browser window. You cannot use a Multiple Document Interface (MDI) with the Siebel client, so you cannot use this configuration.

Used With

Server Script

Examples

The following examples use the GoToView method with and without the optional business object parameter.

The following example is in Siebel eScript:

function BusComp_WriteRecord ()
{
   var leadQuality;
   var actName;
   var actBO;
   var actBC;

   //Get the lead quality for this opportunity
   leadQuality = this.GetFieldValue("Quality");
   if(leadQuality == "1-Excellent")
   {

      //If it is a excellent lead,
      //go to the account for this opportunity
      actName = this.GetFieldValue("Account");
      actBO = TheApplication().GetBusObject("Account");
      actBC = actBO.GetBusComp("Account");

      with (actBC)
      {
         SetViewMode(AllView);
         ClearToQuery();
         SetSearchSpec("Name", actName);
         ExecuteQuery(ForwardBackward);
      }

      TheApplication().GotoView("All Account List View",actBO);

   }
   else
   {
      TheApplication().GotoView("Opportunity Detail - Activities View");
   }

   actBC = null;
   actBO = null;

}

The following example is in Siebel VB:

Sub BusComp_WriteRecord
   Dim leadQuality As String
   Dim actName As String
   Dim actBO As BusObject
   Dim actBC As BusComp

   'Get the lead quality For this opportunity
   leadQuality = Me.GetFieldValue("Quality")
   If (leadQuality = "1-Excellent") Then

      'If it is an excellent lead
      'go to the account For this opportunity
      actName = Me.GetFieldValue("Account")
      Set actBO = TheApplication.GetBusObject("Account")
      Set actBC = actBO.GetBusComp("Account")

      With actBC
         .SetViewMode AllView
         .ClearToQuery
         .SetSearchSpec "Name", actName
         .ExecuteQuery
      End With

      TheApplication.GotoView "All Account List View",actBO

   Else
      TheApplication.GotoView "Opportunity Detail - Activities View"
   End If

   Set actBC = Nothing
   Set actBO = Nothing

End Sub