Question

FSM Smart Client - Load FSM dropdown using Client Script.

  • 30 January 2024
  • 3 replies
  • 58 views

Userlevel 1
Badge +7

We have a business requirement to filter the list in one of the combo box/dropdown in FSM screen based on the user's access group.
Currently, the this dropdown field display value without filtering through configured lookup in metadata.

Is it possible to filter this list based on Client Script. For example, we get data to be shown inside dorpodown in the client script, lopp through the values and add them to the dropdown list.


3 replies

Userlevel 6
Badge +26

Hi @ajayifs 

Which client is it?

If this is for the Webclient you can use setControlOptions.

setControlOptions('table', 'field', array);

Code eaxample

var opt1 = [];
var reasonResults;

if (selectedTAskStatus == 'INCOMPLETE') {
reasonResults = getDBValues('C_SELECT_INCOMPLETE_STATUS_COMMENT');
}
if (selectedTAskStatus == 'HOLD') {
reasonResults = getDBValues('C_SELECT_HOLD_STATUS_COMMENT');
}
if (selectedTAskStatus == 'CANCELED') {
reasonResults = getDBValues('C_SELECT_CANCELED_STATUS_COMMENT');
}
if (selectedTAskStatus == 'REJECTED') {
reasonResults = getDBValues('C_SELECT_REJECTED_STATUS_COMMENT');
}

//log(reasonResults.length);
for(var i = 0; i < size(reasonResults); ++i)
{
var reasonDescription = reasonResults[i]["description"];
var reasonCode = reasonResults[i]["code_value"];
arrayPush(opt1, createCodeTableOption(reasonCode,reasonDescription));
}
setControlOptions('task', 'user_def6', opt1);

Cheers!

Userlevel 4
Badge +12

Hi @ajayifs ,

I believe you are intending to write a client script for the smart client dropdown according to the title. Unfortunately you will not be able to achieve this via the smart client but as @Shneor Cheshin mentioned, you can write a web client script to dynamically populate the dropdown. Also, if you are using global codes or code tables, there is already a column to define access group to limit the value for the intended users, but can be a little messy if you want to populate the same for several access groups. There are many other options like changing the dropdown to a lookup, usage of lookup xml in ui designer, using the global code hierarchy etc. that are available in the community forum itself. 

@Shneor Cheshin is the best to  reach out for your requirement imo :)

Userlevel 6
Badge +26

@SAMLK 

I missed the title 😑

Cheers!

Reply