Script to list the data fields on a Remedy Form

Here is another quick example of using PowerShell to query information from your Remedy server.

When I am developing scripts I end up spending a lot of time in Remedy Developer Studio looking at forms to find the data fields that I am interested in. There are lots of fields on a form and not all can contain data (e.g. label fields among others). It would be nice if there were an easy way to get a list of all of the fields that could contain data without having to poke around in DevStudio. This script will do exactly that.

param ($formName = "User",
       $ARServerName = "arserver.calbrosvcs.internal",
       $ARSvcAccount = "Demo", 
       $ARSvcPassword = "Password", 
       $ARAuthentication = "", 
       $ARServerPort = 51100

if ($Env:PROCESSOR_ARCHITECTURE -ne "x86") { 
  $powershell=Join-Path $PSHOME.tolower().replace("system32","syswow64") powershell.exe
  "Launching Windows Powershell (x86)..." 
  & "$powershell" -NonInteractive -ExecutionPolicy Bypass $myInvocation.Line
else { 
   # Load the ARAPI.NET classes
   add-type -path 'C:\Program Files (x86)\BMC Software\ARAPI80.NET\BMC.ARSystem.dll'

   # Login to the AR Server
   $arserver = new-object BMC.ARSystem.Server
   $arserver.Login($ARServerName, $ARSvcAccount, $ARSvcPassword, $ARAuthentication, $ARServerPort)
   [BMC.ARSystem.ARForm] $ARForm = $arserver.GetForm($formName)
   "Form Name  = {0}" -f $ARForm.Name
   "Form Type  = {0}" -f $ARForm.GetType()
   "Form Owner = {0}" -f $ARForm.Owner

   $ResultListFields = $ARForm.ResultListFields
   $ResultListFields | %{ $defaultList += ,$_.FieldId }
   $fieldOptions = @{ 1="Required"; 2="Optional"; 3="System"; 4="Display"; 5="Forced"; }
   $fields = $arserver.GetAllFields($formName)
   $fields.keys | sort | %{ 
      if ($defaultList -contains $_) { $defResult = "*" } else { $defResult = " " }
      [Int32] $op = $fields[$_].FieldOption
      if ($fields[$_].IsDataField()) { 
         "[{0:0000000000}] {1} {2,-48} {3,-8} {4}" -f $_, $defResult, $fields[$_].Name, $fieldOptions[$op], $fields[$_].GetType().Name 

In this example output the fields shown with an asterisk “*” beside them are the fields returned in the default result set if no field list is specified by the query.

Form Name  = User
Form Type  = BMC.ARSystem.RegularForm
Form Owner = ARSERVER
[0000000001]   Request ID                                       System   CharacterField
[0000000002]   Creator                                          Required CharacterField
[0000000003]   Create Date                                      System   DateTimeField
[0000000004]   Assigned To                                      Optional CharacterField
[0000000005]   Last Modified By                                 System   CharacterField
[0000000006]   Modified Date                                    System   DateTimeField
[0000000007] * Status                                           Required SelectionField
[0000000008] * Full Name                                        Required CharacterField
[0000000015]   Status History                                   System   CharacterField
[0000000101] * Login Name                                       Required CharacterField
[0000000102]   Password                                         Optional CharacterField
[0000000103] * Email Address                                    Optional CharacterField
[0000000104]   Group List                                       Optional CharacterField
[0000000108] * Default Notify Mechanism                         Optional SelectionField
[0000000109] * License Type                                     Required SelectionField
[0000000110]   Full Text License Type                           Required SelectionField
[0000000117]   Authentication Login Name                        Optional CharacterField
[0000000119]   Computed Grp List                                Optional CharacterField
[0000000122]   Application License                              Optional CharacterField
[0000000124]   Force Password Change On Login                   Optional SelectionField
[0000000126]   Last Password Change For Policy                  Optional DateTimeField
[0000000127]   Number of Warning Days                           Optional IntegerField
[0000000128]   No. Days Before Expiration                       Optional IntegerField
[0000000129]   zDays Left Before Expiration                     Optional IntegerField
[0000000130]   Account Disabled Date                            Optional DateTimeField
[0000000138]   Disable Password Management                      Optional SelectionField
[0000000139]   Days After Expiration Until Disablement          Optional IntegerField
[0000000179]   Unique Identifier                                Optional CharacterField
[0000060988]   Dynamic Group Access                             Optional CharacterField
[0301600300]   Datatag                                          Optional CharacterField
[0301628560]   Applied PasswordEnforcementEnabled               Optional SelectionField
[0301628561]   Applied Number of Warning Days                   Optional IntegerField
[0301628562]   Applied No. Days before Expiration               Optional IntegerField
[0301628563]   Applied Days After Expiration Until Disablement  Optional IntegerField
[0301628564]   Applied New User Must Change Password            Optional SelectionField
[0301628565]   zPush From Config No Set                         Display  IntegerField
[0304290290]   z1D_Service                                      Display  CharacterField
[0490000000]   Instance ID                                      Optional CharacterField
[0490000100]   Object ID                                        Optional CharacterField

I am an experienced IT technologist specializing in optimizing user experiences, providing best-in-class support and developing creative solutions. I script therefore I am. I build tools to improve troubleshooting and gather supporting data.

Tagged with: , ,
Posted in ARAPI
One comment on “Script to list the data fields on a Remedy Form

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

sean on it
Follow Sean on IT on
Blog Stats
  • 38,012 hits
The Access Onion

Access Management and Identity Federation on a plate.

The Old New Thing

Random thoughts and things I have learned in my IT journey.

Anonymous's Activities

Random thoughts and things I have learned in my IT journey.

A Community for PowerShell People

%d bloggers like this: