Expression evaluation error at function a!safeLink [line 31]: tool link - https://www.google.com/ is not a permitted URI under the configured security rules and cannot be cast to safeUri. (APNX-1-4198-000)

Hi Team,

I am using the below code snippet for the links column and separating multiple links using semicolons. 

a!gridColumn(
  label: "Links",
  sortField: 'recordType!LA Record Link.fields.links',
  value: a!richTextDisplayField(
    label: "Real Links",
    value: a!forEach(
      items: split(fv!row['recordType!LA Record Link.fields.links'], ";"),
      expression: a!richTextItem(
        text: fv!item & char(10),
        link: a!safeLink(
          uri: fv!item,
          openLinkIn: "NEW_TAB"
        ),
        linkStyle: "STANDALONE"
      )
    )
  )
)

But when the user is inserting a link with the below text
tool link- https://www.google.com/  it is giving an error tool link - https://www.google.com/ is not a permitted URI under the configured security rules and cannot be cast to safeUri. (APNX-1-4198-000).

Even the tool record type interface is not working until I delete the record from the database. 

We tested multiple cases and found if we write anything before the https:// it is giving the same error. Is there any possible way to resolve it like whatever we write inside the link column it should take it as link?

I am attaching the error screenshot as well.

     

Could someone please help me with this?

Thanks

Kundan

  Discussion posts and replies are publicly visible

Parents
  • try this

    if(find("https",ri!name,1),concat("https",split(ri!name,"https")[2]),
    if(find("http",ri!name,1),concat("http",split(ri!name,"http")[2]),
    ri!name))

  • This seems interesting.. we really cannot ask our users "don't type....." even if that is technically right from Appian perspective. If they type something wrong - then we need to edit the db to get the entire site up and working and until then we are blocked. The above piece of code is not helpful going the definition of safeurl..this can be a dirty solution but at least the following will prevent from throwing the error at your interface. You need to define a rule with the following code and call that rule at a!safelink

    if(left(upper(ri!name),6) = "HTTPS:",
    if(left(upper(ri!name),7) = "HTTPS: ","Invalid https link having spaces after https",
    if(right(upper(ri!name),6) = "HTTPS:","Invalid https link having nothing after https",ri!name),),

    if(left(upper(ri!name),5) = "HTTP:",
    if(left(upper(ri!name),6) = "HTTP: ","Invalid http link having spaces after http",
    if(right(upper(ri!name),5) = "HTTP:","Invalid http link having nothing after http",ri!name),),

    if(left(upper(ri!name),4) = "FTP:",
    if(left(upper(ri!name),5) = "FTP: ","Invalid ftp link having spaces after ftp",
    if(right(upper(ri!name),4) = "FTP:","Invalid ftp link having nothing after ftp",ri!name),),


    if(left(upper(ri!name),4) = "TEL:",
    if(left(upper(ri!name),5) = "TEL: ","Invalid tel link having spaces after tel",
    if(right(upper(ri!name),4) = "TEL:","Invalid tel link having nothing after tel",ri!name),),

    if(left(upper(ri!name),7) = "MAILTO:",
    if(left(upper(ri!name),8) = "MAILTO: ","Invalid mailto link having spaces after mailto",
    if(right(upper(ri!name),7) = "MAILTO:","Invalid mailto link having nothing after mailto",ri!name),),

    "Valid Link not available or entered")))))

  • Hi

    Thanks, this code will cover all the scenarios of a safe link.

    Best

    Kundan

Reply Children
No Data