Update single line field content if user changed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2024 01:17 AM
Hi!
Currently i have catalog item, which has some fields and one of them is reading logged in user info like mobile phone number and adds it in one of single line text fields.
User field is ordering_for and field where phone number is displayed is called 'mobile_phone_number' and in it has Default Value with following: javascript:gs.getUser().getRecord().getValue('mobile_phone');
which basically reads mobile_phone from table.
The problem is now, if i change user in ordering_for, it still shows in phone number field logged in user number(since it has getUser) not the one in ordering_for.
Should I remove completely default value and write some on change script or i can add some additional function in Default value? And if I can update Default value, what should be there added?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2024 02:02 AM
@Julius28 You on create an onChange client script for "ordering_for" and call the script include as below to populate the value.
Client script :
Script include :
Thanks,
Sujatha V.M.
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2024 02:19 AM
Hi @Julius28,
If you are not using the 'Requested for' type variable, you can set the default value of the 'ordering_for' variable as the current user. (e.g. javascript: gs.getUserID();)
Then with the 'mobile_phone_number' variable, remove the default value and use the 'Auto-populate' functionality. Something like the below:
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2024 03:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2024 12:47 PM
Yup, if you are using 'Requested for' variable, it should auto-populate with the current user.
Hence you don't need the default value for the variable.
Then use the same logic as above to get the mobile number using the 'Auto-populate'.
Cheers