- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:33 AM
Hello All,
Like I have 3 fields are there which are single line text fields, so when user enter a value in first name as haresh and lastname as haru then the third field should population haresh haru as the display name in portal catalogue form..
Regards,
Haresh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:37 AM
Hi,
You need 2 Onchange Client scripts running on first name and last name fields. On each script read the current field and combine it with second field and populate to third field
Something like below
var fName = g_form.getValue('<first name field>');
var lName = g_form.getValue('<last name field>');
g_form.setValue('<Full name field>', fname + lName);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 03:32 AM
Try this
var fname = g_form.getValue('first_name');
var lname = g_form.getValue('last_name');
var ans = fname + ' ' + lname.toString().toUpperCase();
g_form.setValue('display_name',ans);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 03:47 AM
Hello @Anurag Tripathi
Its working as expected but if the user is giving first name also it has come first letter as capital like this 'haresh haru' then it showuld show "Haresh HARU (Guest)"
can you please help me to get fisrtname first letter as upper case other letters in lower case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 04:01 AM - edited 03-21-2024 04:01 AM
USe this
var fname = g_form.getValue('first_name');
var lname = g_form.getValue('last_name');
var ans = fname.toString().toLowerCase();+ ' ' + lname.toString().toUpperCase();
g_form.setValue('display_name',ans);
Please mark the response as correct if this answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:41 AM
you can write on change () catalog client script on related catalog item.
OnChange() function to be called on lastname , then set the 3rd field using value of first name and last name.
You may want to check if first name is not empty.
You can set this client script to run UI type as All or Service Portal and applies on catalog item view as true.
Regards,Sushant Malsure