infor-cloud / m3-h5-sdk

https://infor-cloud.github.io/m3-h5-sdk/
34 stars 20 forks source link

Can you retreive Tenant URL in the code ? #117

Closed Messaoudi-Nagib closed 2 years ago

Messaoudi-Nagib commented 2 years ago

Description

Hi, I have to make a button that leads to infor M3 screen, I'm using drillback URL to do it, but depending on wich environment I work, I would like to get the right tenant URL.

Is that a way to do it ? (API, or other method ?)

Thank you, regards

Versions

Infor M3 cloud

premkumarparames commented 2 years ago

Hi Messaoudi-Nagib, You can use the 'launch' method from the 'ApplicationService' service available in the framework to launch M3 programs, Bookmarks, and Mform Automation URL, it's equivalent to the Run command in M3. There is an example available in the sample app for the same for reference "https://github.com/infor-cloud/m3-h5-sdk/blob/master/m3-odin/src/app/soho-app/samples/launch/launch.component.ts"

Messaoudi-Nagib commented 2 years ago

Thank you @premkumarparames I've already seen this example, but my question is, how to get my tenant URL dynamically depending on wich environment I am :). Te reformulate : can I get the current tenant ID where the application is running, and then create a drillback URL based on the current tenant ID ?

premkumarparames commented 2 years ago

You can get the current session info including the tenant id from the m3 context grid endpoint "/grid/user". I believe we don't need the tenant id in the bookmark url, do you mind sharing what is it you trying to do, for example, are you trying to open an M3 program from the h5 application with certain fields to be filled in automatically or you are trying to launch another Infor OS application.

Messaoudi-Nagib commented 2 years ago

Ok ! thank you very much, yes I'm trying to open an M3 program from H5 application (mashup) so basically what I've done is :

Do you think it is possible to open an M3 screen without the begining of the URL, if so, I would appreciate if you give me some advices.

Thank you, regards

premkumarparames commented 2 years ago

@Messaoudi-Nagib Your H5 application is already running within the M3 context, so you don't need the M3 URL or the mingle URL to launch an M3 program or the bookmark. You can pass the program name in the lanch method or the bookmark with the prefix "bookmark?" or the mform automation XML string with the prefix "mforms://_automation?data=".

For example,

Messaoudi-Nagib commented 2 years ago

This is exactly what I want ! thank you so much for the answer !

Regards !