- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 05:19 AM
I have one use case wherein in a order guide "New Hire" we want to populate the Hiring Managers email id to the "Preferred Email address" in the New Email Account section.
function onLoad() {
// Get the reference to the 'hiring_manager' field
g_form.getReference('hiring_manager', function(reference) {
// Callback function to execute after the reference is fetched
if (reference) {
// Reference is fetched successfully
var hiringManager = reference.email;
alert('Hiring Manager: ' + hiringManager);
// Get the table name of the current form
var currentTable = g_form.getTableName();
alert('Current Table: ' + currentTable);
// Check if the form's category is a specific one and 'new_email' is empty
if (currentTable == 'ni' && g_form.getValue('new_email') === '') {
alert('Inside if condition');
alert('Current Table: ' + currentTable);
alert('new_email: ' + g_form.getValue('new_email'));
// Set the value of the 'new_email' field to the 'hiring_manager' value
g_form.setValue('new_email', hiringManager);
alert('new_email after setting: ' + g_form.getValue('new_email'));
}
} else {
// Unable to fetch the reference
alert('Unable to fetch reference for hiring_manager');
}
});
}
have written this code but still not working
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 06:59 AM
You can use the Cascade variable present in the Order Guide. The following are the steps:
- Check the Cascade Variables checkbox to True.
- Create "Hiring Managers" variable on both Order Guide or Catalog item level (Assuming catalog item already added in the rule base).
- NOTE: The backend name of the variable should be the same on both the Order Guide and Catalog item.
- ALTERNATE: You can create a variable set if you would like to use multiple variables on both the Order Guide and catalog item level. Add the variable set on OG and Item both.
Now whatever you fill on the variable on the Order Guide form, the same will get copied to the variable on the catalog item form. (Because we already marked Cascade Variables as TRUE in step 1)
Thanks!
Please mark this response as correct and helpful if it helps you ✔️👍
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 07:41 AM
@Prithvi Ramesh1 , hope this help to achieve the desire result, please mark as accept solution to close this thread for others.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 06:59 AM
You can use the Cascade variable present in the Order Guide. The following are the steps:
- Check the Cascade Variables checkbox to True.
- Create "Hiring Managers" variable on both Order Guide or Catalog item level (Assuming catalog item already added in the rule base).
- NOTE: The backend name of the variable should be the same on both the Order Guide and Catalog item.
- ALTERNATE: You can create a variable set if you would like to use multiple variables on both the Order Guide and catalog item level. Add the variable set on OG and Item both.
Now whatever you fill on the variable on the Order Guide form, the same will get copied to the variable on the catalog item form. (Because we already marked Cascade Variables as TRUE in step 1)
Thanks!
Please mark this response as correct and helpful if it helps you ✔️👍