How to add if statement and call script include in advanced reference qualifier

lakshmi_laksh
Tera Contributor

Hello,
my requirement is to add If statement and call script include in advanced reference qualifier.
there is a field called "Project/Demand" on cost plan table, which refers to task table and i need to provide if condition on one the fields if record is taken from demand or project record based on "Project/Demand" field.

if anyone can help me on this.

2 REPLIES 2

DrewW
Mega Sage
Mega Sage

You need something like this

//Option 1
javascript: if(current.getValue("FIELD") == "SOMETHING") { "SOME_REF_QUAL" } else { "SOMETHING_ELSE"; }

//Option 2 - usually this is the best option
javascript:(new refQualUtil()).getMyRefQual(current)

//Script include - make sure its Client Callable is checked
var refQualUtil = Class.create();
refQualUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	getMyRefQual: function(current){
		var filter = "";
		//Do your work here to figure out what the filter should be
		return filter;
	},
	
});

hi,


if(current.getValue(task)=='dmn_demand'){new CostTypeFilter().costValue(current.task.portfolio)} else {new CostTypeFilter().costValue(current.task.primary_portfolio);}

is this correct?
i need to check if current task field is holding the value from "dmn_demand" table or "pm_project" table 

chaitrahh_0-1681141567491.png