How to edit existing ConfiForms Entry from URL?

Dan November 17, 2023

I know that I can pre-populate a ConfiForm from the URL like so:

//<my server>/display/<space>/<confluence page>?cf_name=<form>&cf_values=<field1>:<value1>;<field2>:<value2>

Is there a similar URL-driven way to pre-populate the form with an existing entry to edit it? In this example value1+value2 would be uniquely validated and guaranteed to return only one entry (or possibly no entries... in which case it would be nice to create a new one).

Thank you!

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2023

Hi @Dan 

Using the same concept, but passing also the id of the record will make it an "edit"

Alex

Dan November 22, 2023

I see that I can "edit" an entry by the following:

  1. Send the id to the form in my url using something like "cf_values=IDtoUpdate:<my entry id>".
  2. This prepopulates my IDtoUpdate field
  3. Using a "set value" rule I set the "id" value: "id=[entry.IDtoUpdate]".
  4. This will turn my "Save" into an "Update". But is there a better way?

But my question was more about pre-populating my form with the previously saved info. Let's assume I don't know my previously saved ID. Would the optimal way to do this be via a "lookup and set value", against the same form?

  1. Send my value1 and value2 to in the url: "cf_values=key1:value1;key2:value2
  2. This prepopulates the key1 and key2 fields with my values
  3. Use a "Lookup and set value" rule against the current form and page (by leaving the source form name and page field blank)
  4. Lookup filter: key1:[entry.key1] AND key2:[entry.key2]
  5. Set all my fields:
    1. most importantly:  id=[entry.id]
    2. as well as all my other non-key fields. Essentially a lot of notes and comments about assets that I'm trying to track.
  6. Now my form is prepopulated with previously saved info, and ready to make an edit/update instead of saving a new record?

This seems workable - but also hugely inefficient. I'm hoping there is a way to simply tell a form to prepopulate with an existing entry based upon my cf_name and cf_values fields rather than having to make all these steps?

Thanks for all your help. As always :)

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2023

Tis sounds overly complicated...

Not sure why you need all those IDtoUpdate and field definition rules... just set the id field right in the url

cf_values=id:<my entry id>

Also, to lookup for data in existing records please have a look at this demo

https://wiki.vertuna.com/display/TEST/Form+to+lookup+and+preset+values+from+existing+records

 

Alex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events