Nav view search

Navigation

Search

The Exchange

The place to download pre-configured tickets, code snippets, and solutions

Back

Professional Services Library

The Professional Services Library contains many useful functions for Virtual Ticket.

Note: This solution is optimized for Virtual Ticket Developer.

If you are using Workgroups DaVinci and are planning to use a Toolbox snippet not marked as DaVinci-compatible, please check with Support for possible compatibility issues before using.

The Professional Services Library contains several library files that can be used on any Virtual Ticket form by including them at the top of the Global MetaScript of the form. To include the file, use the following syntax:

//@include "database:PS.js"

To install the Library, extract the attached files and import them into the Stored Scripts area of Virtual Ticket.

Currently, the Professional Services Library is in version 1.216.

You can download the Professional Services Library at the bottom of this page.

Revision history:

v 1.216
August 20, 2012

  • Updated GetGoogleDriveDefaultDirectory to fix the Windows 7 path

v 1.215
August 10, 2012

  • Added SetGoogleDrive, to set a Folder Mode File Collector to the Google Drive path
  • Added GetGoogleDriveDefaultDirectory to return the path of the default Google Drive directory created on the user's machine

v 1.214
July 11, 2012

  • Fixed AWS.GetCurrentTasks to also see if wf.items is an array
  • Removed call to AWS.GetCurrentTasks in AWS.StartActivity
  • Updated SetProperty bug

v 1.213
June 27, 2012

  • Added AWS.TaskExists to determine if a task exists in the workflow
  • Added functionality to AWS.Jump if the task exists

v 1.212
April 25, 2012

  • Allowed group filter in FetchUsers to be an array, for multiple groups

v 1.211
April 12, 2012

  • Depricated Has2012 (since it can only work on client side)
  • Updated SetProperty to account for this.
  • Updated AWS.GetTemplateDef for 2012
  • Updated AWS.ReturnTemplateID for 2012
  • Updated AWS.GetCurrentTasks (because of Has2012 deprication)
  • Updated AWS.SetPlanDates for 2012
  • Updated in PS_Menu.js: changed functionality once a record is deleted.

v 1.210
April 11, 2012

  • Updated SetPlanDates for 2012

v 1.209
April 3, 2012

  • Created test for 2012
  • Updated SetProperty to test if 2012 (not 2011), and correctly use the function
  • Updated AWS.GetCurrentTasks to return items based on if it is 2012 (not 2011) or not

v 1.208
March 20, 2012

  • Updated SetProperty to test if 2011, and correctly use the function
  • Updated AWS.GetCurrentTasks to return items based on if it is 2011 or not

v 1.207
February 27, 2012

  • Updated JM to include "Requests" and "New Request", for the new portals
  • Updated JM - added show_in_vt to bring up in embedded VT Web Browser - default is true
  • Updated JM - changed it so if the first parameter (id) is an object, it assumes you want to pass an object instead of the list of parameters

v 1.206
February 15, 2012

  • Updated AWS.CopySchedule to include SetCalendar
  • Updated AWS.SetPlanDates to set the plan outward from an activity
  • Added AWS.StaticActivityPlan to make an activity's plan static
  • Added PortalUserAuth that returns the auth token used by portal for autologin. Updated JM and Proofs to use this.

v 1.202
October 27, 2011

  • Fixed a bug in PS.AWS.RemoveActivity where if the activity was not found, it was still trying to remove it.

v 1.201
October 18, 2011

  • Added use_old_method parameter for CreateFolders to bypass the new folder creation core procedures.

v 1.200
October 11, 2011

  • Created AWS.SetCalendar to set a calendar to an AWS workflow. Also placed in AWS.SetTemplate to set the default calendar.

v 1.199
September 29, 2011

  • Created SetWebImage to set the background image of a box with an image from a url. Works with png and jpeg.

v 1.198
September 28, 2011

  • Created SetQR to use the Google API to set a box to a QR code
  • Widget_Calendar.js was also updated to allow old grid naming to work ("_d")

v 1.197
September 23, 2011

  • Changed SetFields to conform to the new version of VT (PS.SetProperty may not work for the time being)

v 1.196
September 19, 2011

  • Changed CreateFolder2 to correctly return the folder names if requested

v 1.195
September 8, 2011

  • Created ExclusiveSelect to allow one to select only one item in a grid

v 1.194
September 6, 2011

  • Updated testing Form, then Form.addEventListener to allow running of SetCurrentId

