difference behaviour b/w platform and in portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 12:06 AM
Hi Team ,
There is a difference behavior between Portal and Platform end .
We have catalog called Lost/stolen device . In that based on device Type - Short description is populating .
For example : If i choose device type is 'Laptop' >> In short description field populating like this i.e [ Lost/Stolen Laptop reported By requestor for name ]
For this i have written client script ;
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reqFor = g_form.getDisplayValue('requested_for');
var newvall = g_form.getDisplayValue('device_type'); //replace with the backend name of device type field
//g_form.setValue('short_description_1', newvall +' '+ ": Device Type " + ' ' + " Reported By " + reqFor);
g_form.setValue('short_description_1', "Lost/Stolen " + newvall + ' ' + " Reported By " + reqFor);
}
Now , the problem I am facing that , this is working fine in portal , when we are checking from the platform , it is not working .
If you could see in the below screenshot , in the short description field requestor for name is not populating .
can anyone please help me with this issue , where i have to update in my scirpt please help me ,
It should work in platform level also .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 01:21 AM - edited 08-14-2024 01:27 AM
According to the documentation, g_form.getDisplayValue('your_field_name') only works in Service Portal. For the Core UI, you need to use this instead:
g_form.getDisplayBox('your_field_name').value
To combine the code for both UIs in one script, you can use the following approach:
var fieldName = 'my_field_name';
var fieldValue = '';
if (window == null) {
// Service Portal UI
fieldValue = g_form.getDisplayValue(fieldName);
} else {
// Core UI
fieldValue = g_form.getDisplayBox(fieldName).value;
}
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 02:12 AM
could you please provide me the update script with me . It will really helps for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 04:29 AM
Try this:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reqFor = '';
var newvall = '';
if (window == null) {
// Service Portal UI
reqFor = g_form.getDisplayValue('requested_for');
newvall = g_form.getDisplayValue('device_type');
} else {
// Core UI
reqFor = g_form.getDisplayBox('requested_for').value;
newvall = g_form.getDisplayBox('device_type').value;
}
g_form.setValue('short_description_1', "Lost/Stolen " + newvall + ' ' + " Reported By " + reqFor);
}
In fact, this is something you should be able to do yourself. If have difficulty making such small changes to client scripts, make sure you get appropriate training.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 11:13 PM