In this article, we will highlight one of the Flow connectors that can be useful to solve “simple” external connection problems.
Whenever an information system is implemented, the question of interfaces arises. How many flows to create/maintain, what types of external systems must interact with the new application etc…
Although many solutions exist (ETL, ESB…) to answer these problems, I have not yet seen any interfaces made using Flow.
This solution does not allow to substitute the implementation of interfaces but may be sufficient if you just want to make a call from outside CDS.
In this scenario, we will have a CDS to store information from an external call that can be made from a client application, for example.
We start by creating a flow from a solution, it is always recommended creating to create a flow like this.
You can now enter a name for this flow, for example: “FLOW – Create an Account from HTTP Request”
Finally, we will select the trigger “When a HTTP request is received”.
As you can see, it says: ‘URL will be generated after save’. We will therefore focus on the method of this trigger and especially the definition of the JSON schema that will be received by the endpoint.
We will use this flow to create an account by giving the account name, phone number and website url.
This gives us the following schema:
We will also indicate that it’s a POST request method.
Now, we will add a new condition step:
The objective is to check the data received, such as the length of a field, etc… To ensure that the information is as accurate as possible. This is only one example, it would obviously be necessary to add much more consistent conditions. For example, we could retrieve the header to check from which User Agent this request was issued.
Finally, we will use the CDS connector to create an account record using information received.
We can finally save our flow and observe that the service url has been generated:
Now we just need to make a POST request to this url to create an account!
To do this, we will use Postman. Make sure to add the following header:
And the URL of course 🙂
Now we will build the JSON body which will contain the information we want to send in order to create an account:
Press Send and wait for the execution status to return.
You can check in CRM to see if the record has been created:
Now if we want to make a request from an external application for example via a submit button we can use the code generated by Postman:
However, this solution is not the best in terms of security. There is no authentication to make this POST request, so if someone gets this URL, they can easily flood it and therefore consume “runs” but it could eventually generate bad data in your case!
Leave a Reply