Setting up a RITM Short Description & Description form catalog variable.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2023 10:35 AM
Usecase: We want to copy Short Description and Description from catalog variables to RITM table Short description and Description.
There are 3 conditions in use case:
1. It will check in the catalog "Short Description" variable that it is having the data or not. If the data is present in the short description variable, then it'll pass the data to the RITM "Short description" field.
2. If the data is not present in the catalog "Short Description" variable then it'll copy the "Catalog Item Name" and "Requested for" in RITM "Short Description" field.
1. It will check in the catalog "Short Description" variable that it is having the data or not. If the data is present in the short description variable, then it'll pass the data to the RITM "Short description" field.
2. If the data is not present in the catalog "Short Description" variable then it'll copy the "Catalog Item Name" and "Requested for" in RITM "Short Description" field.
3. It will check in the catalog "Description" variable that it is having the data or not. If the data is present in the "Description" variable, then it'll pass the data to the RITM "Description" field.
1. For this we need to write "Before Business Rule" in the RITM table on "insertion" of value.
2. Script:
Here I am passing data for both the variables "Short Description & Description" & it will pass both the variable data to RITM "Short Description & Description" field (refer below image).
(function executeRule(current, previous /*null when async*/) {
// Condition 1st: Checking for "Short Description" variable if value is present in the variable or not If value is there then copy the same value to RITM "Short Description" field.
if (current.variables.short_description){
current.short_description = current.variables.short_description;
}

Here I am passing data of "Short Description" & it will pass the "Short Description" variable data to RITM "Short Description" field (refer below image).

Here I am passing data of "Short Description" & it will pass the "Short Description" variable data to RITM "Short Description" field (refer below image).
// Condition 2nd: Checking for Short Description variable is empty. If Short Description variable is empty then copy the "Catalog Item Name" and "Requested for" in RITM Short Description field. If both Short Description and Requested for variables are empty then pass the "Catalog Item Name" in "Short Description" field.
if (!current.variables.short_description){
if(current.variables.requested_for){
current.short_description = current.cat_item.getDisplayValue() +'- '+ current.variables.requested_for.getDisplayValue();
} else{
current.short_description = current.cat_item.getDisplayValue();
} //if Requested for is not available
}
Here I am passing "Short Description" variable as empty It'll take catalog name and requested for as a short description in RITM "Short Description" field (refer below image).
Here I am passing "Short Description & Requested for" variables as empty It'll take catalog name as a short description in RITM "Short Description" field (refer below image).
// Condition 3rd: Checking for Description variable if value is present in the variable or not If value is there then copy the same value to RITM "Description" field.
if (current.variables.description){
current.description = current.variables.description;
} })(current, previous);


Here I am passing data of "Description" & it will pass the "Description" variable data to RITM "Description" field (refer below image).
Note: I have taken an example of "Description" and "Short Description" variable likewise you can use, variables as per your requirements.
Thank you,
Chinmay Batra
- 1,260 Views
0 REPLIES 0