Embed record link in an e-mail

Certified Associate Developer

Hello,

I am currently working on an application for training purposes. I have a process for adding a record and editing it. I had a sub-process for both, where I am sending an email to a user group whenever a record has been added or edited. I was able to make parts of the email dynamic (e.g. "Information about [dynamicName] has been [changed/added]), but I would like to embed a record summary view link in that email, so that users can navigate straight to the updated record from that email. Now, the urlforrecord() function generates a working URL, but it links to Tempo, and not the summary view of my record. I have been trying a few things, but nothing seems to work. I would be very much obliged if someone helps me figure this out. To sum up: I need to dynamically generate a URL to a record summary view on my site to embed it within the email body.

Thanks!

  Discussion posts and replies are publicly visible

Parents
  • Your could try something like this,

    substitute(
      text:urlforrecord(
                recordType: cons!RECORD_TYPE, 
                recordIds:ri!recordId
            ),
      find: "https://YOUR_APPIAN_SITE/suite/tempo/records/item/", 
      replace_with:"https://YOUR_APPIAN_SITE/suite/sites/YOUR_SITE/page/YOUR_PAGE/record/" 
    )

    This uses the substitute() function to replace the tempo portion of the URL with your sites record URL.

  • 0
    Certified Associate Developer
    in reply to thomasd379

    Thank you! I will definitely try it out!

  • Has this worked for others? I'm currently trying to utilize this same function: 

    But am coming up with the following error: 

  • 0
    Certified Lead Developer
    in reply to sarah.zinger8123

    For manually constructing a site-context Record URL, I always suggest encapsulating the functionality in its own expression rule for added flexibility (and, of course, for ease of testing) - this is the one I've used in the past.

    a!localVariables(
      local!defaultURL: urlforrecord(ri!recordType, ri!recordId),
      local!addSiteContext: if(
        isnull(ri!siteContext),
        local!defaultURL,
        if(
          isnull(ri!recordId),
          /* Can't link to a record list in sites context */
          local!defaultURL,
          substitute(
            local!defaultURL,
            "tempo/records/item",
            "sites/" & ri!siteContext &
            if(
              isnull(ri!sitePageContext),
              "",
              "/page/" & ri!sitePageContext
            ) &
            "/record"
          )
        )
      ),
      local!addDashboardContext: if(
        isnull(ri!dashboardStub),
        local!addSiteContext,
        substitute(local!addSiteContext, "summary", ri!dashboardStub)
      ),
    
      local!addDashboardContext
    )
    
    /* by: Mike Schmitt */

    Also: the main issue in your code above seems to merely be an issue of passing keywords into the "substitute()" function, which does not take keywords.  I think what you have here might work otherwise if you remove them.

Reply
  • 0
    Certified Lead Developer
    in reply to sarah.zinger8123

    For manually constructing a site-context Record URL, I always suggest encapsulating the functionality in its own expression rule for added flexibility (and, of course, for ease of testing) - this is the one I've used in the past.

    a!localVariables(
      local!defaultURL: urlforrecord(ri!recordType, ri!recordId),
      local!addSiteContext: if(
        isnull(ri!siteContext),
        local!defaultURL,
        if(
          isnull(ri!recordId),
          /* Can't link to a record list in sites context */
          local!defaultURL,
          substitute(
            local!defaultURL,
            "tempo/records/item",
            "sites/" & ri!siteContext &
            if(
              isnull(ri!sitePageContext),
              "",
              "/page/" & ri!sitePageContext
            ) &
            "/record"
          )
        )
      ),
      local!addDashboardContext: if(
        isnull(ri!dashboardStub),
        local!addSiteContext,
        substitute(local!addSiteContext, "summary", ri!dashboardStub)
      ),
    
      local!addDashboardContext
    )
    
    /* by: Mike Schmitt */

    Also: the main issue in your code above seems to merely be an issue of passing keywords into the "substitute()" function, which does not take keywords.  I think what you have here might work otherwise if you remove them.

Children