There is a requirement to limit drop down of Task-Template on contract-pm based on value of “Brand” field on Contract Product.
Eg.
Contract Product has Brand = A5
User-Def1 of Task Template = A5
In Contract PM only Task-Template (which has user-def1 = A5) will be populated
There are 5 task-templates which connected to brand (user-def1 value) = A5
Expected result: the task-template in Contract Product\PM only shows those 6 task-templates.
(not all templates like currently)
I tried to setup using “Lookup XML” of field task_template but could not get correct connection and contraint.
I tried using client-script and set it on screen, event = AfterDataLoad and not succeed either.
Client-script looks like this:
showProgressIndicator();
var prodBrand = getControlValue('contr_product','brand');
// alert('brand = ' + prodBrand);
var emptyOptions = ];
var options = createCodeTableOption('', '');
arrayPush(emptyOptions, options);
setControlOptions('contr_pm', 'task_template_id', emptyOptions);
var opt = n];
var taskTemp = null;
var tempId = null;
var tempDesc = null;
var taskTemplates = getDBValues('C_GET_TASK_TEMPLATE', aprodBrand]);
// alert('size task template ' + size(taskTemplates));
for (index = 0; index < size(taskTemplates); ++index)
{
taskTemp = taskTemplatesrindex];
tempId = taskTemp.task_template_id;
tempDesc = taskTemp.description;
arrayPush(opt, createCodeTableOption(tempId, tempDesc));
}
setControlOptions('contr_pm', 'task_template_id', opt);
hideProgressIndicator;
Client-script SQL C_GET_TASK_TEMPLATE':
SELECT task_template_id, description FROM task_template WHERE user_def1 = '{0}'
I can get the correct task-template. But the contr_pm.task_template_id is still populating all templates.
Any suggestion to achieve the above requirement? Either only with configuration on screen or using client-script?
Thanks in advance.
~Juni