Importing XML to existing case

Discuss your general Proclaim related queries here.
whiteyes
Posts: 10
Joined: Wed Jan 07, 2015 11:37 am

Importing XML to existing case

Post by whiteyes » Sat Mar 16, 2019 9:20 am

Hi,

I've set up a webform on our website and once submitted sends the XML document to out FTP site.

In the webform the user must type the case reference. I was hoping for the file/fields to import into existing cases. I created IMPORT fields so that in my linked action it would PUT the IMPORT fields into the real fields in proclaim.

So for example:
If IMPORT case key = case.key then
OPEN (case key) etc

However, it's not importing anything. I've checked the XML data template and import job which seems to be fine and the directory monitoring job does process the files in the FTP so it must be the linked action?

The import job is set to update.

Any advice would be appreciated thanks

Enigma
Posts: 6
Joined: Mon Mar 04, 2019 1:01 pm

Re: Importing XML to existing case

Post by Enigma » Mon Mar 18, 2019 5:27 pm

Have you tried removing the OPEN (case key) , that sounds like it is the part that may be causing the system to throw a wobbler.

You technically should already be 'in' the file as part of the directory monitoring - import job. As I would assume your XML contains the case.key in order for the system to identify the file.

It sounds like it is trying to open itself and hitting a wall.

whiteyes
Posts: 10
Joined: Wed Jan 07, 2015 11:37 am

Re: Importing XML to existing case

Post by whiteyes » Tue Mar 19, 2019 6:53 pm

Figured it out, it didn't have the case reference in the XML template. Stupid me.

Got another issue, is there a way to stop the import if a certain entry doesn't match a field?

I.e the import surname doesn't match with the surname entered already in the case?

steve
Posts: 384
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 77 times

Re: Importing XML to existing case

Post by steve » Tue Mar 19, 2019 7:14 pm

Hi,
it sounds like
* you have an XML import job, that is grabbing data from an XML, and importing it into a case reference specified in the XML
* your import job is set to UPDATE only (as opposed to NEW or OVERWRITE)
* data isn't mapped directly into 'live' fields in the XML, (very sensible), but instead into a set of holding fields (you call them IMPORT fields?) - e.g. you have {Client Surname IMPORT.Text} specified in your XML data template, instead of {Client.Surname}
* you don't want the live fields to be populated if certain criteria are met, such as if the client surname in the XML doesn't match the client surname on the case

is this right?
In which case, in the 'Linked Action' part of the Import job definition, specify a Linked action that performs the tests for you, and only populates the live fields if the tests are successful

Code: Select all

#let's make a variable to hold whether verification of XML data is OK or not
v-error = 0
#=====
# VALIDATION TESTS HERE
#=====
# perform your tests here to compare the holding fields to the live data
If {Client surname IMPORT.Text} <> {Client.Surname} then
v-error = 1
end
if {Client DOB IMPORT.date} <> {Client DOB.Date} then
#careful of date format supplied in your XML
v-error =1
end
if v-error = 0 then
#=====
# VALID DATA: populate live fields
#=====
put ({Client surname IMPORT.Text},{Client.Surname})
put ({Client DOB IMPORT.Date},{Client DOB.Date})
#etc
else
#=====
# INVALID DATA: ERROR HANDLER
#log? send email? 
#=====
end
With CSV imports, you can test individual fields to meet various criteria - and reject the whole record for import if the test fails. The manual (Tech 4 ) says this only applies to CSV import jobs though not XML

whiteyes
Posts: 10
Joined: Wed Jan 07, 2015 11:37 am

Re: Importing XML to existing case

Post by whiteyes » Tue Mar 19, 2019 7:45 pm

Wow thanks for this yes all you assumed is correct.

I have created a similar linked action but my problem is how to send a notification that the import is not valid without emailing it from the incorrect case? As well as attaching the a document with all the holding fields so they can easily find the file and manually enter the information into the correct case?

Thanks

steve
Posts: 384
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 77 times

Re: Importing XML to existing case

Post by steve » Tue Mar 19, 2019 11:35 pm

Create a new case, let's call it "IMPORT-STATS" or something similar. Doesn't have to be the same casetype as your import, but it might help. Mark this file as a test file or even mark as dead to exclude from MI/reporting. Give your IMPORT-STATS file a 'client' correspondent of, say, yourself or your IT team,

then either:
1) Do the import as per my previous post, andif you get a validation error in the post-import Linked Action, after you create the error notification email using the SEND EMAIL wizard, replace

Code: Select all

CASE (CURRENT-CASE)
with

Code: Select all

CASE (IMPORT-STATS) 
. This saves cluttering the live case with an incorrect history line if that bothers you.

2) import all your XML records into this one IMPORT-STATS file - hardcode "IMPORT-STATS" as the caseref in the XML if necessary. Forget trying to import into any externally supplied caseref. Each set of XML fields is imported into this one case, validated, then either OPEN/PUT/UPDATE into a live case or rejected. The holding fields are then cleared out at the end of the Linked Action prior to importing the next record/row.

This method can be enhanced to provide a record of import activity by collating everything in the IMPORT-STATS file. You can do MI on the IMPORT-STATS file for example to look at the proportion of failed validations by source/website/month etc.

To include the contents of the XML in any error notification email, just include the relevant holding fields in the error notification email body - presumably you just need {caseref IMPORT.Text} and {Client Surname IMPORT.Text} as a minimum to help a human find the right file.

whiteyes
Posts: 10
Joined: Wed Jan 07, 2015 11:37 am

Re: Importing XML to existing case

Post by whiteyes » Wed Mar 20, 2019 6:40 pm

Great thankyou I went with option 1. Been a massive help!

whiteyes
Posts: 10
Joined: Wed Jan 07, 2015 11:37 am

Re: Importing XML to existing case

Post by whiteyes » Thu Mar 21, 2019 7:07 pm

Hi me again, just done a test by entering a reference number that doesn't exist in the system and it created the file, any idea why? I've got ignore files with no cases ticked and nothing about creating a new file in the linked action.

Thanks

Enigma
Posts: 6
Joined: Mon Mar 04, 2019 1:01 pm

Re: Importing XML to existing case

Post by Enigma » Fri Mar 22, 2019 9:12 am

Hello,

I've had that myself. It is one of those weird quirks.

If I have had a csv with a few cases in it with typos it just creates a blank file even if you are doing an update job.

Not sure if there is a way around it or to stop it. If there is that would be handy to know!

I suppose you could do a linked action on the back of the import job that checks if the client name is blank and if the file was opened 'today' and then close the file automatically but that is the only thing that comes to mind right now.

steve
Posts: 384
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 77 times

Re: Importing XML to existing case

Post by steve » Fri Mar 22, 2019 9:33 am

Can you try adding a "description" to the field in your XML data template.
The manual says the below test only applies to CSV, but you never know...

1) define your XML data template and specify fields on the Fields/Field List tab.
2) either when you are specifying your fields, or by highlighting a line and clicking "update field" on the "Fields" tab, click "Descrip" on the "Select Proclaim Field".
3) Click New to add a new Field Description
4) choose "User Def", and enter
TEST,CaseExists=No,IgnoreCase
or
TEST,CaseExists<>Yes,IgnoreCase
click the tick to save the Field Description, SAE the field Descriptions then test with a caseref you know doesn't exist.

Post Reply