Active flag in UI script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 11:12 PM
I want to add active= true flag in below code please let me know how to do it I tried multiple ways.
UI script:-
function getProcessXML(tableName,input,outputAttr)
{
var strArr =JSON.stringify(input);
// OutPut Value
var output = JSON.stringify(outputAttr);
var ga = new GlideAjax('SysAjaxCall');
ga.addParam('sysparm_name', 'getInformation');
ga.addParam('sysparm_table', tableName);
ga.addParam('sysparm_input', strArr);
ga.addParam('sysparm_output', output);
return ga;
}
client script where getProcessXML called:-
function onChange(control, oldValue, newValue, isLoading) {
if(isLoading){
return;
}
var prefix = g_form.getValue('email_prefix');
var suffix = g_form.getValue('email_suffix');
setEmailAddress(false, prefix, suffix, control);
}
function setEmailAddress(existingMailbox, prefix, suffix, control){
var input = new Object();
if(existingMailbox != false){
if(existingMailbox.u_email != undefined){
g_form.setValue('mailbox_email', existingMailbox.u_email);
}
return;
}
if(existingMailbox == false){
var adjustedPrefix = prefix.replace(/\s/g, '');
var emailAddress = adjustedPrefix + suffix;
g_form.setValue('mailbox_email', emailAddress);
checkExistingMailbox(emailAddress, control);
}
function checkExistingMailbox(emailAddress, control){
var prefix = g_form.getValue('email_prefix');
var suffix = g_form.getValue('email_suffix');
if(prefix != '' && suffix != ''){
g_form.hideAllFieldMsgs();
input["u_email"] = emailAddress;
input["active"] = true;
// OutPut Value
var out = ["u_email"];
// Table Name
var tableName = 'u_orch_group_mailbox';
var xmlObj = getProcessXML(tableName,input,out);
xmlObj.getXML(processMailboxes);
}
}
function processMailboxes(response){
var Attribute = response.responseXML.getElementsByTagName("Attribute");
//if (Attribute[0] != undefined) {
//if(Attribute[0].getAttribute("value") != undefined){
if(Attribute.length > 0 ){
getMessage('Mailbox ' + prefix + ' already exists with this email address: ' + emailAddress + '. Please revise email address and mailbox name.',function(msg) {
g_form.showFieldMsg('new_mailbox', msg, "error");
});
//alert( 'Mailbox ' + prefix + ' already exists with this email address: ' + emailAddress + '. Please revise email address and mailbox name.');
g_form.setValue('new_mailbox', '');
}
//}
}
}
Regards,
Tejal Zete
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 11:22 PM
Hello,
There are multiple if conditions in the client script.
In what scenario do you want to add active=true?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 12:28 AM
Hi Vishwa,
Want to show
getMessage('Mailbox ' + prefix + ' already exists with this email address: ' + emailAddress + '. Please revise email address and mailbox name.',function(msg) {
g_form.showFieldMsg('new_mailbox', msg, "error");
});
this message when DL is active = true only and for this getting result from getProcessXML() from UI script please check in client script where UI script getProcessXML() function called.