v 1.193
August 16, 2011

  • Changed AWS.CopySchedule to set the Template Code (wasn't being set)
  • Changed AWS.Jump to set the task to AutoStart (instead of Skip) if it was jumped to

v 1.192
August 5, 2011

  • Added a test for curr_popup !== null in LoadGridPopups

v 1.191
August 2, 2011

  • Fixed a bug in PS.JM for Workday Summary

v 1.190
July, 21 2011

  • Created AWS.StartActivity that will start an activity (not finish)

v 1.189
July, 12 2011

  • Updated MakeButton, removed objectLoaded and editingStarted style resets (similar to update to others in v 1.180)
  • Updated Widget_WindowShade.js to allow parameters

v 1.188
June 30, 2011

  • Fixed bug in PS.AWS.GetRoleActor - incorrectly referencing PS.AWS.GetRolesAndUsers, it should be PS.AWS.GetRolesAndActors
  • Added ShowHTMLInVT that will display html in a VT window
  • Added ShowMediaFile that will display a media file embedded in HTML
  • Added OpenMediaNative that will open a media file in the native application

v 1.187
June 7, 2011

  • Added MoveDRBetweenCollectors to drag a DR from one collector to another, removing it from the first one.
  • June 8, 2011 - Made change to Widget_WindowShade.js to try and make the handling of visibility more consistant

v 1.186
May 26, 2011

  • Fixed bugs in PS.AWS.SetTemplate

v 1.185
May 25, 2011

  • Updated bug in MoveFile where the old file path did not replace backslashes with forward slashes so it would work on a Mac

v 1.184
May 19, 2011

  • Reduced the size of PS.js by replacing space tabs with the tab character (similar to change made between 1.166 and 1.167) - Also made same change to Widget_Calendar.js and PS_Menu.js
  • Removed old, commented out code (in Make... functions and OpenPath)

v 1.183
May 17, 2011

  • Updated SetCurrentId, for use with Workgroups 2011
  • Updated PS_Menu.js with change to Form object

v 1.182
May 12, 2011

  • Fixed bug in AWS.SetTemplate, where it was getting the list of tasks before assigning the template, giving an incorrect list of activities to jump to

v 1.181
May 11, 2011

  • Added AssignGroupInArea to allow multi-assigning controls in an area

v 1.180
May 4, 2011

  • Removed code in Make functions (Box, Line, etc.) that resets the groups unnecessarily - caused issues with Widgets
  • Added 'true' parameter to createControlIterator items in Grouping functions (create, find, etc.)
  • Additionally, the Widget_Calendar and Widget_QuickPreview were changed to loadForm
  • Widget_WindowShade was added to the library repository

v 1.179
April 28, 2011

  • Added GetControlGroupInArea to return the controls in an area (top, left, bottom, right)
  • Added ReturnFirstGroupControl to return the first control in a group (for use with visibility, etc.)
  • Modified MoveControlGroup to allow moving horizontally or vertically by passing a null for the other value
  • Added ReturnControlGroupSize to return the dimensions of a control group, with the option for visible only (default true)
  • Modified SortColumn to fix a bug if an invalid date or time was passed

v 1.178
March 31, 2011

  • Added ability to set successor in AWS.InsertActivity
  • Added time (start and finish) to AWS.SetPlanDate

v 1.177
March 30, 2011

  • Included version 1.0.018 of grid_and_model.gsd. If this causes issues in your environment, rename grid_and_model-old.gsd and use this version (1.0.016)
  • Updated SetDRToBackground - if the preview does not exist, it will use a generic "Preview Not Available" icon
  • Updated SetDRToBackground - if the preview is not a JPG, it will use a generic "Preview Not Supported" icon
  • Fixed a bug in SetDRToBackground that aligned the graphic incorrectly if center_in_box was used
  • Moved several functions to the bottom of the library for easier viewing of the version number at the top.
  • Added GetCurrentTasks to display a mapping of the tasks that are current
  • Added force_finish to AWS.FinishActivity that will allow you to finish the activity regardless of current status
  • Added show_errors to AWS.FinishActivity that can turn errors on and off for display
  • Added smarter task finishing to AWS.FinishActivity that can finish variations of the task if it is added more than once in a schedule
  • Developed AWS.RemoveActivity that removes a specific activity
  • Developed AWS.GetStartDate and AWS.GetDueDate, along with the XDate and XTime return functions for these
  • Developed AWS.GetRolesForActivity that returns an array of the roles for an activity
  • Developed AWS.SetRoles that sets the roles for an activity
  • Developed AWS.AddRoleForActivity adds a role for an activity
  • Developed AWS.DeleteRoleForActivity that removes a role from an activity
  • Developed AWS.SetDuration that sets a duration for an activity
  • Developed AWS.ToggleEnabled that toggles the enabled status for an activity or sets it based on the passed status
  • Developed AWS.ToggleMilestone that returns an array of the roles for an activity or sets it based on the passed status

v 1.176
March 25, 2011

  • Added allow_enlargement (allow the image to be enlarged) and center_in_box (centering of an image to a box) properties to SetDRToBackground.
  • Renamed SetDRToBackground properties to be more specific.

v 1.175
March 21, 2011

  • Added SetDRToBackground to set a box's background to the preview of a passed Digital Resource ID
  • Updated Base64.js to work with the Base 64 encoding of the file for use with SetDRToBackground

v 1.174
March 10, 2011

  • Added define Server if it is not defined (mainly for backwards compatibility)

v 1.173
March 9, 2011

  • Added Convert12To24Time to convert a time string with the 12-hour format (xx:xxAM/PM) into the 24-hour format
  • Updated ColumnType, adding date and time, for use with the Grid Sort Widget
  • Updated SortColumn to allow date and time types, for use with the Grid Sort Widget

v 1.172
March 1, 2011

  • Changed items in JM to allow not passing an id

v 1.171
February 28, 2011

  • Added FinishWorkflow and Clear for AWS 5 API

v 1.170
February 22, 2011

  • Overhauled AWS 4 Facade items (Definition, Workflow, and Roles) to work with server-side scripting by passing ws_config_id_

v 1.169
February 18, 2011

  • Fixed bug in JM for Workday Summary, and added Job Charges (the summary)

v 1.168
February 3, 2011

  • Added support for PSTrace.js
  • Fixed bug in Widget_Calendar.js where "ghosting" of calendar may appear. - Feb 7, 2010

v 1.167
February 2, 2011

  • Tested to see if subfolders is empty (null or undefined) in CreateFolder2

v 1.166
January 26, 2011

  • Added parameter for Edit that allows one to open the document with a Go if the record is locked, done by default

v 1.165
January 19, 2011

  • Fixed bug in PadNumber - it was ignoring the number of places

v 1.164
January 18, 2011

  • Changed default background color for MakeLabel to transparent instead of #ffffff (white)

v 1.163
January 5, 2011

  • Changed FileNameFriendly to no longer replace single quote with two single quotes

v 1.162
January 4, 2011

  • Changed createControlFromXML to Form.createControlFromXML
  • Added Workday Summary to JM

v 1.161
December 21, 2010

  • Updated FileNameFriendly to be more in line with windows file restrictions, adding ? and ". Also added a parameter to not remove periods from the file name.

v 1.160
December 9, 2010

  • Updated AWSWorkflow.SetTemplate, AWSWorkflow.SetTemplateAndPlan, AWSWorkflow.CopySchedule, AWSWorkflow.UpdateLocals to fix location of Transaction Begin and Commit

v 1.159
December 8, 2010

  • Fixed bug in GetGroupUserIDs query for group name
  • Specified AWS 5 API functions (not yet completed, but specified):
  • RemoveActivity
  • SetDuration
  • GetRolesForActivity
  • SetRoles
    • AddRoleToActivity
    • DeleteRoleFromActivity
    • FinishWorkflow
    • GetStartDate
    • GetDueDate
    • Clear

v 1.158
November 18, 2010

  • Added ability to disable Go while editing
  • Added AWS 5 API functions:
    • Transaction
    • SaveTransaction
    • IsCurrentObject
    • TargetID
    • TargetType
    • BuildAPIObject
    • GetTemplateDef
    • ReturnTemplateID
    • SetTemplate
    • CopySchedule
    • GetTaskList
    • Jump
    • StartWorkflow
    • SetPlanDates
    • FinishActivity
    • GetRolesAndActors
    • GetRoleActor
    • AssignRoleActor
    • InsertActivity

v 1.157
November 11, 2010

  • Updated LoadGridPopups to use the field name if a filter is used (for onclick)
  • Created LoadScriptPopup to wrap LoadGridPopups for use with a single popup with a filter to be loaded onclick

v 1.156
November 9, 2010

  • Updated GetUserIDByName to use ReplaceChar to handle single quote names

v 1.155
October 28, 2010

  • Updated From to use JSON.parse as a secondary parse if grid_and_model is not loaded
  • Created PostToTwitter2, for use with OAuth authentication - requires consumer_key, consumer_secret, access_token, access_token_secret, and a message
  • Created GenerateTimestamp to return the Unix timestamp
  • Created GenerateNonce to create a nonce string for use with the Twitter API
  • Added SHA.js library to use HMAC-SHA1 encoding for PostToTwitter2

v 1.154
October 25, 2010

  • Updated SortData to allow specifying type, string or number, to allow force sorting when the type was incorrectly detected
  • Also updated Widget_Grid_Sort.js to v 1.03 to allow type specification

v 1.153
October 24, 2010

  • Corrected query in FetchUsers
  • Added items in JM for New Job Recorder, New Job Charge, and New Outside Purchase

v 1.152
October 15, 2010

  • Added SetTemplateAndPlan, to set a template and apply the plan, either by a start date or a due date

v 1.151
October 12, 2010

  • Updated DeleteRecord to allow use in server side scripts

v 1.150
September 28, 2010

  • Updated CopySchedule to fix the facade issue with UpdateExtras
  • Added EmailServerReport to use the server plugin

v 1.149
September 24, 2010

  • Updated ShowExtendedPreview to use OpenPath2 to open the generated file instead of OpenURI

v 1.148
September 24, 2010

  • Removed alert debug in RemoveComma
  • Added function IsServerSide to determine if the script is being run in the Server-Side MetaScript
  • Enhanced all error messages to use throw instead of an alert when on the server side.

v 1.147
September 20, 2010

  • Widget_Calendar.js updated
  • Fixed bug relating to large negative numbers in an XDecimalHI
  • Added DiscardKey and AddKey, to convert from/to an array of key:value pairs and an array
  • Added TotalGridColumn, passed a grid object and a column, it returns the sum
  • Added PrepareNumber to easily convert a number to an XDecimalHI
  • Created Math-related functions, to easily calculate (called by stating PS.Math.{function call}):
    • Add - Adds two numbers together, can be XDecimal or regular number
    • Subtract - Subtracts one number from another number, can be XDecimal or regular number
    • Multiply - Multiplies two numbers together, can be XDecimal or regular number
    • Divide - Divides one number into another number, can be XDecimal or regular number
    • Sum - Adds an array of numbers into one sum
    • Average - Averages an array of numbers
    • Equal (also Equals) - Compares two numbers to see if they are equal
    • NotEqual (also NotEquals) - Compares two numbers to see if they are not equal
    • GreaterThan - Compares two numbers to see if one number is greater than another number
    • LessThan - Compares two numbers to see if one number is less than another number
    • GreaterThanOrEqual - Compares two numbers to see if one number is greater than or equal to another number
    • LessThanOrEqual - Compares two numbers to see if one number is less than or equal to another number
    • Sort - Sorts a list of numbers
    • Median - Finds the median (middle number) of an array of numbers
    • Max - Returns the highest number in an array of numbers
    • Min - Returns the lowest number in an array of numbers
    • RoundUp (also Ceiling)- Rounds up to the next integer
    • RoundDown (also Floor) - Rounds down to the next integer
    • Round - Rounds a number. By default it will reound to the nearest integer. The "places" parameter allows rounding out to x number of digits (PS.Math.Round(5.552, 1) -> 5.6). A negative places number will zero out the last x number of digits (PS.Math.Round(1574, -1) -> 1570).

v 1.146
September 17, 2010

  • Added a global variable g_autogrid_factory_grids to allow you to get the grid namespace with the control_id_ (also added to the grid_and_model.gsd)

v 1.145
September 14, 2010

  • Added period (.) to FileNameFriendly
  • Added SortData, SortColumn, and ColumnType to be able to work with a grid sort solution

v 1.144
September 10, 2010

  • Added enabledEditing to MakeButton, to mimic the "Enabled During Editing" button availability

v 1.143
September 8, 2010

  • Updated Find - added operand 9 and 10
  • Updated NewFolder, NewDocType, and Edit - chromeless and singleton were not working correctly
  • Tweaked RemoveBorders to work with grid buttons in the format of "button_prefix_vGrid_1", to also allow use with action_handler_virtual

v 1.142
September 8, 2010

  • Added ability to LoadGridPopups to pass a null for the grid and fill a single popup

v 1.141
September 7, 2010

  • Added a grid refresh before getting the grid data with PS.GetGridData
  • Updated MountVolume and CreateFolder to check if Server_Info exists, instead of try-catching the error, to not pollute the logs
  • Added ReplaceCharWord, and pointed RemoveWordChars to it
  • Updated ClientEmail to encode characters
  • Updated EncodeURL to use a %20 for spaces instead of a +
  • Updated all parseInt functions to use base ten (fixes 08 and 09 returning as octal)
  • Fixed bug in UpdateExtras, was using PS.AWSWorkflow.BuildFacade2 instead of PS.AWSWorkflow.BuildFacade
  • Updated CopySchedule to begin using UpdateExtras again
  • Updated all facade error messages to specify what function causes the error

v 1.140
August 27, 2010
Added RemoveBorders, where an array can be passed, and the list of items will have the borders and background removed. Good for buttons and popups
v 1.139
August 24, 2010

  • Updated CleanHTML to convert comments back to /* and */
  • Added ReturnLockedRecords, to return info about the currently locked records
  • Added RemoveWordChars, to remove any strange characters introduced by MS products

v 1.138
August 23, 2010

  • CreateFolder2 was not returning a correct result
  • OpenPath2, for Macs, switched the direction of the slashes (\ to /), but MountVolume was not equipped to handle forward slashes.

v 1.137
August 20, 2010

  • Updated MakeButton to use CleanHTML around script, so operators (< and >) will not cause an issue with XML control creation
  • Fixed bug in MakeButton, MakeLine, MakeBox, and MakeLabel

v 1.136
August 19, 2010

  • Updated GetUserName to allow -1 as a passed ID. UserInfo crashed if passed a negative number.

v 1.135
August 18, 2010

  • Updated Format2 to allow returning no decimals

v 1.134
August 17, 2010

  • Updated SetCurrentId to include currentDescription, descriptionField, and folderId
  • Added Properties to open Properties (build 9.0.5552 or greater)
  • Updated MakeBox, MakeLine, MakeButton, and MakeLabel to apply styles also on editingStarted (for new docs)
  • Updated GetUserName and GetUserEmail to parse Int on the ID to use UserInfo.

v 1.133
August 12, 2010

  • Created MakeBox, MakeLine, MakeButton, and MakeLabel
  • Updated Go to allow only passing type
  • Tested to see if Form exists before adding listener, for use on server-side
  • Updated SetCurrentId to sets the ID Field Name of the current record to Form.idField

v 1.132
August 10, 2010

  • Updated ViewPSTrace to be more precise (thanks to Pasha's help)

v 1.131
August 9, 2010

  • Updated Refresh
  • if the host app is new enough, it uses built-in objects instead of querying the database
  • Created SetCurrentId that sets the ID of the current record to Form.currentId
  • Form listener uses SetCurrentId (without a query if the client isn't new enough) to set the currentId of the record

v 1.130
August 9, 2010

  • Updated ExportGridToSV to allow not opening the file
  • Created MoveFile to move a file to another location, doesn't currently work for binary files
  • Updated open file logic in CreateFile
  • Added MountVolume to mount a volume. If it's mounted, it returns true, otherwise returns false.
  • Changed OpenPath2 to use MountVolume
  • Changed CreateFolder2 to use MountVolume, and allow passing of username and password

v 1.129
August 4, 2010

  • Updated GetUserName and GetUserEmail to use core UserInfo object instead of the database

v 1.128
August 4, 2010

  • Updated Clone object to use core.copy.deepcopy if available
  • Added Clone to pass to CloneObject
  • Updated FetchSmartList, FetchSmartSQLList, LoadGoButtons, GetGridData, and SaveCollectors to use Clone to clone the grid data object
  • In ViewPSTrace, Start and End Dates are now shown according to local time settings
  • Also, if Grid and Model is loaded, it removes "extra" columns, such as Party ID, User Name, and one of the Date fields

v 1.127
August 2, 2010

  • Added ShowExtendedPreview to show the extended preview for a passed DR ID
  • Changed ViewPSTrace to ViewPSTraceDB
  • Added ViewPSTrace which uses a data structure with the new version of TraceRunSQLQuery.js
  • Renamed original TraceRunSQLQuery.js to TraceRunSQLQuery_DB.js
  • Updated TraceRunSQLQuery.js to include Server, _http_request_, and jm_api calls

v 1.126
July 30, 2010

  • HasR2 to determine if Workgroups 2010 R2 is running.
  • CleanHTML to replace some special characters with their HTML character entities
  • History to show a history window for the passed type and id
  • Updated the following to include chromeless and singleton parameters: Go, NewFolder, NewDocType, Edit
  • Delete commented out, returns false because it has been removed from core
  • SetFields (pass an object, and it will set all fields in that object) renamed to SetFieldsNow to remove conflict with other SetFields
  • Added SetFieldsOnAddEdit to point to old SetFields
  • Changed JM and Proofs to include OpenWebPage if the client is R2
  • Added to JM: New Estimate, New Job, New Customer, New Invoice, My Items
  • Added to Proofs: Proofs Home, View Proof, Proof History
  • Added WhatControlsClicked to attach to a mousedown event to determine what controls were clicked
  • Added GetControlGroup to return a list of controls "in" another control
  • Added ClearMyPSTrace to remove trace items in the temp table pertaining to my VT instance
  • Added ViewPSTrace to show my RunSQLQuery traces
  • Added ShowDataAsHTML to show a web report of passed data structure (query, grid data, etc.), R2 & prev versions
  • Added ShowReportInVT, to show a PDF report from within VT
  • Added CanMove, MoveTo, MoveHorizontal, and MoveVertical for moving controls, along with testing to see if the client is new enough
  • Updated IsInsideControl, that, if the control doesn't exist, it returns false
  • Added ResizeControl, to change the width and height of a control
  • Added CreateControlGroup to create a group of controls
  • Added AddToControlGroup to add controls to a group
  • Added RemoveFromControlGroup to remove controls from a group
  • Added DeleteControlGroup to delete a grouping from controls
  • Added ReturnGroupControls to return an array of controls in a group
  • Added ReturnGroupTopLeft to return an object containing the x and y values of the controls in a group that is the top-most and left-most
  • Added MoveControlGroup to move a group of controls to a specific position
  • Added ShowControlGroup to show a group
  • Added HideControlGroup to hide a group
  • Added ToggleControlGroupVisibility to toggle a group visibility (used by ShowControlGroup and HideControlGroup)
  • Added DragControlGroup to move items around on the form drag-drop style. This should be used sparingly on large forms.
  • Added new library file, TraceRunSQLQuery.js, that, when included, it will log to a temp table RunSQLQuery calls

v 1.125
July 20, 2010

  • Added IsInsideControl, to be used with mousedown and mouseup events

v 1.124
July 14, 2010

  • Made ## replace globally in LoadGridPopups

v 1.123
July 6, 2010

  • Corrected bugs in AWSDefinition.CopySchedule
  • Fixed bug in AWSDefinition.SetTemplate

v 1.122
June 10, 2010

  • Updated bug in LoadGridPopups if the field is not a popup, it skips it

v 1.121
June 9, 2010

  • Added ability to pass facade to each AWS function
  • In AWS functions, changed all references from job_number to record_id, to indicate it doesn't need to be a Job

v 1.120
June 4, 2010

  • Rewrote GetPopupValues to use GetPopupByID
  • Rewrote GetPopupByID to use Form.getControlById first, but if the ID is not set, or not supported (earlier versions), it uses the old way, through the grid_and_model solution
  • Created LoadGridPopups to manage grid popups externally.  Pass the grid, field, and list or a MetaScript function
  • Created SetFields to pass an object with field-value pairs, and it sets the fields on the form

v 1.119
June 1, 2010

  • Added order to SaveModel, in case it is used server side and the order by has not been established

v 1.118
April 6, 2010

  • Added HelpList function that will output the list of PS Library functions along with all parameters
  • Added AssignActorsToRoles to assign several actors to roles at once

v 1.117
April 5, 2010

  • Fixed bug in ServerEscape if the passed string was not actually a string, it was converted
  • Fixed bug in FilterCheckItem, same string issue

v 1.116
April 2, 2010

  • Created Filter, which will filter the data passed, using starts with (s), equals (e), doesn't contain (d), or contains (c) (default)
  • Created FilterCheckItem, which will return true or false if the item passed meets the criteria, using starts with (s), equals (e), doesn't contain (d), or contains (c) (default)
  • Added brief descriptions to all functions

v 1.115
April 1, 2010

  • Implemented server-side scripting, including the following:
    • InitServer - initializes the server side scripting
    • RunOnServer - Runs the script on the server
    • ServerEscape - escapes quote, double quote, and backslashes to be used on server side script eval
    • Server.LoadData - The server side script that evals the strings passed through RunOnServer and returns the data structure
    • Server.SaveData - The server side script that evals the strings passed through RunOnServer and saves the structure
  • Other procedures were added/updated to allow use with server side:
    • SetGridData - used to set grid data instead of grid.set_data(data).
    • GetGridData - used to retrieve the data from a grid instead of grid.get_data(). Passing true as the second parameter makes the function return the structure as a string
    • GetPopupByID updated to use current Form.getControlById()
    • GetPopupById created to point to GetPopupByID
    • SetPopupList sets a popup to the structure passed
    • LoadGrid - modified to allow server side. Instead of passing the grid and model, one would pass null, 'Name_of_Type', and the resulting structure is returned
    • LoadSQLGrid - modified to allow server side. Instead of passing the grid and optional model, one would pass null, 'Name_of_Type', and the resulting structure is returned
    • SaveModel - modified to allow server side. Instead of passing grid and model, one would use: PS.GetGridData(grid, true) and 'Name_of_Type', and the structure is saved
    • TypeOf - extends the standard MetaScript typeof to differentiate between array and object

v 1.114
March 30, 2010

  • Updated AWSDefinition.GetTaskMap to return map from structure instead of using aws_activities table

v 1.113
March 17, 2010

  • Fixed bugs in VTNotification

v 1.112
March 17, 2010

  • Fixed bug in CreateFolder2 where server and folder names were being merged into one folder

v 1.111
March 15, 2010

  • Removed debug alerts in CreateFolder2
  • Changed CreateFolder2 to allow subfolders within subfolders
  • Created UpdateExtras to include new load_extra_field_defaults() function
  • Updated SetTemplate, CopySchedule, and InsertActivity to use UpdateExtras
  • Changed InsertActivity to add start_mode - can now specify autostart or skip

v 1.110
March 9, 2010

  • Allow using letter "x" in PhoneMask if indicated by "\\x". Also "X" can be inserted using "\\X"

v 1.109
March 9, 2010

  •  Fixed Bug in OpenPath2, passed path using encodeURI

v 1.108
March 8, 2010

  • Fixed Bug in CreateFolder2 pertaining to mounting the drive

v 1.107
March 3, 2010

  • Added Pause, to pause a number of milliseconds (ms)

v 1.106
March 1, 2010

  • Changed AWSDefinition.SetTemplate to overwrite unless the do_not_overwrite is set to true
  • Added PadNumber to pad a number with a character, 0 by default

v 1.105
February 22, 2010

  • Changed CreateFolder2 to display more meaningful errors

v 1.104
February 19, 2010

  • Created CreateFolder2 to use core functions
  • Updated CreateFolder to use the new CreateFolder2 function

v 1.103
February 17, 2010

  • Updated CreateFolder to use plugin in addition to fh_form

v 1.102
February 9, 2010

  • updated FetchUsers to allow sorting by first name, last name instead of just last name, first name
  • added to LoadGoButtons an id_field_name parameter
  • updated VTNotification, if the targets_array length is 0, then it returns false. Also fixed a misspelled word (per Chad)
  • added facade info, updated FacadeFinishWF to use the new structure (PS must prefix these):
    • AWSDefinition.BuildFacade - used by each function to build the definition facade
    • AWSDefinition.GetTaskList - lists tasks (for use in dropdowns, etc.), also a parameter for only incomplete tasks
    • AWSDefinition.GetTaskMap - gets a map of the tasks (id, name, etc.), also a parameter for only incomplete tasks
    • AWSDefinition.ClearWorkflow - clears the workflow
    • AWSDefinition.InsertActivity - inserts an activity; without parameters adds at the end of the list
    • AWSDefinition.SetDays - allows you to set the duration on a task
    • AWSRoles.BuildFacade - used by each function to build the roles facade
    • AWSRoles.GetRolesAndActors - gets a map of the roles and actors for the job
    • AWSRoles.GetRolesForActivity - gets the roles for a specific activity
    • AWSRoles.SetRoles - set the roles for a task code
    • AWSRoles.AddRoleToActivity - adds a role to an activity
    • AWSRoles.DeleteRoleFromActivity - deletes a role from an activity
    • AWSRoles.GetRoleActor - gets the actor assigned to a specific role
    • AWSRoles.AssignRoleActor - assigns an actor to a role
    • AWSWorkflow.BuildFacade - used by each function to build the workflow facade
    • AWSWorkflow.BuildFacade2 - used by each function to build the workflow facade
    • AWSWorkflow.JumpToActivity - jump to a specific activity
    • AWSWorkflow.FinishWorkflow - Finishes the workflow (skipping activities)
    • AWSWorkflow.FinishActivity - finishes an activity if it is currently executing
    • AWSWorkflow.GetStartDate - returns the start date of the schedule
    • AWSWorkflow.SetStartDate - sets the start date of the schedule and recalculates the plan
    • AWSWorkflow.GetDueDate - returns the due date (finish date) of the schedule
    • AWSWorkflow.SetDueDate - sets the due date of the schedule and recalculates the plan
    • AWSWorkflow.SetTemplate - sets a schedule to a template, also can set plan dates if a date is passed
    • AWSWorkflow.CopySchedule - copies a schedule from one job to another
    • AWSWorkflow.UpdateLocals - propagates locals to the Assignment records

v 1.101
January 26, 2010

  • Added FacadeFinishWF to finish an AWS workflow from any type.  The AWS library and custom_workflow_facade.js need to be included, and a ws_config_id_ field must be created with the calculate value as the type you wish to finish.  By default this should be 'Jobs'

v 1.100
January 22, 2010

  • Added autogrid_factory and basic_model_factory in case AWS library is included instead of grid_and_model
  • Changed grid_and_model error messages from e.message to PS.To(e)
  • Added to PS.To, in case grid_and_model is not loaded, it tries JSON.stringify before erroring
  • Added FinishWorkflow to finish an AWS workflow (AWS library needs to be included)

v 1.099
January 15, 2010

  • Changed GetCurrencyRate for currency rates to GetXurrencyRate, using xurrency.com - not a commercially free product
  • Created GetCurrencyRate, using the site http://currencysource.com. Drawback is information can only be pulled every 15 minutes. Advantage is it is free, plus is updated every 20 minutes.

v 1.098
January 11, 2010

  • Added GetCurrencyRate for currency rates, using xurrency.com

v 1.097
January 7, 2010

  • Fixed bug in FetchSmartSQLList with passing structures instead of queries
  • Fixed issue with XMLtoJSON - it wasn't testing to see if the solution was loaded first

v 1.096
December 18, 2009

  • Added FetchYears to have a list of year values, current year in the middle

v 1.095
December 15, 2009

  • Added XMLtoJSON function (with library) to convert XML data to JSON (JavaScript Object Notation) to be used with MetaScript

v 1.094
December 9, 2009

  • Fixed bug in GetUserGroups (wrong join parameters)

v 1.093
December 7, 2009

  • Updated FetchUsers, GetUserGroups, and GetGroupUserIDs to allow name in addition to description. This is an "or", so if a description has the same value as the name, it will show both groups. GetUserGroups will by default show names, but has a parameter to show descriptions instead.

v 1.092
November 17, 2009

  • Changed the osx case in OpenPath2 to use VT 2010 built-in functions
  • Updated SetWSConfigID and ResetWSForm to fix multiple schedule issue (ala Dima)

v 1.091
September 30, 2009

  • Added a blank value option to MapPopupList (by default)

v 1.090
September 16, 2009

  • Added a removal of '%' to RemoveComma

v 1.089
September 10, 2009

  • Changed MapPopupList to query the db only when the popup is clicked, vs when the function was called
  • Added AWS schedule change functions
  • Added removal of all non-digit, non-alpha characters to ZipCodeMask and PhoneMask

v 1.088
August 6, 2009

  • Added include_inactive parameter to FetchUsers. Excludes inactive users (set in JM), unless this parameter is set to true

v 1.087
August 3, 2009

  • Added GetPopupByID - gives a reference to a popup by the field name
  • Added MapPopupList - allows an onclick to set a popup list only when the list is clicked.

v 1.086
July 31, 2009

  • Added Base64 Library
  • Added PostToTwitter - to post items to Twitter account

v 1.085
July 22, 2009

  • Changed default for truncate folder in Job Creation folders to false. Note: this may have an effect on certain customers!
  • Truncate must be used if Macs are in the environment - folder names can only be 32 char if created on PC server
  • Also changed the order of parameters (after subfolders, so little impact on current installations)
  • Added truncate_folder_names, return_folder_names parameter to CreateJobFolder, to be passed to CreateFolder

v 1.084
July 1, 2009

  • Simplified ReturnPopupText, and will now work with arrays ["Item1","Item2"] or objects [ { text : "I1", value : "Item1" }, { text : "I2", value : "Item2" }] or mixed ["Item1", { text : "I2", value : "Item2" }]

v 1.083
July 1, 2009

  • Fixed GetUserIDByName to include a LTRIM and RTRIM for the SQL portion of the name.
  • Fixed the query of ReturnActivities to return the Active one if it exists, otherwise the Completed version

v 1.082
June 15, 2009

  • Added CleanURI to remove &, ?, and = from uri's
  • Added "=" to the items to clean in the URI

v 1.081
June 11, 2009

  • Added FileNameFriendly, to strip out characters that cannot be used for file names

v 1.080
June 11, 2009

  • Updated ReturnActivities - now it will not return activities where the Role is blank
  • Also, now ReturnActivities will return multiple Roles and Actors (in the form of an array) for a step if it exists, otherwise it returns an empty array

v 1.079
May 1, 2009

  • Updated AddDays - with any month that was 08 or 09, MetaScript thought it was an octect number when using parseInt, and returned 0 instead of 8 or 9

v 1.078
April 30, 2009

  • Added one_email_message property to EmailReport, EmailMultiReport, and Email

v 1.077
April 30, 2009

  • Added AddDays, specifying date, then days to add (or subtract). Returns new value in XDate format (instead of a number)

v 1.076
April 28, 2009

  • Updated CreateFolder - when no subfolders, skips the truncate step

v 1.075
April 24, 2009

  • Updated all OpenURI functions (Go, Edit, NewFolder, etc.) to convert & and ? into hex values for parameters

v 1.074
April 21, 2009

  • Completed OpenPath2, now works on OSX 10.5 & 10.4, also added ability to delay and # of seconds (default 3). Used when creating a new folder on the server.

v 1.073
April 15, 2009

  • Fixed issue with Smart List

v 1.072
April 10, 2009

  • Added GetPopupValues to return the list of items (text and values). This might also return data structure if more than text-value is created.
  • Added ReturnPopupText to return the text of a popup's value
  • Updated FetchUsers - exclude Administrator wasn't working properly

v 1.071
March 3, 2009

  • Created HasAWS - returns true if current DB has AWS installed

v 1.070
February 25, 2009
Created Format2, that will automatically perform a RemoveComma prior to formatting the number
Created LoadGoButtons. Must be loaded in the Global MetaScript, after the grid has been loaded with autogrid_factory as follows:

your_grid_name.action_handler_virtual = function( a, v, e ){ 
    PS.LoadGoButtons( this, a, v, e, "The_Name_Of_The_Type" ); 
} 

Added Common object, to create functions in the Common files to determine where the script is located. Usage:

//In the common file    
Common.Test = function(param1, param2, etc){ 
    // function items go here 
}  
 
// In the form script 
Common.Test(1, 2, 3); 

v 1.069
February 20, 2009

  • Created OpenPath2 that will open path (including file if needed) correctly on Mac OSX, along with Windows. OpenPath is deprecated.

v 1.068
February 16, 2009

  • Fixed lock logic on ModelUpdate

v 1.067
February 9, 2009

  • Bug fixed ReplaceChar to allow replace of characters with blank (i.e. removing the characters)

v 1.066
February 6, 2009

  • Added FetchSmartSQLList to pass SQL query SmartList

v 1.065
February 6, 2009

  • Added Duration to ReturnActivities
  • Added function for RecommendedDate (uses Date_Calculator.js) that calculates forward or backward # of days from a specific date, using a specific calendar id (default calendar is used if nothing is passed)

v 1.064
February 5, 2009

  • Bug fixed DeleteRecord
  • Added subfolder ability to CreateFolder and CreateJobFolder

v 1.063
February 4, 2009

  • Added DeleteRecord

v 1.062
February 4, 2009

  • Added EmailMultiReport to send many reports in one email
  • Changed ReplaceChar to test if replaced character is null, not IsEmpty (this will cause spaces to not be replaced)

v 1.061
February 4, 2009

  • Added HasFamilyType, HasVT, HasJM, HasCP, HasAM, and HasDSM to tell if the current DB has that app installed
  • Added Find to allow launching find (must be supported by client)
  • Added CustomQuery to launch a Custom Query (must be supported by client)

v 1.060
January 20, 2009

  • Updated ReturnActivities to allow not passing activities; it will return all for that id.

v 1.059
January 15, 2009

  • Added ExportGridToCSV to export grid contents or SQL query items to a csv file
  • Updated CreateFile to alert user if temp file already exists.

v 1.058
January 15, 2009

  • Changed OpenPath to allow opening the file (default is still the path)
  • Changed CreateFile to open the file
  • Changed InArray from the strict === (values and types the same) to == (values the same without regard for types)

v 1.057
January 2, 2009

  • Added SetFields ability to load items on objectLoaded (in addition to editingStarted)
  • Added parameters to Go

v 1.056
December 30, 2008

  • Fixed Bug in Relate that would cause an error on new items (objectLoaded handler does not occur on new objects)

v 1.055
December 23, 2008

  • Fixed Bug in ReturnActivities

v 1.054
December 17, 2008

  • Added ReturnActivities to return information about the passed activities for that Job
  • Fixed bug in PS.Refresh

v 1.053
December 3, 2008

  • Added PS.Refresh to refresh the current record
  • Fixed bug in Go that wouldn't allow reserved (& and ?) characters
  • Fixed bug in ReplaceChar where using reserved RegExp characters could not be used unless they have been escaped (\)

v 1.052
November 21, 2008

  • Fixed Bug in Prevent: the handlers for add need to be on 'loadForm', the handlers for edit and delete need to be on 'objectLoaded'

v 1.051
November 19, 2008

  • Fixed bug in Trim, Rtrim, Ltrim functions
  • Added Zip Code Mask (pass mask, default 5-4)
  • Added Phone mask (pass mask, default (xxx) xxx-xxxx)

v 1.050
November 13, 2008

  • Fixed ClientEmail bug: the url did not need to be encoded

v 1.049
October 22, 2008

  • Added SetGridIndex that sets the zero-based line number to the top line of the grid

v 1.048
October 17, 2008

  • Format did not enforce that a value was numeric, fixed
  • Allowed IsNumeric to test for commas and dollar signs

v 1.047
October 16, 2008

  • Changed GetRoleActor to include Assignments_Complete

v 1.046
October 16, 2008

  • Added generate_alert parameter for ClientEmail to allow hiding alert message
  • Added GetGroupUserIDs to get an array of the users in a group

v 1.045
October 16, 2008

  • Changed Proofs so passing nothing would take you to the Proofs tab

v 1.044
October 10, 2008

  • Added CloneObject to clone an object

v 1.043
October 2, 2008

  • Added FetchSmartList for grids - when one item has been chosen, it cannot be chosen again

v 1.042
October 2, 2008

  • Fixed GetUserGroups and GetUserGroupIDs when the Administrator is passed (ID 0)

v 1.041
September 26, 2008

  • Added GetUserGroupIDs to return array of user's group IDs

v 1.040
September 9, 2008

  • Fixed RemoveComma to, if return XDecimal, will return HI. Can also return XDecimal with false in last parameter
  • FIXED Format.js library file to include a truncate property. Will round if needed.

v 1.039
September 9, 2008

  • Fixed bug in FetchTasks

v 1.038
September 8, 2008

  • Added more descriptive errors for ModelUpdate and Grid items

v 1.037
September 5, 2008

  • Fixed alert "false" as last operation in CreateFolder
  • Added Group By in query for FetchUsers

v 1.036
August 6, 2008

  • Fixed bug in ReturnJMDate

v 1.035
July 25, 2008

  • Added GetRoleActor to return who is the actor for a role with a given role name

v 1.034
July 23, 2008

  • Added Proofs - to open a New Proof or search for related Proofs
  • Added several examples (about 1/3 of functions)

v 1.033
July 16, 2008

  • Added 2 parameters to Relate: ignore_no_relation (default true - to ignore when the relation doesn't exist), show_errors (default false - to alert if there is a problem)

v 1.032
July 14, 2008

  • Provide option to EmptyNumber so that 0 can return false as well (0 = "" as is)

v 1.031
July 7, 2008

  • Added "bill" as part of parameters for JM - to add a bill code (B,NB,CA,HE)

v 1.030
July 7, 2008

  • Added FetchTasks to return tasks, OI, or both

v 1.029
July 7, 2008

  • Made error output for model items more useful

v 1.028
July 7, 2008

  • Fixed Bug in FetchList

v 1.027
July 1, 2008

  • Minor updates

v 1.026
July 1, 2008

  • Fixed issue with ReplaceChar if string passed not a string

v 1.025
June 30, 2008

  • Still not comfortable with return values from all functions. For example, CloseJob returns true even if ModelUpdate could have failed. Assumption must be that the user may be taking further action based on whether or not the call worked, so accurate return values are vital.
  • I would think that any usage of ModelUpdate internal to the library should use locking. CloseJob is not? - Locks by default
  • ---Added show_errors on ModelUpdate - by default false

v 1.024
June 27, 2008

  • Added GetUserIDByName - returns an ID for the user with the passed in full name (First Last)

v 1.023
June 27, 2008

  • Fixed bug with VTNotification

v 1.022
June 26, 2008

  • Fixed ReturnJMDate - was not returning correct number when using XDate date manipulation functions (i.e. XDate.addDays())

v 1.021
June 26, 2008

  • Add GetUserGroups - returns an array of groups that the user with the passed in ID belongs to
  • Add CloseJob - function to invoke from VT to close a job in a combined VT-JM database - example in Mayo Jobs-Schedule, parameters for financial, scheduling close
  • Add ReturnJMDate - returns the Job Manager date for use with charge out
  • Added employee_number, department_code, cost_center_code, task_code and date parameters to JM
  • Evaluate functions that do not return objects or other values to return TRUE or FALSE (operation succeeded or did not)

v 1.020
June 24, 2008

  • Added FillCollectors and SaveCollectors for grids with file collectors
  • Added GetUserEmail

v 1.019
June 23, 2008

  • Fixed group error with NewDocType
  • Added group on NewFolder
  • Generalized CreateJobFolder to CreateFolder (old fxn kept for backwards compatibility)
  • Made CreateFile using meta_CreateFile

v 1.018
June 23, 2008

  • Added GetJobName and enclosed all RunSQLQuery's with try-catch blocks

v 1.017
June 20, 2008

  • Added parameters in CreateJobFolder to return result or alert(default) so user can decide what to do with it

v 1.016
June 18, 2008

  • Add a flag to FetchList or MakeList as to whether to concat a blank choice
  • Check all queries for nolock
  • Bug in FetchList (MakeList?), where clause passed as a string is ruined because of replace, how to handle? - Left to user to check for single quotes
  • Add ReplaceChar function to replace characters. By default single quote (') replaced by 2x single quote ('')

v 1.000 - v 1.015

  • First version, major bug fixes, etc.

Copyright MetaCommunications, Inc. 2008-2010, All Rights Reserved.

The Professional Services Libraries are provided by MetaCommunications, Inc. on an "AS IS" basis only. MetaCommunications, Inc. makes no representations or warranties, whether express or implied, regarding use of the Libraries.  Certain functions may only be used with the current release of Virtual Ticket.

Use of the Libraries provided by MetaCommunications, Inc. is at the recipient's own risk. MetaCommunications, Inc. provides no assurances that any reported problems will be resolved with the use of any information that MetaCommunications, Inc. provides. By furnishing the Professional Services Libraries, MetaCommunications, Inc. does not grant any licenses to any copyrights, trademarks, patents or any other intellectual property rights.

Last Modified:

2013-11-21

by

Ken Valley