Hi All,
We have a UI where we call a safe link to open an External UI in the same tab. This safe link can be triggered from multiple places in Appian (Sites or Tempo). A single user can have access to multiple sites or tempo from where they can trigger the safe link. Now on the External UI, we have to call a link (link will be sent to External UI using API) to navigate back to Appian from the original location, but the problem is we do not have the browser URL from where the user clicked the safe link from. So is there a way we can find out from which site/tempo was the safe link triggered?Eg -User is on Site A -> Triggers a process -> UI has safe link -> User clicks on Safe link -> Navigated to External SiteUser is on Site B -> Triggers a process -> UI has safe link -> User clicks on Safe link -> Navigated to External SiteNow how do we know that the user was on Site A or Site B as in Sites we cannot add any parameters while calling any processNote -> Same process is used in Site A and Site B
Discussion posts and replies are publicly visible
There would be no way to do this unless you could use slightly different links to the external site, and based on that, add logic to the external site to determine which Appian site link to show the user. Otherwise, you should probably just decide that the users should expect to always be navigated back to Site A (for example) regardless of where they were when they went to the external link.
There actually is a potential solution that involves using a Web API to save the user's current location and redirect you to the correct place. However it is fairly complex - I'd only recommend using this if you're willing to devote the time to writing custom HTML to correctly insert data and redirect the user.
You can see an example of how this works in the Dynamic Site Management application on the app market.
Hi Peter LewisThanks for your response.The main problem that I am currently facing is to get the URL for the site, with HTML also getting the current URL for site is something that I am not able to achieve.
What point are you trying to get the URL? Can you describe more what you have tried and what isn't working?
HI Peter LewisI am not an expert in HTML but tried to do some things, the API is unable to read 'window.location.href' and insert the site URL from where this API is being called.Replacing the HTML function with a hard coded value works fine as expected, but with the function I am unable to get the URL for the page from where the API is triggered (UI).
a!localVariables( local!hostURL: rule!APN_getSiteUrl(), a!httpResponse( statusCode: 200, headers: { a!httpHeader( name: "Content-Type", value: "text/html" ), a!httpHeader( name: "X-Frame-Options", value: null ) }, body: " <html> <body> <script> fetch( `" & local!hostURL & "webapi/653cWA?site="&"`&window.location.href, { method: `POST`, credentials: `include`, headers: { 'Content-Type': 'application/json' } } ).then(response => { window.location = `" & local!hostURL & "sites/xxxxxxxxx"&"` }).catch(function (err) { console.error(err); }); </script> </body> </html>" ) )
I'm sorry, I'm don't know much about HTML either. Is it possible that hard-coding could be a viable solution? If you have different interfaces on each site, you could hard-code the current URL on each of those sites for when you launch the link.
Hardcoding will not work in my case as the UI is same.But anyways thanks for all your help, will keep looking and see I can find something.
Unknown said:Hardcoding will not work in my case as the UI is same.
Can you expand on this? You could make each different site show a different version of the external URL even if you otherwise use the same interface for both. I don't exactly see how you stop at it "will not work".
Mike SchmittThe problem is I am building this external link inside a UI which is part of a action link in record dashboard, so basically the summary page of the record has multiple action links and one of the action is calling this UI which has an external link and this record is being called in multiple places, so there is no way for me in the current scenario where I can pass the site sub/url from site/tempo to my UI to identify the starting point of the same. Also the users have access to multiple sites, so they can navigate from the menu bar to different site (without any action so cannot tract where the user is actually).Also the application size is huge to consider changing all the sites and the places used by the objects.I have not given up yet to find a solution, but the approach of hardcoding is something I cannot use because of multiple reasons.
Unknown said:I am building this external link inside a UI which is part of a action link in record dashboard, so basically the summary page of the record has multiple action links and one of the action is calling this UI which has an external link and this record is being called in multiple places
so add a parameter to your interfaces and processes called "siteContext". Have unique interfaces for SiteA and SiteB, where each of them calls the same sub-interface, each passing in its own site unique identifier for "siteContext". Pass this value around and use it to determine the external URL you show.
Correct can be done but the problem as I said is modifying huge amount of objects that have been created over a period of 4-5 years.Multiple factors come in picture when we are working on an existing applications and the timelines are tight.I was mainly looking for a direct approach for now rather than modifying all my site applications with a static UI for each site.Anyways thanks for all your help, will let know how it all comes out. Firstly will try to see if I can make WebApi work.
I understand about needing to modify a huge number of objects. But I want to clarify with respect to "static UI for each site" -- this is rather easy to sidestep by establishing a structure where (only) the top-level interface for a particular site page is unique, and inside that all it does is call the shared interface in question, in doing so passing in a parameter identifying the site; this can of course then be used for other interfaces and/or on-page start process links, etc.
You also wouldn't need to modify *all* such places at once, but rather cherrypick the few most important (the ones directly up-line from the external URL you want to generate) and go from there. In case any of that makes this approach more feasible for you. If it's a big established system you're trying to modify I know that's quite a bit more of a lift than if it's a newer system under development of course.