Solved

Custom HotKey creation in FSM

  • 10 January 2020
  • 6 replies
  • 560 views

Badge +2

Hi  All,

Is there any feature to create hotkeys to do custom action?

Thanks,

Shankar

icon

Best answer by Mike The FSM TechnoGeek 20 January 2020, 17:33

View original

6 replies

Badge +2

I am assuming we can do via client script where we use keyup function to capture a hotkey and do a custom action. Please let me know if it makes sense

Userlevel 5
Badge +17

You will want to define the keyboard shortcuts in one of two places: 

 

1. UI Designer

In the UI designer, a shortcut can be defined for any item on the screen, such as a button or a field, and the shortcut key will perform the default action for that item (click for a button, select for a field, etc.).  A client script can then be defined for the event, e.g. Click.  In the UI Designer, select the item and set the properties in the upper left of the screen to define shortcut keys.  In the screenshot below, I have defined Shift-Ctrl-D as a keyboard shortcut for the Delete button on the CONTACT screen.

 

2. Custom Functions

Open the Cust Functions screen from Menu->Studio->Custom Functions.  The hotkeys you define here will open the screens (or run the function) without having to select in the menu.  There are only handful of baseline keyboard shortcuts, and these are F3/F4 for assign and solution on request and warranty screens.

In the case of a client script you want to execute when a screen is opened, you can define the script to execute when the item defined for ‘initial focus’ is selected for the Smart Client.  For the Web Client, you will want to an event child node in the add_edit/events node for your screen definition (UI Designer Xml Editor) as follows.  You’ll want to make sure to use the existing events node if there is one, or add one if one does not already exist.  Just be careful not to create a second events node!  The cookbook details the events you can use for the Web Client, but be aware that most of the content in the cookbook pertains only to the Web Client.  When I want configurations in both Web and Smart clients, I usually create two set of scripts – one for Web Client, and one for Smart Client.

  <add_edit>

    <events>

      <event>

        <name>AfterScreenLoad</name>

        <client_script_id>ALLOCATIONADJUSTMENTS_CLEAR_BUTTON__0</client_script_id>

      </event>

    </events>

  </add_edit>

 

Badge +2

Thanks alot Mike. The screenshots were of a great help. I was looking for a combination of short cut key calling a client script to do a simple action of capturing user name & timestamp to capture dispatcher comments. I am not clear on the second step of custom functions. When I right click, I am able to attach the custom client script to a document event, however I am not following how the short key in that text would perform a particular action.  Below are the screenshots which I am trying

 

 

 

Userlevel 5
Badge +17

Not sure what you’re end goal actually is.  Nearly every table in the database has a created_by and created_dttm field which are updated automatically by the framework.  Every comment will be a request_text record and will have values updated for these fields.  Do you have a different need?

Badge +2

I understand you are referring to the notes tab where the notes can be captured.

The need asked is on any text area field, if information is captured by different staff, can we have a short key which fills the text area with person name & timestamp to help identify which person/business user entered the details. For eg. if the shortcut key is ctrl + z, it should fill [ person name - timestamp]: on a keyup event on that particular property

Userlevel 5
Badge +17

This may be beyond the practical scope of what we can do with custom configuration in FSM.
Conceptually, you need to store the table and column for the text field when the control is selected.  This would be a script which sets a pair of global variables.  You hotkey MIGHT possibly be assigned to the click/select on a hidden item.  You would need to edit the XML for the hidden item manually to add this event node, and the corresponding script would set the control value using the global variables which designate the currently selected text field.  The big unknown is if you can have an event defined (and honored) for a hidden field.  You goal is more like a keyboard macro than a shortcut to an existing operation/function.  If the hidden field idea doesn’t work, you could first try with a ‘dummy’ field - e.g. put a ‘Macro’ button in the header def for the top item panel to suss out whether the rest of this concept will work.  If all goes well, you will need to trigger your ‘save_selected_item’ script, thereby setting the pair of global variables, for every text field you want this macro to be available for.

You will also want to devise a mechanism to ensure that when you are NOT in one of the text fields that hitting the ‘hotkey’ doesn’t update the last text field you were on.  One option would be to allow the macro only once for any text field, and clear the global variable pair after adding the “name : date” to the field.  So your hidden script will set the global pair, and your ‘macro’ script will:
1) Check the global variable pair is not null.
2) add the “name : date” text to the field designated by the global variable values
3) Clear the global variables.
Good luck!

Reply