What is OR operator in jelly script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 04:54 AM
What is OR operator in jelly script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 05:07 AM
hello,
You can use it as below:-
<j:if test="${current.login == true || v_sMyVar == 'sample or'}">
Statements go here
</j:if>
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 05:56 AM
Hi,
Couple of points to note here:
1) Or Operator is a logical operator which is used to evaluate two or more conditions in a single statement or expressions.
2) Secondly OR operator concept wise is what I have stated above, the way of writing can be different where we are using it if it is in Jelly or Angular or normal Java script.
3) To use this, you just need to add this "||" between your statements and that's it so it will check if fist condition matches or second condition and it evaluates either this or that.
For example if you need to use Or operator in Jelly please follow the steps below:
<j:if test="${expression 1 == true || expression 2 == true}">
//Logic here when condition gets matched
</j:if>
Also do refer the below ServiceNow doc link for more information on Jelly scripting:
https://docs.servicenow.com/bundle/quebec-application-development/page/script/general-scripting/reference/r_JellyTags.html
Some good videos explaining Jelly from Chuck Tomasi:
https://community.servicenow.com/community?id=community_blog&sys_id=f95da629dbd0dbc01dcaf3231f961903
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke