About client script and ui policy

VaishakhiN
Giga Contributor

Show an alert with assignment group members when the assignment group changes. Please give me the code for this question.

Also explain when to use client script and script include

1 ACCEPTED SOLUTION

GlideFather
Tera Patron

Hi @VaishakhiN,

 

This forum is to support one another, but not a job market to assign people doing your job. Please, don't expect anyone to do your efforts. 

 

You should always start yourself, explaining what you tried, where you searched, what you found, what's your doubts, the efforts must go both ways.

 

You can start with GlideAjax Example Cheat Sheet (UPDATED) there's a template-ish explanation.

 

Also, your description is very vague and unclear to give you meaningful advice.

 

Maybe you can start yourself and then share the code you wrote and describe what happened and what you want to happen instead of it. How does that sound to you?

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


View solution in original post

2 REPLIES 2

GlideFather
Tera Patron

Hi @VaishakhiN,

 

This forum is to support one another, but not a job market to assign people doing your job. Please, don't expect anyone to do your efforts. 

 

You should always start yourself, explaining what you tried, where you searched, what you found, what's your doubts, the efforts must go both ways.

 

You can start with GlideAjax Example Cheat Sheet (UPDATED) there's a template-ish explanation.

 

Also, your description is very vague and unclear to give you meaningful advice.

 

Maybe you can start yourself and then share the code you wrote and describe what happened and what you want to happen instead of it. How does that sound to you?

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hi @GlideFather, Thank you so much for guiding me as I'm still learning how to ask question effectively. 

As a new to this platform, I have tried below code,

In script include i tried - one thing i would like to ask why i am not getting Client Callable option ? it has GlideAjax enabled but it is same as client callable?

var GetGroupMembers = Class.create();
GetGroupMembers.prototype = {
initialize: function() {},

getMembers: function(groupId) {
var members = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', groupId);
gr.query();
while (gr.next()) {
members.push(gr.user.name.toString());
}
return members.join(', ');
},

type: 'GetGroupMembers'
};

== On a client side 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') return;

var ga = new GlideAjax('GetGroupMembers');
ga.addParam('sysparm_name', 'getMembers');
ga.addParam('sysparm_groupId', newValue);
ga.getXML(function(response) {
var result = response.responseXML.documentElement.getAttribute("answer");
alert("Group Members: " + (result || "No members found"));
});
}

 

where i am wrong and why my code is not working as whenever i am  changing assignment group it is giving on No Member found alert but not entering into database.

Kindly help