can't activate or set condition of subquery in javascript

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
Photo of Pat Vachon

Pat Vachon, Champion

  • 44,426 Points 20k badge 2x thumb

Posted 5 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 53,702 Points 50k badge 2x thumb
To set Sub-Conditions, you need to include a 2nd argument in your call to getConditionByName():

var condition = model.getConditionByName('Status',true);
model.setCondition(condition,'Closed Won');

See the docs on getConditionByName()
Photo of Gyan

Gyan

  • 1,422 Points 1k badge 2x thumb
Hi Zach, I have a scenario where I want to just activate subcondition and not set value. How can I do that. I have subcondition whose value is in records (all records) from another model. 
Photo of Pat Vachon

Pat Vachon, Champion

  • 44,426 Points 20k badge 2x thumb
Just don't set it and only activate it.

var condition = model.getConditionByName('Status',true);
model.activateCondition(condition);
Photo of Gyan

Gyan

  • 1,422 Points 1k badge 2x thumb
Hi Pat, 

var condition = model.getConditionByName('Status',true);
model.activateCondition(condition);

does not seem to work. 
Photo of Pat Vachon

Pat Vachon, Champion

  • 44,426 Points 20k badge 2x thumb
Can you share the XML for the page?