Using If condition in Jelly Scripting!

shahid1
Kilo Expert

Hi All,

I am quite new to jelly scripting and i am facing a problem described as below:-

In my client's SNOW instance there is section in "My Assessment and Surveys---->>Click on Any Assessment to open" page in which there is a link on the top of that page which when clicked ,takes us to another ui pop up.

The requirement here is that the client wants that particular section of the page(a link on the top of Assessment page which when clicked ,takes us to another ui pop up) to be hidden for a particular kind of assessment.

FYI the assessment in the client's instance is just configured for Demand Management as of now. So they want it to be hidden in case they want to configure the assessment for any other applications in future.

Its an OOB script "assessment_take" which i am trying to edit.

Can anybody help me with the script on how can i have the link on the top of the page to be only visible when the assessment is for Demand management?

Thanks,

Shahid

7 REPLIES 7

Anurag Tripathi
Mega Patron
Mega Patron

Hi Shahid,



I haven't seen the script you have mentioned, but using If in jelly is simple



<j:if test="${!jvar_gr.hasNext()}">


//do what you have to do here


</j:if>


,


-Anurag

Hi Anurag,



Please find the section of the script below :-(Name of the OOB Script :- assessment_take2)



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide"


  xmlns:j2="null" xmlns:g2="null">



//the below section of the script which creates a link on the top of the page



<g:ui_form>


<p><b><font size ="5">NOTE: To help the scoring of the demand across each of the 11 metrics, please use this - <a href="javascript:Dialog()"><font color="blue"> resource.</font></a></font></b>


</p>


</g:ui_form>




//and then the OOB script starts here(the below script is just the section of the original):-



  <g:requires name="scripts/json2.jsx" />


  <j:set var="jvar_assessable_type" value="${sysparm_assessable_type}" />


  <j:set var="jvar_isComingFromSurveyCreator" value="${sysparm_isSurveyCreator}" />


  <j:set var="jvar_hidepreview" value="no" />




The requirement is to make this link visible only when Assessment metric type is demand.



Let me know if you want more details on this.



Thanks,


Shahid


use this



<j:if test="${jvar_assessable_type=='demand'}">


<g:ui_form>


<p><b><font size ="5">NOTE: To help the scoring of the demand across each of the 11 metrics, please use this - <a href="javascript:Dialog()"><font color="blue"> resource.</font></a></font></b>


</p>


</g:ui_form>


</j:if>


-Anurag

Hi Anurag,



The above syntax looks gud but its not working as expected.



When i added the J tag if condition statement it stopped working, i mean the link was not visible anymore in the Assessment page even for the demand assessments.



I think the type which is declared as "demand" should be something else.



Any hint or help?



Thanks,


Shahid