1 Reply Latest reply on May 25, 2018 12:11 PM by 3387536

    How to get the display name of the combo box value ?

    3573548

      Hey,

       

      I'm trying to get the value of a Single select list (Combo box) from the Form UI into the custom code. I'm using "$SearchAccountEntityDetailArchetypeRecord.getValue('ref2BusinessUnit');" where ref2BusinessUnit is the variable name of the combo box. But using this, I get the ID of the value(option of combo box), not the display name.

       

      So, can you please please help me with a way where I can get the display name of the option value?

       

      P.S. I've also tried using "$SearchAccountListArchetypeRecord.getValue('ref2BusinessUnit')". But this did not fetch me anything. Returned null.

       

       

      Thanks!!

        • 1. Re: How to get the display name of the combo box value ?
          3387536

          Hi

           

          I had the same use case. Go back to the reference table to get the display value.

          You can use the ABCS.entities to read the entity filtered with an operation equals to the id and get the display field.

           

          Something like this

           

          require([

              'operation/js/api/Conditions',

              'operation/js/api/Operator'

          ], function(Conditions, Operator) { 

           

           

              var loc = Abcs.Entities().findById('Location');

              var id = loc.getProperty('LocationId');

           

           

              var locname;

           

           

              var condition = Conditions.SIMPLE(id, Operator.EQUALS, $com_oracle_abcs_fa_G06iS_ReceiptsEntityDetailArchetypeRecord.getValue('ref2LocationBranch'));

              var operation = Abcs.Operations().read({

                  entity: loc,

                  condition: condition

           

           

              });

              operation.perform().then(function(operationResult) {

                  if (operationResult.isSuccess()) {

                      console.log("success");

          }}

          ).catch(function(operationResult) {

                  if (operationResult.isFailure()) {

           

           

                      // Insert code you want to perform if fetching of records failed

           

           

                      alert('didnt work 1');

          }

           

           

              });

           

           

           

           

          });

           

           

           

           

          resolve();

           

          I am not sure if there is a direct way to get the display field and the code field.

           

          Regards