The CreatorCon Call for Content is officially open! Get started here.

Different tables in reference field based on variable selection

Sunil31
Tera Expert

Hello Team,

 

I have a reference field with table as TASK. I have another variable on form which gives option to select the table name for the user (incident, service request, problem).

 

Whenever user select table name, only those record should be visible in reference field variable, can we achieve this. 

 

Please let me know the approach.

Thank you

1 ACCEPTED SOLUTION

Hi @Sunil31 

Why not? there you go!

javascript: current.u_task_type ? 'active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^sys_class_name=' + current.u_task_type : 'sys_class_name=-1'; 

 

Cheers,

Tai Vu

View solution in original post

12 REPLIES 12

@Sunil31 

Yes you need to update the task_class_name variable from mine to your own variable name.

And also make sure to replace this syntax ":" by ":".

The Reference Qualifier should look like this.

TaiVu_1-1698135834881.png

 

If you would like to show empty record when Task type is selected as None, try the below.

javascript: current.variables.task_type ? 'sys_class_name=' + current.variables.task_type : 'sys_class_name=-1'; 

 

You can also call a function from a script include to achieve it.

//Script Include
var CLCatalogItemUtils = Class.create();
CLCatalogItemUtils.prototype = {
    initialize: function() {
    },

	getTableRefQual: function(table_name){
		if(gs.nil(table_name)){
			return '';
		}
		return 'sys_class_name=' + table_name;
	},

    type: 'CLCatalogItemUtils'
};

 

//Ref Qual
javascript: new global.CLCatalogItemUtils().getTableRefQual(current.variables.task_type);

 

 

Cheers,

Tai Vu

hello @Tai Vu ,

 

This will work on time_card table form also right? Somehow im only able to see blank values in reference field when i tried below.

javascript: current.variables.task_type ? 'sys_class_name=' + current.variables.task_type : 'sys_class_name=-1'; 

Hi @Sunil31 

Can you help to capture your both variables so I can have better understanding about your current configuration.

To be able to tell where exactly the issue comes from.

Hello @Tai Vu ,
Please find below snippets.

 

Sunil31_0-1698148079997.pngSunil31_1-1698148109951.png

Sunil31_2-1698148151524.png

 

Hi @Sunil31 

okay I can see the difference now. I was thinking it's a Catalog Variable.

So, just remove the variables part from the script.

Sample below.

javascript: current.u_task_type ? 'sys_class_name=' + current.u_task_type : 'sys_class_name=-1'; 

 

Cheers,

Tai Vu