- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 12:08 AM
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
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 03:15 AM
you condition should be
if (current.request.delivery_address == "Test") {
as deliver address is on request form

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 03:15 AM
you condition should be
if (current.request.delivery_address == "Test") {
as deliver address is on request form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 03:54 AM
Thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 04:44 AM
Could you also tell me please, how the script must look like, when the delivery address field contains a line break?
I tried something like:
if (current.request.delivery_address == "Line1" + '\n' + "Line2") {
or
if (current.request.delivery_address == "Line1" + '\br' + "Line2") {
Unfortunately it does not work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 04:49 AM
use regex to remove the line breaks
var someText = current.request.delivery_address
someText = someText.replace(/(\r\n|\n|\r)/gm,"");
if(someText == 'YOUR_STRING_VALUE')