
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2016 01:34 AM
Hi All ,
I have created a Jelly script to update a state field based on some conditions, but i am not able to update the state field using Jelly script
the same code i got worked in background script
<g:evaluate var="userValue" object="true">
var userValue = new GlideRecord("sys_user");
userValue.addQuery('sys_id',gs.getUserID());
userValue.query();
userValue;
</g:evaluate>
<j:if test="${userValue.next()}">
<g:evaluate var="itcaUser" object="true">
var itcaUser = new GlideRecord('x_eyfso_it_capabil_itca_user');;
itcaUser.addQuery('respondent_email_id', '${userValue.getValue('email')}');
itcaUser.query();
itcaUser;
</g:evaluate>
<j:if test="${itcaUser.next()}">
<g:evaluate>
var itcaResponse = new GlideRecord('x_eyfso_it_capabil_itca_surveyresponse');
itcaResponse.addQuery('assessment_instance_number','${RP.getParameterValue('sysparm_assessable_type')}');
itcaResponse.query();
</g:evaluate>
<j:if test="${itcaResponse.next()}">
<g:evaluate>
var itcaAssessment=new GlideRecord('x_eyfso_it_capabil_assessmentinstance');
itcaAssessment.addQuery('engagement','${itcaResponse.engagement_number}');
itcaAssessment.addQuery('survey_user','${itcaUser.sys_id}');
itcaAssessment.addQuery('state','In progress');
itcaAssessment.query();
</g:evaluate>
<j:if test="${itcaAssessment.next()}">
//here i need to update state to completed
</j:if>
</j:if>
</j:if>
</j:if>
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2016 09:36 PM
I have solved the issue
the purpose was i need to update a value in table when some changes happend CMS page
i have created a GlideAjax and solved this issue
Thanks for your quick reply always Appreciate it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2016 01:46 AM
Remove the single quotes in the Jelly variables. Like,
itcaUser.addQuery('respondent_email_id', ${userValue.getValue('email')});
Thanks,
Mihir

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2016 01:54 AM
Hi Mihir Mohanta ,
Thanks for your reply
that is working fine , the only things is i need to update the status something like below using Jelly script
itcaAssessment.state="Completed";
itcaAssessment.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2016 08:35 AM
To be honest.. why mix in Jelly... you only use jelly to make a IF-statement on variables from a g:evaluate... Just make everything inside a g:evaluate instead with javascript if-statements instead.
//Göran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2016 09:36 PM
I have solved the issue
the purpose was i need to update a value in table when some changes happend CMS page
i have created a GlideAjax and solved this issue
Thanks for your quick reply always Appreciate it