Back to Basics : Seeding from a URL Parameter
This topic comes up regularly and it often seems to get mixed up with just plain old “starting the interview from a URL”. So it’s time for a little refresher about Seeding from a URL Parameter. Time for another Back to Basics topic (catch the previous one here) !
First of all : What do we mean by seeding from a URL parameter?
Sometimes you want to start an Interview with certain attributes already populated. But this is not a situation where you are using a Connection, for example, to perform an inbound mapping loaded at start. Perhaps you are embedding Oracle Policy Automation Interviews on a Web site, and the Web site is going to pass some information into the Interview when it starts.
In pseudo-world, you want to do something like this:
But if you try to do something like this with Oracle Policy Automation, you get a nasty surprise. It doesn’t work at all.
Then you read the documentation, and discover two or three important things that must be in place.
- You must authorize pre-seeding for the attribute(s) you are interested in
2. You must use the seedData= tag on your URL to introduce the information to the Interview.
Armed with this you come back to your Interview and you try something like this, with impressive results:
What the heck is happening here? It all seemed so simple. Well it is, but you forgot the most important point. Whatever your seeding from a URL requirements, they must be URL encoded. So the “=” character for example, is not going to get through the defences of Oracle Policy Automation. You have to encode it all first. So let’s imagine you have an attribute, whose name is my_seeded_value, and you want to populate that attribute with Richard Napier.
You need to encode part of what you are sending. You do NOT need to encode “seedData=” in fact if you do, there will be yet another error. Your URL needs to look like this :
And the rest of the URL needs to be something like my_seeded_value=Richard Napier. But that part needs to be encoded. As a simple example, take it to https://www.urlencoder.org/ and put it through the encoder. It probably comes out like my_seeded_value%3DRichard%20Napier. Excellent. Now you can create the complete URL:
And it comes out just fine:
So there has definitely been an important lesson here : don’t encode seedData=, but do encode the information after it.
There is a lot more to learn about URL-based seeding, and we will continue this after the break. If you want the full online help, it is to be found here.
Have a good Holiday and see you in 2019!