Build an application to facilitate creating new users
3112_100822_7.png




 

This application is created as an Application Rule that uses three new Batch Admin Scripts - VAR, ASSIGN and REPEAT

The Setup

Step 1
Inside the 332008_71852_0.jpg folder create a new folder called 332008_71923_1.jpg
Inside that folder, create two documents
332008_72013_2.pngThe contents of these two scripts are listed below.


Step 2
Create a conference called 332008_72152_3.png and set the permissions to
332008_73518_7.png

Step 3
Within the rules folder, upload New User Forms.rez (This is a settings file with two forms - 1700 and 1701)

Step 4
Create an Application Rule as follows:
332008_72529_4.png


332008_73228_5.png
332008_73338_6.png
Step 5
Adjust the Toolbar of the conference to remove all extra buttons an1d show only the relevant ones including the new toolbar button
332008_73704_8.png

Step 7 - Edit the two script documents
NewUser Script
Edit the two script documents with the following text.
Note:  This script uses the VAR and ASSIGN commands that assign values to a variable.  This is required because if the user does not enter any value into a field, the Server does not know that it exists.  Thus we check to see if any information has been entered into the field by checking if it exists.  If it doesn't, then it ASSIGNs it the value of the variable 'Empty' which has been defined as a null string by virtue of the VAR Empty command.
Simmilarly, VAR CLS=1 assigns the value of 1 to the CLS variable and that is the default for the Class field.  Even though the Class field (#1223) may appear that it has been assigned the 'Regular' Class, unless the user has specifically selected it, FirstClass does not recognize default values.

//---------- Start Script Here
ENABLEFIELDSUBSTITUTION
// Reply back to the conference with the status of the script execution
Reply "#1202 #1204 User Creation Status" "Create User" +s

// Declare a string variable that defaults to an empty String
VAR Empty
// Declare a variable that will be the default Class if the field is not touched; 1 is a Regulare User
VAR CLS = 1

// Now check every String Field on the form to see if any data has been entered.  If not, assign it the Empty string variable
If Field 1202 MISSING
Assign Empty FIELD 1202 0
EndIF
If Field 1203 MISSING
Assign Empty FIELD 1203 0
EndIF
If Field 1217 MISSING
Assign Empty FIELD 1217 0
EndIF
If Field 1205 MISSING
Assign Empty FIELD 1205 0
EndIF
If Field 1206 MISSING
Assign Empty FIELD 1206 0
EndIF
If Field 1207 MISSING
Assign Empty FIELD 1207 0
EndIF

// Check to see if the Class field has been touched.  If not, assign it the default class
IF Field 1223 MISSING
Assign CLS FIELD 1223 7
ENDIF

// Create the user - This uses the script
// ADD class userID first i last dept pw postaddr phone1 phone2
// With Field Substitution, the information is replaced with values from the fields
// Checks first to see if the user is a Remote or Regular user

IF FIELD 1223 == 5
ADD Telecom "#1201" "#1202" "#1203" "#1204" "" "#1217" "#1205" "#1206" "#1207"
ELSE
ADD Network "#1201" "#1202" "#1203" "#1204" "" "#1217" "#1205" "#1206" "#1207"
ENDIF

// Now run a second script that will loop through the groups duplication group and add them
Execute Script path desktop admin "FirstClass Applications:NewUser Scripts:ADDGroups"

//---------- End Script Here

ADDGroups Script
Note: This script uses the new REPEAT command that will repeat for the number of rows in a Duplication group.

// ------------ Start Script Here
ENABLEFIELDSUBSTITUTION
// Repeat through the Duplication group adding the group to the user
// This uses the script PGADD <userID> <GrpName>

PGADD '#1201' '#1000.-1'
REPEAT FIELD 1000.-1

// End Script Here