In Confiforms IFTTT, Move Page creates duplicate page. Is there a way to first check if page exists?
Asked by fbunting:

In the Confiforms IFTTT macro, using the Move Page action can result in a duplicate page.  

E.g. if you move page *Foo* to another space that already has a page named *Foo* , you don't get an error. Instead, you end up with two pages (with different PageIDs) with the same name in the same space.   

I would love to avoid this, if it's possible.  

Or absent that, is there a way to check (e.g. in a Conditional) if a page with a given name already exists in the target space?


Answers:
author: Alex Medved _ConfiForms_
body: Yes, absolutely. This looks like a bug in ConfiForms IFTTT that moves pages. We certainly must check if the page with a given name already exists in another space you are attempting to move this page to... I have create a bug in our Jira to get this addressed asap.

comments: author: fbunting
body: Thanks Alex!

I thought of a short-term workaround. I try renaming the page in the target space (renaming *Foo* to *Foo* ). If the return value **${iftttReturn_0}** is a valid page object, then I know that the page already exists, and I skip the MovePage IFTTT.


author: fbunting
body: Oh, I may have found another bug. The AddLabel and DeleteLabel actions do not seem to return a result value.   

I found this out because the first thing I tried was the RemoveLabel action ... i.e. try to remove a dummy label from the page in the target space. But I got no result back, regardless of whether the page exists.


author: fbunting
body: But if there's an easier way to check the existence of a page, please let me know.  

Thanks again for your fast answer!


author: Alex Medved _ConfiForms_
body: Yes, it looks like the add/remove label dont put the page they were "working" on into the context as per documentation... Will fix that


author: fbunting
body: One more thing (sorry if this is all unrelated to the original question).  

The Create Page action currently displays an error if you try to create a page that already exists.  

However the documentation says that it will create a new version of the page. (<https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions#ConfiguringConfiFormsIFTTTactions-CreatePage>)  

In this case, I think the current behavior is the right thing to do. (Just need to change the documentation.) You should not be able to create a new page at all, if a page by that name already exists.  

The Move Page action should do the same. (Display an error message.)


author: Alex Medved _ConfiForms_
body: I agree on a "Move page" IFTTT action behaviour and this will work like this from ConfiForms 2.11

As for the "Create page" IFTTT action - you actually can set it in 3 ways

* default behaviour where the error is reported if the page with the same name exists
* silent mode set meaning that it will not report this error but will re-create / update the page with the given title
* skip creating of a page if the page with a given title exists, doing nothing to the page contents and continue with other IFTTTs


author: fbunting
body: Another thing ... (again, thanks for your patience, as I'm discovering all sorts of things about Create Page and Move Page):

Create Page should also (IMO) report an error if the specified Parent Page does not exist. Instead, it seems to simply create the new page as a child to the form-page.  

E.g., if I have a form on *Page A* , and it calls Create Page with the Parent Page set to *Page X* , which does not exist, then *Page A* is used as the parent page.

One case I have *not* tried, is what happens if you try to do a Create Page (or Move Page) to another space, in which the user does not have Edit permission ... or if the Parent Page is not editable by the user. Again, I would expect the default behavior to be that the form reports an error and does not create a page.


author: Alex Medved _ConfiForms_
body: When the parent page cannot be resolved then ConfiForms takes form's page as a parent page. This is the default behaviour of this action (when you dont specify a parent page at all)


author: fbunting
body: If I might make a feature request ... I would prefer that this be configurable by the author of the form.   

Sometimes it is better to throw an error and not create the page at all, than it is to create a page in the "wrong place."  

Example: I'm using *Page A* as an intake form for creating pages in another space. If someone tries to create *Page X* without the right permissions, and it creates it as a child in the wrong space, then the user gets confused ("OK, where did that page get created?"). If they simply try again, it gets even more confusing, as they then get an error (*Page X* now already exists in the current space).


author: Alex Medved _ConfiForms_
body: Hi Fred

This will work better if you create a support ticket in our helpdesk or JSD.

Having a feature request in Atlassian community post may not be the best way to keep a backlog for the app.. (wiki.vertuna.com has support request forms or direct channel to our company Jira service desk)

Thank you for the understanding

Alex


author: fbunting
body: Understood.


Tags: confiforms

confluence-server

server