It's all about the answers!

Ask a question

Condition to make attribute mandatory on the basis of specific State and specific option from drop-down

Sajjad Ali Khan (314152) | asked Aug 23 '15, 6:10 a.m.
Hi All,

I need little more help from you guys as i need to make a condition which will make another drop down mandatory in specific state, i have created a script for that but its not giving expected result.

could you please check if there is any mistake in following script, i'll be very much thankful to you.

There is an attribute(dropdown-1) which has two radio button (Yes / No), two states (FLA & SLA) and there is another attribute (dropdown-2) which in located on other tab 
if user select No from dropdown-1 and workitem reach to the State (FLA or SLA) then on other tab dropdown-2 while become mandatory

(function() {
var WorkItemAttributes =;
dojo.declare("org.example.workitems.providers.RFCIsaProjectNoFLASLA" , null, {
matches: function(attributeId, workItem, configuration){
var state = workItem.getValue("WorkItemAttributes.STATE");
var rfcvalue = workItem.getValue("attribute.rfcisaproject");
console.log(typeof (state));
if(state == "arabbank.workflow.rfcworkflow.state.s5" || rfcvalue == "enumeration.rfcisproject.literal.l3"){
return true;
return false;

Accepted answer

permanent link
sam detweiler (12.5k6195201) | answered Aug 23 '15, 8:23 a.m.
when using custom attributes,
var rfcvalue = workItem.getValue("attribute.rfcisaproject");

you need to use the ID of the attribute.. mine are usually ''

var rfcvalue = workItem.getValue("");
Ralph Schoon selected this answer as the correct answer

Sajjad Ali Khan commented Aug 23 '15, 8:38 a.m. | edited Aug 23 '15, 7:26 p.m.

 sam detweiler Thanks for the prompt response but the ID is correct i have already use the same ID for another condition, also  have define my own naming convention for the attribute ID's

kindly please look into the script again.

sam detweiler commented Aug 23 '15, 8:41 a.m.

Ok, many folks post something slightly different than actual values..

I would add logging to see what u are actually getting for the two values.

also javascript equals is usually '==='

Sajjad Ali Khan commented Aug 23 '15, 9:26 a.m.

 sam detweiler you mean to say my script is correct i just need to correct  '==='  sign in my script ? right 

if there is any other error in my script then please specify dear

sam detweiler commented Aug 23 '15, 9:54 a.m.

I don't 'see' anything wrong specifically.

I would add console.log() to dump out the values from the two variables to confirm they are as u expect

Don Yang commented Aug 23 '15, 7:28 p.m.

Hi, Sajjad

It is not clear from the question that What results you have got.

From "if user select No from dropdown-1 and workitem reach to the State (FLA or SLA) ", my understanding is that you wand a 'AND' logic but your script use OR logic
if(state == "arabbank.workflow.rfcworkflow.state.s5" || rfcvalue == "enumeration.rfcisproject.literal.l3")

You may want to have a look at this as well.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.