Populating form data with FDM from a REST Service | Community
Skip to main content
June 4, 2020
Solved

Populating form data with FDM from a REST Service

  • June 4, 2020
  • 4 replies
  • 3137 views

Hi 

 

I have created a FDM based on REST service.In my Adaptive Form , I created a rule to invoke the FDM service using AuthID input parameter.This should return me a jason response.How do I map this response back to my form, since i am getting null when trying to map in a textField. Also tried to create a variable and mapped into that but receiving null/undefined.

 

When i am directly testing my FDM through Test Service I get a proper response,

 

Kindly help.

 

Thanks ,

Leena Jain

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AkAgarwal

Dear @leenajain ,

 

As you mentioned you have already tested api response using fdm read service. So there can't be problem in rest API. But when you created an AuthID input parameter in adaptive form then some rules can be set by invoking the required service and setting up the correct output elements. This will prefill your adaptive form elements based on AuthId entered from rest API. Please go through this article as i found this helpful.

https://medium.com/adobetech/using-external-data-sources-in-aem-forms-with-openapi-swagger-specifica...

Thanks

4 replies

Mayank_Gandhi
Adobe Employee
Adobe Employee
June 8, 2020

@leenajain  please post the test response of FDM from fdm test UI.

LeenaJaINAuthor
June 9, 2020

HI Mayank,

 

following response from FDM:

 

{
    "id": "1234",
    "dob": "07/30/1978",
    "name": {
        "first": "yriur",
        "middle": "ckjhc",
        "last": "yeiuhr"
    },
    "accounts": [
        {
            "accountNumber": "1234",
            "primaryPhone": "35474894004",
            "mailingAddress": {
                "street": "310 ",
                "city": "WEAVERVILLE",
                "state": "NC",
                "zip": "28787"
            },
            "ownerType": {
                "type": "JOINT",
                "description": "JOINT "
            },
            "primaryEmail": "noemail@test.com",
            "owners": [
                {
                    "name": {
                        "first": "JAY",
                        "middle": "IAN",
                        "last": "FINE"
                    }
                }
            ]
        }
    ]
}

June 11, 2020

Dear Leena,

 

Please try setup your adaptive form input field AuthID's rules.

Thanks

AkAgarwalAccepted solution
June 11, 2020

Dear @leenajain ,

 

As you mentioned you have already tested api response using fdm read service. So there can't be problem in rest API. But when you created an AuthID input parameter in adaptive form then some rules can be set by invoking the required service and setting up the correct output elements. This will prefill your adaptive form elements based on AuthId entered from rest API. Please go through this article as i found this helpful.

https://medium.com/adobetech/using-external-data-sources-in-aem-forms-with-openapi-swagger-specifica...

Thanks

LeenaJaINAuthor
June 12, 2020
Thanks for your response,I am able to map the FDM to the Form.The problem I am facing is that the entire response comes as a jason which was coming properly in FDM but not on the Adaptive Form.I want it as individual fileds like in the video you shared.So I modified my swagger file to reference a schema in the response.But when i upload this back to the data source, it does not accept that swagger fileIn swagger.io it shows a valid swagger , but in AEM Forms it gives error that check your swagger definition..