The following example queries the Contact business component and retrieves the First Name and Last Name of the first contact found:
var ContactBO = TheApplication().GetBusObject("Contact");
var ContactBC = ContactBO.GetBusComp("Contact");
with (ContactBC)
{
ClearToQuery();
SetViewMode(AllView);
var fieldsPS = TheApplication().NewPropertySet();
var valuesPS = TheApplication().NewPropertySet();
fieldsPS. SetProperty("Last Name", "");
fieldsPS.SetProperty("First Name", "");
ActivateMultipleFields(fieldsPS);
ExecuteQuery();
if (FirstRecord())
{
GetMultipleFieldValues(fieldsPS, valuesPS);
var slName = valuesPS.GetProperty("Last Name");
var sfName = valuesPS.GetProperty("First Name");
}
}
Siebel book
Wednesday, July 21, 2010
Sample Script1
The following Siebel eScript example finds a contact with the Last Name = "Abanilla", and adds a new organization named "CKS Software" to its Organization MVG.
var ok = 0;
var ContactBO= TheApplication().GetBusObject("Contact");
var ContactBC = ContactBO.GetBusComp("Contact");
with (ContactBC)
{
ClearToQuery();
SetViewMode(AllView);
// Searches by Last Name
SetSearchSpec ("Last Name", "Abanilla");
ExecuteQuery();
if (FirstRecord())
{
// Instantiates Organization MVG
var oMvgBC = GetMVGBusComp("Organization");
var oAssocBC = oMvgBC.GetAssocBusComp();
oAssocBC.ClearToQuery();
oAssocBC.SetSearchSpec("Name", "CKS Software");
oAssocBC.ExecuteQuery ();
// Checks if the Organization was found
if (oAssocBC.FirstRecord())
{
// Organization was found
try
{
oAssocBC.Associate(NewAfter);
ok = 1;
}
catch (e)
{
ok = 0;
TheApplication().RaiseErrorText("Error Associating new Organization");
}
} // if oAssocBC.FirstRecord
} // if FirstRecord
} // With ContactBC
var ok = 0;
var ContactBO= TheApplication().GetBusObject("Contact");
var ContactBC = ContactBO.GetBusComp("Contact");
with (ContactBC)
{
ClearToQuery();
SetViewMode(AllView);
// Searches by Last Name
SetSearchSpec ("Last Name", "Abanilla");
ExecuteQuery();
if (FirstRecord())
{
// Instantiates Organization MVG
var oMvgBC = GetMVGBusComp("Organization");
var oAssocBC = oMvgBC.GetAssocBusComp();
oAssocBC.ClearToQuery();
oAssocBC.SetSearchSpec("Name", "CKS Software");
oAssocBC.ExecuteQuery ();
// Checks if the Organization was found
if (oAssocBC.FirstRecord())
{
// Organization was found
try
{
oAssocBC.Associate(NewAfter);
ok = 1;
}
catch (e)
{
ok = 0;
TheApplication().RaiseErrorText("Error Associating new Organization");
}
} // if oAssocBC.FirstRecord
} // if FirstRecord
} // With ContactBC
Activate Field
You must activate fields using ActivateField prior to executing a query for the business component.
By default, fields are inactive except when:
They are displayed on the applet and the business component is the instance on which the applet is based.
They are System fields (which include Id, Created, Created By, Updated, and Updated By).
Their ForceActive property is set to TRUE.
The method ActivateField has been invoked with the FieldName.
They have the Link Specification property set to TRUE.
After fields have been deactivated, the business component must be reexecuted or the application crashes.
By default, fields are inactive except when:
They are displayed on the applet and the business component is the instance on which the applet is based.
They are System fields (which include Id, Created, Created By, Updated, and Updated By).
Their ForceActive property is set to TRUE.
The method ActivateField has been invoked with the FieldName.
They have the Link Specification property set to TRUE.
After fields have been deactivated, the business component must be reexecuted or the application crashes.
How can we set focus on a different applet within a view
Place the following code from where you want the focus to shift.
ActiveApplet = theApplication().FindApplet("WM OFFR Response Lead Form Applet");
ActiveCtrl = ActiveApplet.FindActiveXControl("CallBackRequired");
Activectrl.focus();
ActiveApplet = theApplication().FindApplet("WM OFFR Response Lead Form Applet");
ActiveCtrl = ActiveApplet.FindActiveXControl("CallBackRequired");
Activectrl.focus();
Enable button based on position
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
if (MethodName == "DeleteRecord")
{
if (TheApplication().PositionName = 'Siebel Administrator')
{
CanInvokeMethod = "FALSE"
}
return (CancelOperation);
}
}
{
if (MethodName == "DeleteRecord")
{
if (TheApplication().PositionName = 'Siebel Administrator')
{
CanInvokeMethod = "FALSE"
}
return (CancelOperation);
}
}
Named Method
From Siebel 7.7 ownwards there is one more method by which we can invoke a workflow. That way is Siebel business Component user property. You can ‘Named Methodn‘ user property in a BC which can invoke a workflow where n is increment to the last named method user property defined on that BC.
Name: Named Method
Value:[Event Name] , “INVOKESVC”, , “Workflow Process Manager”, “RunProcess”, ‘ProcessName’,[Name of the Workflows] , ‘RowId’, [Row Id Value]Example The below mentioned will invoke a workflow named ‘Example Workflow’ when a new record is created in Example BC.
Name: Named Method 1
Value: “New Record”, “INVOKESVC”, “Example”, “Workflow Process Manager”, “RunProcess”, “‘ProcessName’”, “Example Wrokflow”, “‘RowId’”, “[Id]”
Name: Named Method
Value:[Event Name] , “INVOKESVC”, , “Workflow Process Manager”, “RunProcess”, ‘ProcessName’,[Name of the Workflows] , ‘RowId’, [Row Id Value]Example The below mentioned will invoke a workflow named ‘Example Workflow’ when a new record is created in Example BC.
Name: Named Method 1
Value: “New Record”, “INVOKESVC”, “Example”, “Workflow Process Manager”, “RunProcess”, “‘ProcessName’”, “Example Wrokflow”, “‘RowId’”, “[Id]”
Link Specification
Link Specification property should only be set to True if the field on the BC is used by child BC where:
1. The child BC field references the parent field in the Calculated Value, Post Default Value or PreDefault Value using the syntax: Parent: 'BusComp.Field', 'BusComp.Field'; or
2. The child BC references the parent field in a BC User Property: Parent Read Only Field.
3. If ParentFieldValue function is used to obtain the value of the parent BC field.
1. The child BC field references the parent field in the Calculated Value, Post Default Value or PreDefault Value using the syntax: Parent: 'BusComp.Field', 'BusComp.Field'; or
2. The child BC references the parent field in a BC User Property: Parent Read Only Field.
3. If ParentFieldValue function is used to obtain the value of the parent BC field.
Subscribe to:
Posts (Atom)