- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2021 05:47 PM
Hello,
I'm a novice when it comes to building widgets.
Instead of using catalog client script and script include, I have a requirement that we write our logic in widget (using client controller and server script)
I've already written the logic, and it's working fine.
Can somebody assist me in building the client controller and server scripts for this?
Catalog Client script code:
var ga = new GlideAjax('saveDefaultDeliveryPreferences');
ga.addParam('sysparm_name','savingCountryAndDeliverAddress');
ga.addParam('sysparm_country', g_form.getValue('country'));
// ga.addParam('sysparm_delivery', g_form.getValue("delivery_address"));
ga.getXML(updatePrefernceDetails);
function updatePrefernceDetails(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
Script include code:
var saveDefaultDeliveryPreferences = Class.create();
saveDefaultDeliveryPreferences.prototype = Object.extendsObject(AbstractAjaxProcessor, {
savingCountryAndDeliverAddress: function(){
var country;
var currentUser = gs.getUser();
var sysId = this.getParameter("sysparm_country");
if (sysId) {
var gr = new GlideRecord("cmn_location");
if (gr.get(sysId)) {
country = gr.getValue("country");
}
}
country = JSON.stringify(country);
currentUser.savePreference('defaultCountry',country);
},
type: 'saveDefaultDeliveryPreferences'
});
Regards,
Sneha
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2021 08:23 PM
Couple of links are mentioned below which are quite good for learning Service POrtal widgets:
https://www.youtube.com/watch?v=Jav32aDEz1I
https://www.youtube.com/watch?v=0gz3XzBM-Gs
https://developer.servicenow.com/print_page.do?release=paris&category=courses&identifier=app_store_learnv2_serviceportal_paris_service_portal&module=course
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/build/service-portal/concept/widget-dev-guide.html
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/build/service-portal/concept/adv-widget-tutorial.html
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2021 02:41 AM
This line "and I need to capture their details based on user preference in order to avoid modifying the sys_user table." is not clear to me on what you are trying to accomplish here.
Your widget looks okay to me. If you can let me know your detailed requirement, I can help you to modify your widget code accordingly and achieve what you want here.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2021 03:01 AM
Requirement:
- Client wants to store some information related to the user during ordering process.
- The user will be asked if he wants to keep these information for the next order.
Solution
- The idea is to use “user preference” capability instead of modifying the sys_user table.
- Those are visible only for the user (he can see only his own preferences) and the administrators.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2021 06:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2021 08:23 PM
Couple of links are mentioned below which are quite good for learning Service POrtal widgets:
https://www.youtube.com/watch?v=Jav32aDEz1I
https://www.youtube.com/watch?v=0gz3XzBM-Gs
https://developer.servicenow.com/print_page.do?release=paris&category=courses&identifier=app_store_learnv2_serviceportal_paris_service_portal&module=course
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/build/service-portal/concept/widget-dev-guide.html
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/build/service-portal/concept/adv-widget-tutorial.html
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke