Autopopulate the image
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-21-2023 02:16 AM
I am created the one filed in the incident table
field name : profile image
type: image
in user table one field is there name is upload image
my requirement is when we are created the incident record we are select the caller right which person we are selected that person image auto populate the our field value(in the incident table).
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-21-2023 03:41 AM
HI @Venky Kshatriy2 ,
I trust you are doing great.
- Create a Business Rule on the Incident table:
- Name the Business Rule (e.g., "Auto Populate Profile Image").
- Set the 'When to run' field to "Before" and 'Insert' as the 'Insert' and 'Update' option.
- Add a condition to check if the "caller" field (reference to the user table) is not empty.
- In the Business Rule script:
- Retrieve the "caller" record from the User table based on the selected caller.
- Get the value of the "upload image" field from the caller record.
- Set the value of the "profile image" field in the current incident record to the value of the "upload image" field.
Here's an example of the script in Javascript:
(function executeRule(current, previous /*, g*/) {
// Check if the "caller" field is not empty
if (current.caller) {
// Retrieve the "caller" record from the User table
var caller = new GlideRecord('sys_user');
if (caller.get(current.caller)) {
// Get the value of the "upload image" field from the caller record
var uploadImage = caller.upload_image;
// Set the value of the "profile image" field in the current incident record
current.profile_image = uploadImage;
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi