Siebel Object Interfaces Reference > Interfaces Reference > Application Methods >

SetProfileAttr Method


SetProfileAttr is used in personalization to assign values to attributes in a user profile.

Syntax

Application.SetProfileAttr(name, value)

Argument
Description

name

A string indicating the name of the attribute

value

The value of name

Returns

Not applicable

Usage

SetProfileAttr assigns the value value to the attribute in a user profile indicated by name. If the profile attribute specified in the argument string already exists, the corresponding persistent profile attribute in the application, defined in the Personalization Profile business component, is updated with the new value. If the profile attribute specified in the argument string does not exist in the list of persistent profile attributes, it is created as a dynamic profile attribute, without quotation marks encompassing the name.

In Browser Script, using SetProfileAttr() triggers a round trip to the server and back, creating a performance overhead each time it is used.

NOTE:  SetProfileAttr() cannot be used with system fields, which are not explicitly defined in the Personalization Profile business component. While GetProfileAttr() can be used with the Id field, SetProfileAttr() cannot be used with it, because attempting to change the ROW_ID column of a table will generate an error. For more information on system fields, see Configuring Siebel Business Applications.

Used With

Browser Script, COM Data Control, COM Data Server, Server Script, Java Data Bean, Mobile Web Client Automation Server

Example

The following example is in Browser Script:

function Applet_PreInvokeMethod (name, inputPropSet)

{
   if (name == "hobbyReq") {
      var hobby = theApplication().GetProfileAttr("Hobby");

      
      if (hobby == "") {
         hobby = prompt("Please enter your favorite hobby");
         theApplication().SetProfileAttr("Hobby", hobby);
      }
      return ("CancelOperation");
   }
   else
      return ("ContinueOperation");
}

This following examples show how to exchange information between applet server scripts and applet browser scripts. In an applet server script, a customer profile attribute called MyProAttr is set to "Hello World" using the SetProfileAttr method. In applet browser scripts, you can retrieve the profile attribute using GetProfileAttr method.

The following example is in Siebel eScript:

function WebApplet_PreInvokeMethod (MethodName)
{

   if (MethodName == "MyCustomMethod") {

      TheApplication().SetProfileAttr("MyProAttr", "Hello World 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

Related Topics

Name Method

For more information on user profile attributes, read Siebel Applications Administration Guide.

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.