I need to take the selected values in a Multi-Relational Field and populate the available values in a Single Relational field with it.
I have a multi-relational field that is called Based on. I need to populate my available selections for my single Relational field called Reported Against with the selected values from Based On. I'm not sure if I need to use a combo box to temporarily store values or if I get this working use something like JSON or Javascript? any samples of doing something similar would be helpful.

Accepted Answer

Thursday, June 07 2018, 03:46 PM - #Permalink
Charity see if you can make sense of this.
1. You need to enable jquery on your custom form by clicking on the Javascript tab and making sure the box is checked.
2 Replace the appropriate field names for my code with your Based On and Reported Against fields if they are different.
3. Add this code to a form action that fires on load and runs a javascript and paste this in the js area.

var boid = GetFieldByName("Based On").id
var boitems = $("[class^=" + boid +"]")

var boArray=[];
for (i = 0; i < boitems.length; i++) \{

var raid = GetFieldByName("Reported Against").id
var raitems = $("#" + raid +" option")

var raArray=[];
for (i = 0; i < raitems.length; i++) \{

var toRemoveArray;
toRemoveArray = $.grep(raArray, function(value) \{
return $.inArray(value, boArray) < 0;

for (x = 0; x < toRemoveArray.length; x++) \{
$("#" + raid + " option[value='" + toRemoveArray[x] + "']").remove();

Basically this looks at all the items selected already in "Based On" and removes the unselected values from the "Reported Against" field.
The reply is currently minimized Show
Responses (3)
  • Accepted Answer

    Thursday, June 07 2018, 09:57 AM - #Permalink

    Is the "Based On" field filled out prior to the point where "Reported Against" is needed or are both fields filled out on the same transition? In other words will the value of Based On already be set by the time we need to fill in the Reported Against field?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 07 2018, 10:36 AM - #Permalink
    The Based on field is filled out previously and read only during this transition.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 07 2018, 12:55 PM - #Permalink
    You could probably do this with some clever javascript but the Single Relational field would probably have to be the type that shows all the values either with a option list or checkboxes. Meaning not the type that you have to search to find the available options. Let me know if yours is like that and we can probably come up with something.
    • Charity Pearsall
      more than a month ago
      Yes, my single relational field is showing all values, not the search type.
    The reply is currently minimized Show
Your Reply

Recent Tweets

RT @TrainingsEdu: Potřebujete získat znalosti o produktu Micro Focus UCMDB, porozumět základním pojmům a aplikacím? Na kurzu Universal CMDB…

by Micro Focus Support