what this condition means? - !(new KBCommon().isStackNameDialog()) && (new KBKnowledge().canPublish(current))

kinjal1
Kilo Expert

What is this UI Action condition means on kb_knowledge table?

 !(new KBCommon().isStackNameDialog()) && (new KBKnowledge().canPublish(current))

I also want to add this button when form is new but it not working.

Thanks for help

1 ACCEPTED SOLUTION

kinjal,

There's a slight correction. Like I said in the above answer, the condition you posted would be like running '!(true) && (true)' if both function calls evaluate the true. This means that the script will not run if both evaluate to true (or return a true value).

In order for the subsequent script to run after this condition, the first Script Include function call (KBCommon()) will have to evaluate to False and the other Script Include function call (KBKnowledge()) would have to evaluate to True.

View solution in original post

2 REPLIES 2

James Gragston
Tera Guru

kinjal,

Well, the bang at the beginning(exclamation point) is negating the entire condition. If this condition evaluates to false, it would be like running '!false' which evaluates to True. Inside the condition, there are two script includes being called - KBCommon() and KBKnowledge(). The ampersand between these two script calls specifies that BOTH function calls must evaluate to True in order for the following script to run. However remember, that means it will be: '!(true) && (true)', which evaluates to !true (not true!).

Find these two Script Includes and inside each, you'll find the isStackNameDialog() function and the canPublish() respectively. See what these functions output.

 

Hope this helped!

kinjal,

There's a slight correction. Like I said in the above answer, the condition you posted would be like running '!(true) && (true)' if both function calls evaluate the true. This means that the script will not run if both evaluate to true (or return a true value).

In order for the subsequent script to run after this condition, the first Script Include function call (KBCommon()) will have to evaluate to False and the other Script Include function call (KBKnowledge()) would have to evaluate to True.