Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2024 08:27 AM
In below widget I want to send data to client side. Its not working
Server:
var user = gs.getUser();
var roleCheck = user.hasRole("snc_internal");
var userGr = user.getRecord();
var x = gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();
if (x.indexOf("supplier") >= 0) {
// if (roleCheck && (userGr.getValue("u_user_type") == "Guest") && (!userGr.getValue("u_org_id"))) {
var y = "https://supplierportal.asda.uk/supplier?id=kb_article_view&sysparm_article=KB0034151";
data.returnUrl = y;
//gs.addInfoMessage(roleCheck);
// }
}
Client:
api.controller=function($scope, spUtil) {
/* widget controller */
var c = this;
function get() {
spUtil.update($scope);
}
if(c.data.returnUrl != ""){
window.location.href = returnUrl;
}
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2024 09:45 AM
Hi @Rosy14 Try below code
Client Side:
api.controller = function($scope, spUtil) {
var c = this;
function get() {
spUtil.update($scope);
}
if (c.data.returnUrl) { // Check if returnUrl is not empty or undefined
window.location.href = c.data.returnUrl; // Use c.data.returnUrl
}
};
Server Side:
(function() {
var user = gs.getUser();
var roleCheck = user.hasRole("snc_internal");
var userGr = user.getRecord();
var x = gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();
if (x.indexOf("supplier") >= 0) {
var y = "https://supplierportal.asda.uk/supplier?id=kb_article_view&sysparm_article=KB0034151";
data.returnUrl = y;
} else {
data.returnUrl = "";
}
})();
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2024 09:45 AM
Hi @Rosy14 Try below code
Client Side:
api.controller = function($scope, spUtil) {
var c = this;
function get() {
spUtil.update($scope);
}
if (c.data.returnUrl) { // Check if returnUrl is not empty or undefined
window.location.href = c.data.returnUrl; // Use c.data.returnUrl
}
};
Server Side:
(function() {
var user = gs.getUser();
var roleCheck = user.hasRole("snc_internal");
var userGr = user.getRecord();
var x = gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();
if (x.indexOf("supplier") >= 0) {
var y = "https://supplierportal.asda.uk/supplier?id=kb_article_view&sysparm_article=KB0034151";
data.returnUrl = y;
} else {
data.returnUrl = "";
}
})();