SetProfileAttr Method for an Application
Personalization uses the SetProfileAttr method to set a value for an attribute in a user profile. This method does not return any information.
Format
Application.SetProfileAttr(name, value)
The following table describes the arguments for the SetProfileAttr method.
Argument | Description |
---|---|
name |
A string that contains the name of the attribute. |
value |
The value of the attribute. |
Usage
The SetProfileAttr method sets the value of the value argument to an attribute in the user profile that the name argument contains. Siebel CRM does the following work:
If this attribute already exists, then Siebel CRM updates the corresponding persistent profile attribute in the Siebel application. This value is defined in the Personalization Profile business component.
If the profile attribute does not exist in the list of persistent profile attributes, then Siebel CRM creates it as a dynamic profile attribute. It does not include quotation marks at the beginning or end of the name.
For security reasons, to use SetProfileAttr in Browser Script, you must set the EditProfileAttr server parameter to True. The decision to override the default behavior must be done after careful consideration of the security risks.
If you use the SetProfileAttr method in Browser Script, then Siebel CRM performs a round trip to the Siebel Server and back to the browser each time it uses this method. This processing creates a performance overhead.
For more information about user profile attributes, see Siebel Applications Administration Guide.
Using System Fields with the SetProfileAttr Method
You cannot use the SetProfileAttr method with a system field. These fields are not explicitly defined in the Personalization Profile business component. You cannot use the SetProfileAttr method with the Id field because attempting to modify the ROW_ID column of a table creates an error. For more information about system fields, see Configuring Siebel Business Applications.
Personalization uses the GetProfileAttr method. Siebel CRM does not explicitly define system fields in the Personalization Profile business component, so you cannot use this method with a system field, except for the Id field. For more information, see Siebel Personalization Administration Guide.
Used With
Browser Script (when the EditProfileAttr server parameter is True), COM Data Control, COM Data Server, Server Script, Siebel Java Data Bean, Mobile Web Client Automation Server
Examples
The following examples exchange information between an applet Server Script and an applet Browser Script:
In the applet Server Script, Siebel CRM uses the SetProfileAttr method to set a customer profile attribute named MyProAttr to Hello World.
In the applet Browser Script, you can use the GetProfileAttr method to return the profile attribute.
The following example is in Browser Script:
function Applet_InvokeMethod(name,inputPropSet)
{
if (name == "MyCustomMethod") {
var sMessage = theApplication.GetProfileAttr("MyProAttr");
theApplication.SWEAlert(sMessage);
}
}
The following example is in Siebel eScript:
function WebApplet_PreInvokeMethod (MethodName)
{
if (MethodName == "MyCustomMethod") {
TheApplication().SetProfileAttr("MyProAttr", "Hello World Siebel eScript");
return (CancelOperation);
}
return (ContinueOperation);
}
The following example is in Siebel VB:
Function WebApplet_PreInvokeMethod (MethodName As String) As Integer
If MethodName = "MyCustomMethod" Then
TheApplication.SetProfileAttr "MyProAttr", "Hello World VB"
WebApplet_PreInvokeMethod = CancelOperation
Else
WebApplet_PreInvokeMethod = ContinueOperation
End If
End Function