How can I get the RecordId as a Parameter in a Pipe in a Customer Component?

I have a custom component, and it fires in a record Detail page of a User.

In the component I have a pipe which is a MySQL query that interrogates our CMS about that user.
I want to pass the UserId (which is the RecordId for this page) as a Parameter into my MySQL query … but how?

Is there a build in method or simple javascript that will get me the RecordId ?

I have tried Parsing the URI and using session variables, but neither of these methods are reliable, as there seems to be some sort of buffer that means I sometimes get values of a previous page persisting on a new page.

The AI system advises to use a function

But that doesn’t work, not sure if it exists

I probably misunderstand but I am going to try anyway. I am not sure if you have tried this already, but I see some information in your text, you might have done this already.

On the detail page you can add the Record ID. In the Record ID field (which you could hide with CSS) you have the possibilitiy to write the Record ID to a local storage in the browser. Then you have the Record ID available, which you could use then to construct the URI. This last part I have not done yet and I would need to figure that out, but maybe it gives you or someone else some ideas.

Thanks @Peter
Yes I have tried that. But this method relies upon the page being loaded for the session values to be stored.

I think that the issue is that the Pipe on the page fires off before that has happened … and the session variable is therefore still what was set last time the page was loaded… so I am trying to put in delays to the firing of the Pipe to see if that works

And this seems to be the solution. To use local storage of a value - just as shown, and then to add a delay of 1.5 seconds before the pipe is called.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.