If condition always returns no.

ajohn
Kilo Contributor

Hello everybody,

I am trying to create an if condition within a service catalog workflow. The advanced script looks as follows:

answer = ifScript();

function ifScript() {
if (current.variables.delivery_address == "Test") {
  return 'yes';
}
return 'no';

}

It returns always no, even thoug I type "Test" in the Delivery Address field in checkout screen. It doesn't matter, which variable (u_cost_center, price etc.) of the requested item i use. It returns always 'no'.

Hopefully anybody can tell me, why it's not working.

Thanks a lot and best regards

Andreas John

1 ACCEPTED SOLUTION

dvp
Mega Sage
Mega Sage

you condition should be



if (current.request.delivery_address == "Test") {




as deliver address is on request form


View solution in original post

11 REPLIES 11

can you put log statement and see what someText variable is having may be it might be having an extra space



and see if trim() helps



if (someText.trim() == "Roswell, GA,USA") {


ajohn
Kilo Contributor

trim() did not help, but the script log statements showed that there must be an extra space between "Kaufering, DE".



Thank you very much for your help!