can't activate or set condition of subquery in javascript

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k 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,400 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 mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 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,400 Points 1k badge 2x thumb
Hi Pat, 

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

does not seem to work. 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

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