In summary, how can I create a composite to store the email address of the currently logged in user.
Background.
We’re using CHCentral as our CRM and we’re doing some integration work with a non-LC application. When a user clicks on a person record, there’s a new tab containing an iFrame to display this external application.
The iFrame is configured to pull the URL it displays from a composite which consists of three parts
- A dynamic to environment variable for the host information
- A data property for the housing ID of the selected person
- Some static text as a parameter
Combined, the finished URL looks something like
https://uat.testapp.lbcamden.net/people/3189229?embedded=1
I now need to add an additional parameter to the URL containing the email address of the CRM user. This is to help rectify some issues we’re having with having with Single Sign On in the iFrame.
This won’t be possible using a composite, as they do not have any concept of a logged in user and their value may be cached as it shouldn’t change based on who is viewing it.
I think you would need to use Code Studio, which has access to logged in user details, to construct the desired URL and save it to a Property. However as this value needs to change for each user that views the page with the iFrame, it needs updating immediately before using it. You could try triggering an event on page load which updates the value based on current user. it’s not perfect, as there is still technically a race condition where two user opening the page at exactly the same time could end up with the wrong link, but in practice it might work fine if this is an unlikely scenario.
As a future suggestion, you could raise an Idea to allow a Field Processor to be used on the iframe URL, allowing you to modify it in Code Studio just before use, without needing to save it anywhere.
Hi,
Adding to what Bob said, another way you should be able to achieve this is running a callback on the composite.
Display the current composite you have now on the page and go to Advanced => Callback.
You should then only need fragment_presenter.get_displayable_value(); to get the url as is, cs.get_session_user_id()- use this get the email of the logged in user via the record and fragment_presenter.set_value() after you have built the link and need to set it.
Dan.
1 Like