- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2024 06:24 AM
I have requirement - create a variable Account name with the type single line text.
Account name should generate depands on requested for value(the value coming from order confirmation page, by default requested for value displays currently logged in user name but end user can select different username. account name should generate based on requested for value).
* Account name value generated with the below conditions:
When variable category = A and variable location = abc
generate the account name - xadmin+requested for user id
When variable category = B and variable location = xyz
generate the account name = tuser+requested for user id
Pls assist me,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2024 11:27 AM
Hello @Deepa12
You can achieve this requirement using before insert BR on your specific catalog item.
I will place the screenshots below, please update as per your scenario:
CODE:
(function executeRule(current, previous /*null when async*/ ) {
if (current.variables.category == 'a' && current.variables.location.city == 'Baltimore') { //replace with your location and category values
current.variables.account_name = 'x-admin' + current.requested_for.user_name;
} else if (current.variables.category == 'b' && current.variables.location.city == 'Lakewood') { //replace with your location and category values
current.variables.account_name = 'tuser' + current.requested_for.user_name;
}
})(current, previous);
NOTE: Make sure to give your variable names and fields correctly.
Hope it helps:)
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2024 11:27 AM
Hello @Deepa12
You can achieve this requirement using before insert BR on your specific catalog item.
I will place the screenshots below, please update as per your scenario:
CODE:
(function executeRule(current, previous /*null when async*/ ) {
if (current.variables.category == 'a' && current.variables.location.city == 'Baltimore') { //replace with your location and category values
current.variables.account_name = 'x-admin' + current.requested_for.user_name;
} else if (current.variables.category == 'b' && current.variables.location.city == 'Lakewood') { //replace with your location and category values
current.variables.account_name = 'tuser' + current.requested_for.user_name;
}
})(current, previous);
NOTE: Make sure to give your variable names and fields correctly.
Hope it helps:)
Murthy