- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 10:15 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2024 03:22 PM
Please also take a screenshot of the other field - promptstructure.
But even from this screenshot a problem can be seen: type is of type String in which you are looking for a sys_id.
That is theoretically possible but very NOT likely.
So the problem could be line
serviceTypeGR.addQuery('type', selectedType);
in the Script Include.
It is possible and likely that what you mean is:
serviceTypeGR.addQuery('sys_id', selectedType);
which can be short-handed to:
...
// Query the 'ServiceType' table and retrieve questions
var serviceTypeGR = new GlideRecord('x_1296451_legaladv_servicetype');
if (serviceTypeGR.get(selectedType)) {
gs.addInfoMessage('serviceoog' + serviceTypeGR);
promptStructure = serviceTypeGR.getValue('promptstructure');
}
gs.addInfoMessage('promptStructure ' + promptStructure);
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 10:36 PM
Hello @payalpatel26,
Try this updated scripts -
var FetchPromptStrctureBasedOnChangeServiceType = Class.create();
FetchPromptStrctureBasedOnChangeServiceType.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
// Function to fetch questions based on the selected type
getQuestionsBasedOnType: function() {
var promptStructure;
var selectedType = this.getParameter('sysparm_selectedType');
gs.addInfoMessage("serverSideType" + selectedType);
// Query the 'ServiceType' table and retrieve questions
var serviceTypeGR = new GlideRecord('ServiceType');
serviceTypeGR.addQuery('type', selectedType);
serviceTypeGR.query();
if (serviceTypeGR.next()) {
promptStructure = serviceTypeGR.getValue('promptstructure');
}
return promptStructure; // Return an empty string if PromptStructure is null
},
type: 'FetchPromptStrctureBasedOnChangeServiceType'
});
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 11:52 AM
Thanks But Still Got null

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 02:00 PM
Are you sure the table name serviceType is correct? If it is a custom table, table name could be u_servicetype and field name could be u_type/
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 05:07 PM
I create a private scope application so when we create a table name one is lable that we give name second name define by the system so are you talking about sys define table