It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confiform data storage

How can we find stored data of my form in confluence database for integration purpose?

1 answer

1 accepted

1 vote
Answer accepted
Robert Jober Oct 18, 2016

Here is an example of the function for a simple form we use to enter weekly highlights:

 

CREATEFUNCTION [dbo].[ConfiGetWeeklyHighlightReport] ()
RETURNS 
@tbl TABLE (
	RecordGuid			NVARCHAR(32)	NULL,
	RecordId			INT				NULL,
	Date				DATE			NULL,
	Status				NVARCHAR(100)	NULL,
	Reporter			NVARCHAR(100)	NULL,
	Description			NVARCHAR(MAX)	NULL,
	OwnedBy				NVARCHAR(32)	NULL,
	CreatedBy			NVARCHAR(32)	NULL,
	CreatedTs			DATETIME		NULL,
	IsDeleted			BIT				NULL
)
AS
BEGIN
	DECLARE @OffsetSecond INT = DATEPART(TZOFFSET, SYSDATETIMEOFFSET()) * 60;
	DECLARE @XmlData XML = (
		SELECT XmlData = CAST(text_val AS XML)
		FROM ConfluenceStore.dbo.OS_PROPERTYENTRY
		WHERE entity_key = 'confiform_contentitassistWeeklyReport'
			AND entity_id = 39485704 -- page id
	);
	
	WITH Items AS (
		SELECT 
			RecordGuid			= item.value('(id/text())[1]', 'NVARCHAR(32)'),
			RecordId			= item.value('(recordId/text())[1]', 'INT'),
			Date				= item.value('(fields//date/text())[1]', 'NVARCHAR(32)'),
			Status				= item.value('(fields//status/text())[1]', 'NVARCHAR(100)'),
			Reporter			= item.value('(fields//reporter/text())[1]', 'NVARCHAR(100)'),
			Description			= item.value('(fields//description/text())[1]', 'NVARCHAR(MAX)'),
			OwnedBy				= item.value('(ownedBy/text())[1]', 'NVARCHAR(32)'),
			CreatedBy			= item.value('(createdBy/text())[1]', 'NVARCHAR(32)'),
			CreatedTs			= item.value('(created/text())[1]', 'NVARCHAR(32)'),
			IsDeleted			= item.value('(deleted/text())[1]', 'BIT')
		FROM @XmlData.nodes('/list/entry') AS Requests(item)
	)
	INSERT INTO @tbl
	SELECT
			RecordGuid,
			RecordId,
			Date = DATEADD(SECOND, (CONVERT(BIGINT, Date) / 1000) + @OffsetSecond, '1970-01-01'),
			Status = CASE Status
				WHEN 'success' THEN 'REPORTED' 
				ELSE Status
			END,
			Reporter,
			Description,
			OwnedBy,
			CreatedBy,
			CreatedTs = DATEADD(SECOND, (CONVERT(BIGINT, CreatedTs) / 1000) + @OffsetSecond, '1970-01-01'),
			IsDeleted
	FROM Items
	;
	RETURN 
END
Alex Medved Jun 28, 2018

Ohh, you better dont "integrate" on the database level.

We believe in teh same approach as Atlassian advices - use APIs and SDK, but never access your database directly.

We do have APIs for ConfiForms as well, as strongly advice to use APIs for incoming integrations and ConfiForms IFTTT macros for outgoing integrations

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

2,113 views 11 27
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you