what is phase 1 and phase 2 in jelly.

suresh12
Giga Contributor

Hi all,

can anyone  explain me the step in phase1 and phase2 in jelly.

or what is difference bet them. 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Suresh,

Following links can help you:

https://community.servicenow.com/community?id=community_blog&sys_id=3fcce265dbd0dbc01dcaf3231f9619ac

https://community.servicenow.com/community?id=community_blog&sys_id=6cecea65dbd0dbc01dcaf3231f961961

http://fortunemindsservicenow.blogspot.com/2015/05/how-to-use-phase-2-jelly-scripts.html

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Harsh Vardhan
Giga Patron

kindly refer the below technow youtube video . i would suggest here to watch all part one , two and three episode .

 

https://www.youtube.com/watch?v=_MhWugMQegs

 

 

Phases

Usually, there are two phases indicated by namespaces <j> versus <j2> and <g> versus <g2>.

The namespaces without the "2" happen in the first phase of processing and these are cached except when used in a UI page. Those with the "2" are never cached. Care must be taken when selecting whether to use phase 1 or phase 2 for efficiency and correct results.

In addition to the namespaces, the syntax used to insert values into static content differs depending on which phase is to supply the value. A dollar with braces surrounding a value inserts the value in phase 1. For example, ${jvar_ref} inserts the value jvar_ref during phase 1 of the jelly process. A dollar with brackets surrounding a value inserts the value in phase 2. For example, $[jvar_ref] inserts the value jvar_ref during phase 2. A value surrounded by quotes is treated as a string. For example, '[jvar_ref]' inserts the value jvar_ref as a string during phase 2.

 <script>
if (confirm("$[gs.getMessage('home.delete.confirm') ]"))
   ...
</script>
<input type="hidden" id="${jvar_name}" name="${jvar_name}" value="${jvar_value}" class="${jvar_class}" />

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Suresh,

Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Suresh,

Any update on this?
Can you mark answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader