Any one please- I need to copy the field value to other field on portal side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 12:24 AM
I have created the catalog item, So in that there is field ( X ) Ref from user table which i have filter with only to get Functional accounts(bots)
So when I have selected email in X field at portal side then field looks as unvisiable, But there is a record. So in order remove confusion for End users.
I have created another field X1 behind to X field, So it should copy the email to this X1 field
But I was not able to do in client script ANY ONE PLEASE HELP!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 01:00 AM - edited 09-14-2023 01:01 AM
You can just use one field if you don't need any additional information. Here is the documentation piece on this. Just search for setValue fn. It accepts the third argument which is the display value for the variable.
function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == '') {
return;
}
g_form.getReference("X", callback);
function callback(user_record){
g_form.setValue("X", user_record.sys_id, user_record.name);
}
}
If you really need two variables for this then you would the onChange script would look something like this:
function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == '') {
return;
}
g_form.getReference("X", callback);
function callback(user_record){
g_form.setValue("X1", user_record.name);
}
}
You could even combine the two values and not have your variable field blank for users. It's a bad experience to have a blank field that actually has values selected.
Based on this, with IF statements, you could present some other field value when you select a bot.
Best,
Zoran Vasic