This is a public Forum  publicRSS


    David Callaghan
    BUI - getFieldValues Synchronously
    Topic posted April 13, 2018 by David CallaghanJourneyer 
    22 Views, 3 Comments
    BUI - getFieldValues Synchronously


    Is there a way to make the code (below) wait for the Promise to complete and get the values before before it moves on (synchronously)?

    - At the minute I would have to setup the getFieldValues and run the call to use the field within the getFields

    - I want to obtain a field value mid-function and really want to wait for the field to be available without having to chain together lots of calls to make it work



    Code Block:



    • Edson Junior

      Hi David,

      Would you mind to elaborate a little bit more your use case/requirement? What you gonna do with the field value?


    • David Callaghan

      Hello Edson,

      I'm creating a BUI Analytics Report add-in with Virtual tables which will sit in an Incident Workspace in BUI and be loaded with data from an external source

      For the report:

      - I'm using the AddTableDataRequestListener and Virtual Tables

      - The report will load data from a system external to OSvC

      - The report will be prepared on load with the data from an external service and also if the user changes the value it should refresh the results in the report (I will do this via a Named Event Listener)

      Looking at the documentation:

      I need to create a function which returns Report Data and load this up, however in order to prepare that data I need each time to read a value from the Incident workspace. So i was hoping to do this synchronously and then simple prepare and return the report data.



    • Edson Junior

      Sounds good. If I understood correctly, you need to handle report data based on the incident data (correct me if I am wrong).
      If that is the case, I think you could explore to use Report Script (PHP on the report load event) as well. With that, you can let the report handle the data that will be shown. 

      Honestly, I haven't tried this approach yet, but might be something that you can explore to confirm the feasibility and benefits.