Rename variable from parent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 07:37 AM
Hi,
We have cases where assigned to is a reference from sys_user.
From the cases we can create tasks and on this task I want to present the assigned to's name and email. If I just go to form layout and choose parent.assigned_to.name and parent.assigned_to.email then the fields just says "name" and "email" on the task, I want to clairfy these and name them "Case assignee name" and "Case assignee email". How do I do this?
thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 09:51 AM - edited ‎12-07-2023 09:51 AM
You would have to create two new fields on your sn_customerservice_task table (with the type of String), add these to the task form instead, then create a before Insert Business Rule on the same table with a script to populate the two fields from the parent field. This will allow you to put whatever Column label you want on the two fields and it won't affect the sys_user table fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2023 03:54 AM - edited ‎12-10-2023 02:39 PM
-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2023 04:14 AM
Sure. Let's say the fields you create on the sn_customerservice_task table are named u_name and u_email for simplicity. The script can dot-walk these, so it would just look like this:
(function executeRule(current, previous /*null when async*/) {
current.u_name = parent.assigned_to.name;
current.u_email = parent.assigned_to.email.toString();
})(current, previous);
The email field type can be a bit odd when showing it in a string field, so that last bit just forces it to look like you expect instead of having the internal formatting to make it an email address.