jelly script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-15-2023 03:46 AM
Hi
can any one help me in jelly script to glide record sc_task table and get the value of "opened_by" field and if current logged in user is equal to opened_by i need to do "test" variable read only on service portal
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-15-2023 04:34 AM
Hello @Shabbir1
<script>
var gr = new GlideRecord('sc_task');
gr.addQuery(opened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe);
gr.query();
while(gr.next()){
document.getElementById("test").readOnly = true;
}
</script>
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-15-2023 04:37 AM
Hi @Shabbir1
I hope this helps -
<j:jelly xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="currentUser" jelly="true">gs.getUserID()</g:evaluate>
<g:evaluate var="taskRecord" jelly="true">
var gr = new GlideRecord('sc_task');
gr.addQuery('sys_id', 'YOUR_SC_TASK_SYS_ID'); // Replace with the actual sys_id of the sc_task
gr.query();
if (gr.next()) {
gr.opened_by.toString(); // Convert opened_by to a string
}
</g:evaluate>
<script type="text/javascript">
var currentUser = ${currentUser};
var openedBy = "${taskRecord}";
if (currentUser === openedBy) {
// Enable read-only for the "test" variable
g_form.setReadonly('variables.test', true);
}
</script>
</j:jelly>
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar