- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 11:15 PM
Hi Team ,
There is a difference behavior between Portal and Platform ends.
We have catalog called Lost or Stolen Device. Based on device type, a Short description is populating .
For example, if I choose device type is 'Laptop' >> In short description field, it is populating like this, i.e [ Lost/Stolen Laptop Report] [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 is that this is working fine in portal, but when we are checking from the platform , it is not working .
If you could see in the below screenshot , in the short description field, the requestor for name is not populating .
can anyone please help me with this issue , where i have to update in my scirpt?
Please help what was the mistake , and where should i update ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 12:38 AM
The below should work :-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var deviceTypeValue = g_form.getValue('device_type');
g_form.getReference('requested_for', function(requestedForRecord) {
var requestedForValue = requestedForRecord.name;
g_form.setValue('short_description_1', "Lost/Stolen " + deviceTypeValue + ' ' + " Reported By " + requestedForValue);
});
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 12:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 12:38 AM
The below should work :-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var deviceTypeValue = g_form.getValue('device_type');
g_form.getReference('requested_for', function(requestedForRecord) {
var requestedForValue = requestedForRecord.name;
g_form.setValue('short_description_1', "Lost/Stolen " + deviceTypeValue + ' ' + " Reported By " + requestedForValue);
});
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 12:58 AM
any luck @nameisnani if yes please mark the solution helpful
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/