urlForRecord function for Sites

Certified Lead Developer
Hi All,

urlForRecord function can be used to navigate to a record dashboard directly by passing the recordID. Do we have something similar for records which are part of Sites. For example, I want to divert a user from an external portal to a specific record dashboard on Appian site once authentication is done.

Thanks.
Hitesh

OriginalPostID-251745

  Discussion posts and replies are publicly visible

  • @hiteshd From my search I didn't find any. However you could still produce the url by writing an expression rule. Please find attached the image and code snippet that will help you in getting the url of a record that lies in a page of the site.

    Few things to note:
    1. I have used a!recordLink() to get the unique identifier of the record being generated by Appian as part of record's url. This is because fn!urlforrecord() failed in deriving a valid value. If you have time, I would suggest trying the fn!urlforrecord and get the identifier and test the same as the usage of a!recordLink() isn't a standard approach. In case if someone is interested in this, I have tried fn!reverse(fn!split(fn!urlforrecord(ri!recordType,ri!recordIdentifier),"/"))[3] but this identifier didn't work for sites though the same worked for tempo environment(maybe I am missing something?).
    2. I have used rule!APN_getSiteUrl() but I would suggest not to use it as this rule makes use of a deprecated function and I have used it just for demonstration. Use an expression rule or constant or query rule that drives the site url specific to the environment.
    3. Implement this code as an expression rule and reuse the same so that it would be easier to replace its contents or deprecate it when Appian relases a equivalent OOTB functionality or makes changes in the functions that were used in this expression rule.
  • I know this an old post but I encountered the issue recently and this expression have worked for me

    {
    a!safeLink(
    label: "",
    uri: fn!substitute(
    fn!urlforrecord(
    recordtype: <your record>,
    recordIds: <recordid>
    ),
    rule!APN_getSiteUrl()& "tempo/records/item/",
    rule!APN_getSiteUrl() & "sites/<site name>/page/program-dashboard/record/"
    )


    )
    }

    using this expression in record link solved my problem as it allows the summary view to open in a new window preserving my filters selected in the current window.
  • Hi, You can use a!recordLink

    a!recordLink(
    label: <Label Name>,
    recordType: <Record Constant>,
    identifier: <Identifier>
    )

  • 0
    Certified Associate Developer

    You can do this by building a URL dynamically:

    fn!load(
    local!siteURL: rule!APN_getSiteUrl(),
    /*Get identifier of record*/
    local!recordIdentifier: a!recordLink(
    recordType: <record type>,
    identifier: <record identifier>
    ).@attributes.@anyAttribute._recordRef,
    /*Build the site record url*/
    local!finalSiteURL: fn!concat(
    local!siteURL,
    "sites/",
    <name of the site here>,
    "/page/",
    <name of the page here>,
    "/record/",
    local!recordIdentifier,
    "/view/",
    rule!APN_replaceNull(
    nullableValue: <dashboard >,
    replacementValue:"summary"
    )
    ),
    /*Get the site record url*/
    local!finalSiteURL
    )