Visual Builder

Get Involved. Join the Conversation.

Topic

    Cesar Tepetla Corte
    Problem to send the payload of reading a file in Visual...
    Topic posted July 17, 2019 by Cesar Tepetla CorteBronze Medal: 1,250+ Points, tagged Action Flows, Custom Code, Database, JET, Process, REST, Services, Web 
    55 Views, 7 Comments
    Title:
    Problem to send the payload of reading a file in Visual Builder to the RESTful web service of Apex
    Summary:
    Problem to send the payload of reading a file in Visual Builder to the RESTful web service of Apex
    Content:

    The requirement consists of a screen in Visual Builder that uses a file picker to upload a CSV file to a database.

    I have developed the screen and can read the files correctly.

    I have developed a package and a RESTful Web Service for the invocation and use of that package.

    I have tried the Rest service from Postman and it works without problem, then I have consumed it in Visual Builder and the test works well.

    Then I configure the service within an action in a button.

    The strange thing starts when I run the Visual Builder screen and everything indicates that all the execution was correct but when checking the database I insert an empty data, checking the browser console the request if it contains information and still insert it blank.

    I repeated that test but this time I created an OIC integration that receives the same payload and with ICO if it worked correctly

    What can be happening?

    Comment

     

    • Shay Shmeltzer

      In the browser's dev tool console - do you see the call to the REST service in the network tab return successfully?

      Does the payload that you are passing seems to be formatted correctly?

      Maybe you can add some debugging messages to your PL/SQL layer to see if the execution of the service runs into any issues.

       

      • Cesar Tepetla Corte

        Hi,

        The console returns a payload like this:

        {"File_content" "UNIT, PERIOD, COMPANY, ID_ORGANIZACION, ID_LIBRO_CONTABLE, ID_PERSONA_REG, NUMERO_EMPLEADO_REG, ID_PERSONA_DIS, NUMERO_EMPLEADO_DIS, ID_PERSONA_SUP, NUMERO_EMPLEADO_SUP, ID_PERSONA_GTE, NUMERO_EMPLEADO_GTE, NUMERO_EMPLEADO_CHEFF_GTE, COMMENTS, TIPO_SUPERVISOR, CREATED_BY, LAST_UPDATED_BY, CREATION_DATE, LAST_UPDATE_DATE, ID_PERSONA_CHEFF_GTE \ r \ n0101, May-15,2525,300000001698016,78563,300000002861315,22,4855, e4730,155, e855,455,255,7525, None, P ,,, 17-JUN-19 09.06.30.000000 PM ,, 1525 \ r \ n "}

        In the layer of sql I have the exception 'when others' but does not mark error at any time.

        • Shay Shmeltzer

          If you use this payload and call your service from POSTMAN - does it work?

          • Cesar Tepetla Corte

            Effectively, but I have discovered why

            I found the error the name used in the PL / SQL layer parameter was different from the name of the variable that contained the content of the file in VB so it would send empty even if the request had information.

            Now I have another problem when VB sends the payload send it similar to this:

            {
            "content_file": "" it's, a, test \ r \ nusing, file, picker \ r \ n "",
            }

            But the package does not seem to recognize the data entry and does not insert anything in the database, probe the payload in Postman and it works only if you add additional slash for example:

            {
            "content_file": "" it's, a, test \\ r \\ nusing, file, picker \\ r \\ n "",
            }

            For this slash \\ additional makes the request payload fine work

            but I can not alter the request payload sent by VB, how can I handle this so that it works correctly?

            • Shay Shmeltzer

              Since the value you are sending from VB is stored in a variable, you can pass this variable to a page module javascript function that will create a modified value.

              Call this page module function in your action chain, then take the value it returns and assign it to the variable in VB using the assign variable action, then call the REST service with the variable containing the modified value.

               

              • Cesar Tepetla Corte

                I have tried this but it does not work this is due to the allocation of line breaks by using \ r \ n you have until the action string triggers when the variable has stored the value does not contain \ r \ n only until the browser sends the request.

                • David Konecny

                  When you load CSV into a variable in VB what line delimiters does the text have? Whatever the delimiter is you should be able to change it the way Shay suggests.

                  -David