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 texttool 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
It is expected as it is not a link, rather it includes a link. Why not just remove the "tool link" from the text and only keep it as "https://www.google.com"?
Hi Former Member
Yes, we can remove it.
Is it possible that if we change something in the code and this error will not come? As users may do this mistake and because of this we are getting a blocker that all the users can not use the application until I delete or rectify this record from the production database.
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))
Hi Jaideep Banerjee
Thanks for responding. This worked fine.
Best
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 Jaideep BanerjeeThanks, this code will cover all the scenarios of a safe link.