Set custom link name/text when creating links in original ConfiForms entry
Asked by Thomas Gj?rtz:

I'm in need of some assistance!

I have set up a form to handle change request and every time a request is made a page is created, all thanks to the ConfiForms IFTTT Integration Rules' Macro.

After some research I found out that it was possible to include a link to the created page in the original form. I followed the instructions on this page:

<https://wiki.vertuna.com/display/CONFIFORMS/Creating+links+in+original+ConfiForms+entry+to+just+created+page>

This worked fine but there is one issue when I list all of the records in the TableView Macro, the link name, or display text if you will, has an unnecessarily long format. Please see the attached photo:

![Skjermbilde 2021-03-25 231847.jpg](/t5/image/serverpage/image-id/136014i5DF7694951BFA2E6/image-size/large?v=v2&px=999 "Skjermbilde 2021-03-25 231847.jpg")

Is it possible to standardize the display name so that for every record it always shows "link", "weblink", "URL" or something similar?


Answers:
author: Alex Medved _ConfiForms_
body: Hi

Is the field you have for your stored link is of type "page" or html or something else?

If this contains a link (only), meaning the url, then you can use asLink virtual function (<https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions> ) to transform it easily

Alex

comments: author: Thomas Gj?rtz
body: Hello Alex!

Thank you for answering me.

I generate the link to the created page using the field "Hidden Html". This way it's not visible in the entry form but shows up in tables/lists/calendars etc.

![confiforms form field definition - hidden html.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/136088i4FABC70D53C57570/image-size/large?v=v2&px=999 "confiforms form field definition - hidden html.JPG")

The macro that creates the link is set up as follows:

![confiforms ifttt integration rules macro - onCreated.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/136089iFE46DAE28E30FD02/image-size/large?v=v2&px=999 "confiforms ifttt integration rules macro - onCreated.JPG")

I use this parameter:

```
entryId=[entry.id]&link=<a href=https://confluence.intern.sparebank1.no/pages/viewpage.action?pageId=${iftttResult_0.id}>${iftttResult_0.displayTitle}</a>
```

Is it possible to use the asLink virtual function in this case? If so, can you please explain how?


author: Alex Medved _ConfiForms_
body: Well, not quite - is there a reason why you save back the HTML link like that?

And not the reference to page id, for example...

If you insist on saving back the HTML link then just modify it the way you need (for label), For example:

```
entryId=[entry.id]&link=<a href=https://confluence.intern.sparebank1.no/pages/viewpage.action?pageId=${iftttResult_0.id}>Web link</a>
```


author: Thomas Gj?rtz
body: Hello Alex!

<br />

Thank you so much for your swift reply.

<br />

The parameter you suggested worked and I was able to give the link a custom name.

<br />

That being said I was curious if referencing the page ID would be a better solution.

I gave the following guide a try and my first impression is that this is a more elegant way to solve the matter.

<br />

<https://wiki.vertuna.com/display/FORMS/How+to+create+pages+in+Confluence+with+ConfiForms>

<br />

The problem with this method is that I'm having trouble controlling how the link text appears.

<br />

When I use this parameter:

```

entryId=[entry.id]&createdPage=${iftttResult_PC.id}
```

<br />

and then list all of the records in the TableView Macro, the link name/text appears like this:

![confiforms - display text.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/138004i4821049AC61522AD/image-size/large?v=v2&px=999 "confiforms - display text.jpg")

<br />

As you can see the link is a combination of my username + the title of the newly created page.

Is it possible to modify the parameter so that I am able to set a custom link text?

Thanks in advance!


author: Alex Medved _ConfiForms_
body: It's possible

In the TableView you have already, instead of a ConfiForms Field with field name set to 'createdPage' put something like this

```
createdPage.urlPath.asLink(I am link)
```

into the field name parameter

This expression uses [virtual functions available in ConfiForms](https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions) which help you to transform the values as you need.

Alex


author: Thomas Gj?rtz
body: Amazing!

As a token of my appreciation a case of virtuell beer is being shipped in your direction.

As we say in Norway...

Sk?l!


author: Michael Taylor
body: Sumabeech! Been working on this for hours, since my IFTTT also creates a more complicated title than just 1 field name and asLink by itself would not work. urlPath was the missing key. Alex another virtual case your way.


author: Michael Taylor
body: Now is there a way that if the page is deleted, then the record would get deleted...or vice-versa?


author: Alex Medved _ConfiForms_
body: This is a task for automation. ConfiForms does not listen to such events, but provides APIs to get it automated


author: Alex Medved _ConfiForms_
body: Of course vice versa is possible - to delete the page when the record is deleted

Just drop the IFTTT of this type <https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-DeletePage> to run onDeleted event in ConfiForms


Tags: confiforms

confluence-server

macro

server