Solved

How to populate some selected global code values in a drop down fields in web client

  • 21 November 2021
  • 6 replies
  • 407 views

Userlevel 3
Badge +6

Dear All,

 

I need to populate some specific selected global code values in a drop down fields in web client.  

Lets say in Global code I have code values like

Code_Value1,

Code_Value2,

Code_Value3,

Code_Value4

 

Some time I need to display  Code_Value1, Code_Value2  and some time Code_Value2, Code_Value3,Code_Value4. 

 

Can anybody help me on this to achieve the same. 

In Mobile there is a populatelistQuery  function . Same Functionality we need to achieve in Web client. 

 

Thanks & Regards

Rajat

icon

Best answer by SanjeewaJ 29 November 2021, 03:45

View original

6 replies

Userlevel 5
Badge +13

Hi @TatRajatM ,

Good day to you!

You could achieve this by configuring a custom screen when Lookup XML for the drop down field is correctly specified. Follow the below steps. For an example, I have taken ‘Task’ screen.

1. Go to UI Designer in Smart client & open ‘Task’ screen

  1. Click on the dropdown field you wish to configure
  2. On the top left corner of the screen, edit the lookup XML as per your need
    1. Select the correct Primary table & click on Add Data Constraints.
    2. Specify the column, constraint & value
      1. Save the screen & ‘Refresh cache(full).
      2. Assign the screen to a Role & then the Role to the person record
      3. Relogin & see for the desired values to popup in the dropdown field

        ​​​​​​​Hope this helps. Thank you very much! :)
Userlevel 1
Badge +5

Hi @Charith Fernando, Hi @TatRajatM,

 

I had a similar requirement so i set up my custom screen. It seems that it works well in smart client but, in web client, my drop-down fields doesn’t take into account the data constraints..

 

It’s working for you @TatRajatM ?

 

Best regards,

Userlevel 5
Badge +12

Dear All,

 

I need to populate some specific selected global code values in a drop down fields in web client.  

Lets say in Global code I have code values like

Code_Value1,

Code_Value2,

Code_Value3,

Code_Value4

 

Some time I need to display  Code_Value1, Code_Value2  and some time Code_Value2, Code_Value3,Code_Value4. 

 

Can anybody help me on this to achieve the same. 

In Mobile there is a populatelistQuery  function . Same Functionality we need to achieve in Web client. 

 

Thanks & Regards

Rajat

Hi @TatRajatM 

Please see if below conversation helps you. I have given an example client script to filter a dropdown.

/Sanjeewa

Userlevel 3
Badge +11

Hi @SanjeewaJ,

 

since the link you shared is not accessible for customer, could you please post the information in this thread?  

 

Thanks in advance,

~Juni

Userlevel 6
Badge +26

@JuniSihombing 

 

Please see if you are looking for something like this. I just created an example with REQUEST entity. Which I am populating request statuses, based on request type.

Note that, this works only for web client. Since screen events are not working in smart client.

  1. Client script Example - SAJGLK_DYNAMIC_STATUS_DROPDOWN

showProgressIndicator();
var reqType = getControlValue('request','req_type');

var emptyOptions = [];
var options = createCodeTableOption('','');
arrayPush(emptyOptions, options);
setControlOptions('request', 'req_status', emptyOptions);

if(reqType == 'FIX') {
    var opt1 = [];
    arrayPush(opt1, createCodeTableOption('INVESTIGATE','Investigate'));
    arrayPush(opt1, createCodeTableOption('HOLD','Hold'));
    setControlOptions('request', 'req_status', opt1);
} else {
    var opt2 = [];
    arrayPush(opt2, createCodeTableOption('CANCELED','Canceled'));
    arrayPush(opt2, createCodeTableOption('CLOSED','Closed'));
    setControlOptions('request', 'req_status', opt2);
}
hideProgressIndicator();

  1. Attach the client script to screen.

UI Designer → Screen Events

 

  1. Test in WEB Client

 

 

 

Few points,

  • You can populate options from code tables using client script sql, rather hard coding
  • You have to handle the “Create New” record also in the script. Otherwise it will show only few options at creation as well.
Userlevel 3
Badge +11

Thanks a lot, @Shneor Cheshin!

 

~Juni

Reply