Override Form Data Model Properties using-form-data-model-service-as-step-in-workflow

Prior to AEM Forms 6.5.13, you had to manually change the cloud services configuration of your form data model to point to different end points or create a completely new form data model.

Override Form Data Model Properties

Prior to AEM Forms 6.5.13, you had to manually change the cloud services configuration of your form data model to point to different endpoints or create a completely new form data model.

AEM Forms 6.5.13 introduced the ability to override Form Data Model properties to make it easy to test the Form Data Model against different service endpoints.

The following video demonstrates the feature and the use case

The capability demonstrated in this video requires AEM Forms 6.5.13
In this video, we will take a look at using context of our configuration in AM forms. To demonstrate the use case, I have created an integration of AM forms with ServiceNow using cloud services configuration and a form data model. So what you see on my screen is a simple cloud services configuration, which is connecting to a ServiceNow instance on Dev 1 7 1 2 3 3. The username is AES.creator and I provided the password.
Based on this cloud services compilation a form data model was created. And I’ve created a form which would insert a row in ServiceNow to create an incident. So this is my short description and comments. And when I click on this, it would create an incident in that particular instance of ServiceNow which I showed you earlier. So these are all the various instances that are there in that instance of ServiceNow, incidents which are in that instance of ServiceNow. So now if I want to connect my cloud services configuration to a different instance of ServiceNow in the previous releases of AM forms I had to come here and change the host. And then I had to change the username and password from here, which was not very user friendly. With the version 6.5.13 you can now override these properties using the OSGI configuration here. And the OSGI configuration that you need to open is the Apache Sling Context Aware Configuration Override Provider. Here, you provide a description and these are the properties that I’m overriding here. So the first is the create incident form data model. And that is the property of that form of that cloud services configuration called service endpoint. And that’s the new value. In a similar manner, I’m overriding the user name and the password for create incident form data model. And then for the get all incidents form data model I’m doing the same thing, overriding the service endpoint overriding the username and password. If you notice the password is in an encrypted format and to create an encrypted format of your password all you need to do is to go into your OSGI configuration, click on the main, and then crypto support here. And you will come to this screen, enter your password and you’ll get the protected password. So this is the password that you need to specify in your OSGI, in your OSGI configurations over here and notice all the properties need to be enclosed in double quotes. And then make sure you click on this enable, so that these new properties will be taken into consideration when you are in working any action of the phone data model. So save this.
And now if I come back to my form and if I create an incident it’ll be created in that instance of ServiceNow, so let’s say, I say Keyboard, sticky keyboard, sticky keys.
And then if I click on create incident this incident was created in the new instance of ServiceNow that we had configured over here.
That was the new instance here. So it’s communicating against this instance of ServiceNow. So this is a very important capability added in 6.5.13 which makes it easy for you to integrate or test your integration of AM forms against various service endpoints. The other thing I wanted to show you is how do you know which properties that you can override, or what are the correct properties that you need to override? So for that, you can go into your conf clouds, cloud configs, FDM. And then this is the FDM and click on the JCR content. And these are the properties that you can override here. So in my case, I have overridden the service end point the username and the password properties which belong to that particular form data model. -