Populate field based on another field

Ajith A Pillai
Tera Contributor

Hi All,

I have a small requirement if anyone can help it would be great.

The Requirement is I have created an order guide which includes two catalog items. Inside this order guide there is field which is called 'ports', which is created in a variable set. This needs to be filled by the requestor while submitting the order guide. Based on filling this field i have to populate a field called Dangaerous port as 'Yes or No' in the RITM record in Agent workspace.

 

For eg: if the requestor is filled the port number as 80 i wanted to populate the dangerous port as Yes in the RITM record that should visible in the agent workspace. If he fills the port as 100 i wanted to populate the dangerous port as No in the RITM record. 

 

How can we achieve this?. If anyone worked on this, please help me with the full steps to achieve this.

 

Thanks in advance

 

Regards,

Ajith Pillai

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

You can add the logic to the Flow (or Workflow) associated with the catalog item.

Something like:

  • look up variable value (sc_item_option) record for the "Ports" question, for the current Requested Item
  • look up variable value (sc_item_option) record for the "Dangerous" question
  • if the value in 1st lookup contains 80:
    • update that 2nd lookup record with value "Yes"
  • else
    • update that 2nd lookup record with value "No"

View solution in original post

4 REPLIES 4

-O-
Kilo Patron
Kilo Patron

You can add the logic to the Flow (or Workflow) associated with the catalog item.

Something like:

  • look up variable value (sc_item_option) record for the "Ports" question, for the current Requested Item
  • look up variable value (sc_item_option) record for the "Dangerous" question
  • if the value in 1st lookup contains 80:
    • update that 2nd lookup record with value "Yes"
  • else
    • update that 2nd lookup record with value "No"

Community Alums
Not applicable

Hi @Ajith A Pillai .

I checked your problem in my PDI and you can refer below script 

You can create OnChange client script and it will work on the change of port variable. Please add below code 

alert('New Value = ' + newValue)
if(newValue == 80 || newValue == '80'){
	g_form.setValue('dangerous_port', true);
}if(newValue == 100 || newValue == '100'){
	g_form.setValue('dangerous_port', false);
}

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

 

-O-
Kilo Patron
Kilo Patron

When you say

a field called Dangaerous port ... in the RITM

do you really mean a field of table Requested Item, or is it also a variable?

Cause if it is really a field on the table (as opposed to a variable) the solutions suggested thus far will not work.

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Ajith A Pillai ,

 

You can create a script in the begining of the workflow which checks if the ports is 'dangerous' Yes/no. Based on the check you can update the value in RITM. You can refer the below script logic.

 

var ports = [80, 8080, 5986, 162, 161]; // add all the dangerous ports which you wanted to set the value as yes in RITM
var userSelectedPorts = g_form.getValue('user_selected_ports'); // Replace 'user_selected_ports' with the actual field name
var userPortsArray = userSelectedPorts.split(',');
var portFound = false;
for (var i = 0; i < userPortsArray.length; i++) {
    if (ports.includes(parseInt(userPortsArray[i]))) {
        portFound = true;
        break;
    }
}
if (portFound) {
    g_form.setValue('rimt_variable_checkbox', 'yes'); // Replace 'rimt_variable_checkbox' with the actual checkbox variable name
} else {
    g_form.setValue('rimt_variable_checkbox', 'no'); // Replace 'rimt_variable_checkbox' with the actual checkbox variable name
}

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect