
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 12:28 PM
I have an OnLoad client script with UI type as All to display field message on the change form schedule tab but it works only on UI16, how can I display the same messages on the Portal form?
function onLoad() {
var ga = new GlideAjax('GetUserInfo');
ga.addParam('sysparm_name', 'GetUserTz');
ga.getXML(GetUserInfoParse);
function GetUserInfoParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.showFieldMsg('start_date','Enter time based on your timezone. Your profile is currently ' + answer + ' time','info',true);
g_form.showFieldMsg('end_date','Enter time based on your timezone. Your profile is currently ' + answer + ' time','info',true);
g_form.showFieldMsg('work_start','Enter time based on your timezone. Your profile is currently ' + answer + ' time','info',true);
g_form.showFieldMsg('work_end','Enter time based on your timezone. Your profile is currently ' + answer + ' time','info',true);
}
}
I believe we should do something in the 'Schedule' widget server script for this to work, but not sure how. Can I get some help here please.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 03:23 AM - edited 06-01-2023 03:24 AM
Hello,
You can try adding an additional <div> in each of the <td> to show the field message. The filed message can be configured at the server end .
<td>
<div class="label-column">
<h5>Planned Start Date</h5>
</div>
<div class="value-column bold">
{{data.startDate}}
</div>
<div class="wrapper-xs r m-t-xs ng-binding ng-scope bg-info">
{{data.field_message}}
</div>
</td>
data.field_message can be derived from server side :
var user_timezone = gs.getUser().getRecord().getDisplayValue('time_zone');
data.field_message = "Enter time based on your timezone. Your profile is currently "+ user_timezone + " time" ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 04:47 AM
If the user has selected the default or system timezone in the profile , it returns null.
You can try changing it to some other timezone and then test it.
Moreover, you can modify the server side code to get the value of system timezone as below:
var system_time_zone = gs.getProperty('glide.sys.default.tz')
var user_timezone = gs.getUser().getRecord().getDisplayValue('time_zone');
if (!user_timezone){
data.field_message = "Enter time based on your timezone. Your profile is currently "+ system_time_zone + " time" ;
}
else
data.field_message = "Enter time based on your timezone. Your profile is currently "+ user_timezone + " time" ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 12:50 AM
Can you also paste the code written inside 'Schedule' widget?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 01:20 AM
Hi @Asif Khan M
Below is the HTML code
<div>
<div class="overview">
<div class="panel panel-{{::c.options.color}} b">
<div class="panel-body">
<table class="info-table">
<tbody class="tbody-class">
<tr>
<td>
<div class="label-column">
<h5>Planned Start Date</h5>
</div>
<div class="value-column bold">
{{data.startDate}}
</div>
</td>
<td>
<div class="label-column">
<h5>Planned End Date</h5>
</div>
<div class="value-column bold">
{{data.endDate}}
</div>
</td>
</tr>
<tr>
<td>
<div class="label-column">
<h5>Work Start</h5>
</div>
<div class="value-column bold">
{{data.workStart}}
</div>
</td>
<td>
<div class="label-column">
<h5>Work End</h5>
</div>
<div class="value-column bold">
{{data.workEnd}}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Server Script as follows
(function() {
var gr = $sp.getRecord();
data.startDate = gr.getDisplayValue('start_date');
data.endDate = gr.getDisplayValue('end_date');
data.workStart = gr.getDisplayValue('work_start');
data.workEnd = gr.getDisplayValue('work_end');
})();
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 03:23 AM - edited 06-01-2023 03:24 AM
Hello,
You can try adding an additional <div> in each of the <td> to show the field message. The filed message can be configured at the server end .
<td>
<div class="label-column">
<h5>Planned Start Date</h5>
</div>
<div class="value-column bold">
{{data.startDate}}
</div>
<div class="wrapper-xs r m-t-xs ng-binding ng-scope bg-info">
{{data.field_message}}
</div>
</td>
data.field_message can be derived from server side :
var user_timezone = gs.getUser().getRecord().getDisplayValue('time_zone');
data.field_message = "Enter time based on your timezone. Your profile is currently "+ user_timezone + " time" ;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 04:29 AM
Hi @Asif Khan M , Thanks for the response.
It has partially worked, not fetching the user time zone yet.
Thanks