Hi Adam,
It seems that you can pass the information as headers.
https://stackoverflow.com/questions/73777371/how-to-make-subsequent-request-to-sap-business-one-service-layer-from-django
headers = {
"Cookie": "B1SESSION=SessionID; ROUTEID",
"authkey": "XXXXXXXXXXXXXXXXXXXX",
"Accept": "*/*",
"Content-Type": "text/plain",
}
I have two idea which should work and a few other which could be validated.
1. Custom data source
This one should work for sure, but requires more development. Depending on your use cases and may be worthwhile to explore it.
https://github.com/WEBCON-BPS/develop-docs/blob/main/WebCon.BpsExt.Examples/WebCon.BpsExt.QuickStart/CustomDataSourceExample/CustomDataSourceExample.cs
2. Technical workflow
This may be an option, if the returned values are valid for a longer time.
a) Create a technical workflow, which executes the login and stores the result in a technical field.
b) A cyclical action starts the technical workflow every no one then during a working day. Whatever this may be for you. :)
c) A global business rule returns the value(s)
d) The data source uses the business rule.
Other ideas
2.b
I have not tested, whether executing a data source used in a choose field would use an unsaved field value, when executing the REST request.
If this would work you could:
c) Store the values from the technical workflow in two field during page load
d) Use the "All form fields" option from the expression editor in the data source to reference these fields. This would also allow you to use the raw value stored in the field.
3) Login data source
a) Create a data source which returns the whole response in a field. I have always mapped the response to individual variables but I wonder, whether we can can just declare that the result is not an object with multiple properties but store the whole result in one value.
What I mean with this is that a result like would typically be mapped as
{
property1 : "some value" // not mapped
object1 :
{
"o1.p1" : "abc" // mapped to object1_property1
"o1.p2" : "abc" // mapped to object1_property2
}
}
And we would configure the result like
{
property1 : "some value" // not mapped
object1 : mapped to object1
}
b) Create a global business rule which uses the "Data source value" function and processes the result to return the values.
c) Use the global business rule in the data source.
I'm also wondering what would happen if you execute the "Data source value" function twice to return the B1SESSION and ROUTEID separately. Would they be valid, even if they are returned by two different "logins"? If they are, this would make this a whole lot easier and would allow us to configure the login data source as usual.
4) Custom SDK business rule SDK.
Instead of creating a customer data source, you could also opt for just creating a custom business rule, which executes the login and returns the necessary information.
Depending on the way and characters in the values, you may also run into this.
https://community.webcon.com/forum/thread/5645/15
If you would be running 2022 you would be fine.
Best regards,
Daniel