Highlighted
sivabalan_n Absent Member.
Absent Member.
3386 views

Unable to retrieve Relation field value using Javascrip

We have recently upgraded from SBM R4.05 to SBM 11. Existing javascript which retrieves Relation field value ID using javascript was working after upgrade its not working. Can someone guide me how to retrieve the same?

Code snippet
Product is a relational Field
var Product_Id = LookupFieldId( "Product");
var ProductId = document.getElementById(Product_Id).ivalue;

Now ProductId holds undefined value . It was working before the upgrade.

Thanks in Advance,
0 Likes
2 Replies
lisa_carver2 Absent Member.
Absent Member.

Re: Unable to retrieve Relation field value using Javascrip

This is what we have in one of our javascripts:

DIM_PRODUCT is a single relational field.

var prodfield = GetFieldByName("DIM_PRODUCT");
var productid = prodfield.options[prodfield.options.selectedIndex].value;
bamos Absent Member.
Absent Member.

Re: Unable to retrieve Relation field value using Javascrip

Your code seems to work fine for me in the latest version with the small exception of the syntax error in your example.

var Product_Id = LookupFieldId( "Product");
var ProductId = document.getElementById(Product_Id).ivalue;

The last line should end in .value not .ivalue
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.