How can i script Contains("string") or matching
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2014 07:40 AM
Below script don't works, what is de function contains in SN
if(this.rec.u_service.containg("SAM") && this.rec.u_subtype == ""){
allowed = true;
}
Maby something like indexOf
Thanks!
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2014 07:43 AM
Is u_service a string? If so, you are correct: indexOf is the way to go. Example:
if(this.rec.u_service.indexOf("SAM") > -1 && this.rec.u_subtype == ""){
allowed = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2014 02:03 PM
Thank you Josh!
I have below code but i still get all time ------> ("Subtype needs to be provided before leaving this phase.");
The code don't works well
if(this.rec.u_service.indexOf("SAM") > -1 && this.rec.u_subtype == ""){
allowed = true;
}
else if(!this.rec.u_service.indexOf("SAM") > -1 && this.rec.u_subtype == ""){
gs.addErrorMessage("Subtype needs to be provided before leaving this phase.");
allowed = false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2014 02:10 PM
Do you know what kind of field u_service is? Is it a reference to another table? If so, you may need to dot-walk to the "display value" field on the referenced table before you check indexOf. For troubleshooting purposes, try taking out the second conditional statement and just test with the first half until you know it's working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2014 03:25 AM
Josh,
It works! it is a reference to another table. dot-walk resolve it
Thank you very much!