How to Create and Use System Attributes

System attributes are additional fields that can be added to the following CallScripter objects; Customer, User, Campaign or Script Version to store additional information on an object by object basis.
 

Create System Attribute Definition

 
There is no front end mechanism for adding system attributes.  They are added to the CallScripter database table tbl_systemAttributeDefinitions using an insert statement:
 
Example  -------------->>
insert into tbl_systemAttributeDefinitions
values ([Object Type], [Attribute Name], [Field Type],[Default Value], [Type Data])
<<-------------- End
 
To add a system attribute, you need to add a value to tbl_systemAttributeDefinitions.
  • id                         auto generated id
  • objType              1 = user, 2 = customer, 3 = script, 4 = campaign
  • name                   The label for the attribute as it will appear in the application in its corresponding object.
  • type                     1 = text, 2 = option list, 13 = checkbox.
  • defaultValue   Can be empty but not null
  • typeData           Use only with option list type  <option value="1">1</option><option value="2">2</option><option value="3">3</option>' etc, etc
 
Once the system attribute definition has been created, the system attribute value is then available from the front end of the application for population by the users with permissions to access and edit the relevant objects.
 

System Attribute Use Example

Scenario:  You need to capture the payroll number of all agents in order to associate each script run with a payroll number.
 
1.  Create a system Attribute for called Payroll Number for each User.
2.  Populate the users system attribute
3.  Capture the system attribute in script (optional)
4.  Report on system attribute value
5.  Update one system attribute based on the value in another.
 
Create a User System Attribute Definition
Run the following  insert statement on your CallScripter database:
 
insert into tbl_systemAttributeDefinitions
values ('1', 'Payroll Number', '1', '', '')
 
 
Populate the user System Attribute
Navigate to System Manager  User Manager and select a user.  The new attribute will be shown at the foot of the standard User information, along with any other User Level system attribute definitions that already exist:
 
 
Capture the system attribute in script (optional)
Should you wish to capture a system attribute in a script run, you can do so by using a data control, e.g. Database GET, to retrieve the payroll number for the current user, i.e., the user running the script, using the following query:
 
Declare @AttributeName nvarchar(max)
Declare @ObjectType int -- User=1, 2=Customer, 3=Script, 4=Campaign
Declare @ID int -- UserID, ScriptID, CustomerID, CampaignID
 
Set @AttributeName = 'Payroll Number'
set @ObjectType = '1'
Set @ID = [var_csAgentID] --standard system variable which is auto-populated at script runtime
 
 
      select
            ad.name,
            isnull(av.value,ad.defaultvalue) as value
      from tbl_systemattributedefinitions ad with(nolock)
      left outer join tbl_systemattributevalues av with(nolock) on av.attribid = ad.id and av.objID = @ID
      where ad.name = @AttributeName
      and   ad.objType = @ObjectType