How to call email address from Sys Prop. to ctalog variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2025 01:08 AM
Hi,
for a custom application we have created a record producer, in the form we have a choice field(wd_list) having 4 choices and a single line text(email_list) field. Now the requirement is, for every choice selected in the wd_list we want to copy email address in email_list field.
I have already created 4 sys properties storing the required email addresses. Now, I am stuck at copying the email addresses to the email_list field.
please assist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2025 03:07 AM
Hello @Puneet4418 ,
There's a better approach to this. Just let the end user select the choices and in the Record producer script, get the Choices selected and map the email addresses to the field using gs.getproperty().
If you want your end users to see the email_list field, then you need to write a on_change client script and use GlideAjax to get the Property and add in the email_list field.
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2025 04:02 AM
@Najmuddin Mohd Thanks for your response.
I am trying with second approach. I have created a script include and calling that in On-Change catalog client script. However, it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2025 05:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2025 09:48 AM
Hi @Shivalika ,
Script Include:
var mgfdlcatcher = Class.create();
mgfdlcatcher.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getDLList: function(cellName) {
var propName = '';
var dlList = '';
switch (cellName) {
case 'Choice1':
propName = 'Property1';
break;
case 'Choice2':
propName = 'Property2';
break;
case 'Choice3':
propName = 'Property3';
break;
case 'Choice4':
propName = 'Property4';
break;
default:
return '';
}
var gr = new GlideRecord('sys_properties');
if (gr.get('name', propName)) {
dlList = gr.getValue('value');
}
return dlList;
}
});
Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var dlListField = g_form.getField('email_list');
var ga = new GlideAjax('mgfdlcatcher');
ga.addParam('sys_id', g_form.getUniqueValue());
ga.addParam('cellName', newValue);
ga.getXMLAnswer(function(response) {
var dlValue = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue(dlListField, dlValue);
});
}