Sending an email spanning two cases

Discuss your general Proclaim related queries here.
rajeev108
Posts: 275
Joined: Sat Feb 11, 2012 9:17 am
Has thanked: 9 times
Been thanked: 2 times

Sending an email spanning two cases

Post by rajeev108 » Tue Mar 05, 2013 3:17 pm

[proclaimadmin] moved to General Proclaim Discussion
Is there a way we can send an email which selects attachments from one case file and allows items to be attached from another file? I am thinking of a scenario where a client has two cases but I want to send a joint letter for both the cases whilst attaching documents from two separate case files?
Regards
Rajeev

steve
Posts: 388
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 80 times

Re: Sending an email spanning two cases

Post by steve » Tue Mar 05, 2013 4:35 pm

Embedded Docs are the approach to take, and thinking out loud, document bundling too.
there are probably a few ways of doing it..

let's take the scenario of a 'master' file that you wish to send the email on, in which to attach items from a linked ' slave' file.

create an embedded document field "slave file attachments" or similar
create a memo, type PDF BUNDLE template (BUNDLE01) "slave file attachments" in workflow maint and Embed Into this field using Workflow Maintenance.
create your email template to client (eg EMAIL01), and add the BUNDLE01 as a pre-assigned attached embedded document within Workflow Maint
create a maths item linked action: (pseudocode)

Code: Select all

#=======================
#store the case keys in variables
#=======================
v-this-case = {case.key}
v-slave-case = {slave case link.link case ref}
#=======================
#open the slave file from within the master file - add some case lock checks here
#=======================
OPEN (v-slave-case,"LOCK")
#=======================
#'prompt user to select items from slave file, and bundle these into one PDF
#use the wizard to create this phrase. Overwrite cost units with "?" in order to bring up the dialogue for the user to select the required attachments
#=======================
SEND MEMO (BUNDLE01) COST UNITS (?) TO (CLIENT) DETAIL (attachments from slave file) CASE (v-slave-case)
#=======================
#slave case embedded document field now contains a PDF with all the embedded docs selected by the user.
#get the embedded doc details from the slave case into local variables
#=======================
v-slave-ED-code = {slave case link.slave file attachments.Document Code}
#=======================
#repeat for other embedded document properties - date, sender etc as you need.
#close and unlock the slave case
#=======================
update (v-slave-case,"UNLOCK")
#=======================
#create the same memo on the master case - with no attachments. This gives us a matching memo in the master case.
#=======================
SEND MEMO (BUNDLE01) COSTS UNITS (0) TO (CLIENT) DETAIL (attachments from slave file) CASE (v-this-case)
#=======================
#replace the embedded doc code for this memo with that of the slave case.
#=======================
put (v-slave-ED-code, {slave file attachments.Document Code})
#=======================
#repeat for all other slave ED properties
#...
#now send your email to client from master case, which already attaches the items from the slave case.
# set COST UNITS (?) to allow user to select items from MASTER case to attach. Use the wizard to create:
SEND EMAIL (EMAIL01) COST UNITS (?) TO (CLIENT) DETAIL (email to client attaching this case and slave case items) ATTACH (slave file attachments) CASE (v-this-case)
So what you've done is collect the items from the slave case and combined them into one bundle memo. You've then stored this bundle document reference in an embedded document code.
Within the master file you have created a placeholder memo in the history (in order that the email to client has something to 'grab'), and you've overwritten the embedded document code for the placeholder with the slave file bundle. That memo's embedded document code in the master file now points to the slave file's embedded document code
You then create an email in the master file, attaching the placeholder memo by default (this is our slave file attachments), and by setting COST UNITS (?) we allow the fee earner to select items from the master file to include with the email too.

This is all untested pseudo code, but we've done similar things in the past. I hope it gives you a starting point

steve

rajeev108
Posts: 275
Joined: Sat Feb 11, 2012 9:17 am
Has thanked: 9 times
Been thanked: 2 times

Re: Sending an email spanning two cases

Post by rajeev108 » Tue Mar 05, 2013 5:19 pm

Thanks, Steve, I will give it a go.
Regards
Rajeev

rajeev108
Posts: 275
Joined: Sat Feb 11, 2012 9:17 am
Has thanked: 9 times
Been thanked: 2 times

Re: Sending an email spanning two cases

Post by rajeev108 » Tue Mar 19, 2013 11:26 am

Hi Steve,

Not having used embedded documents before, I decided to read up on them first. On using the logic you describe, I get the embedded document appearing in the slave file. I copied that document code in the live. Howver I can see the document being copied correctly in the master case but I do not see any attachment. I hyave ignored the pdf bundle memo in my test. Is it of any importance in making the code work.

I basically tried the linked action below in the master case without success

SEND LETTER (CL1-701TEST) TO (CLIENT) COST UNITS (0.00) DETAIL (TA6 - Property Information Form (Ignire)) CASE ({lnkConv.Link Case Ref})
MESSAGE( {lnkConv.ed purchase1.Document code} )
PUT( {lnkConv.ed purchase1.Document code} , {ed purchase1.Document code} )
MESSAGE( {ed purchase1.Document code} )
SEND LETTER (CL1-100ATEST) TO (CLIENT) COST UNITS (1.00) DETAIL (Client 1 - Introductory Letter to Client (Ignore)) ATTACH (ed purchase1) CASE (CURRENT-CASE)
UPDATE( {case.key} , "" )

Can you please tell me hwere I am going wrong? As you say, the logic works for you so there must be some flaw in my understanding.
Regards
Rajeev

rajeev108
Posts: 275
Joined: Sat Feb 11, 2012 9:17 am
Has thanked: 9 times
Been thanked: 2 times

Re: Sending an email spanning two cases

Post by rajeev108 » Tue Mar 19, 2013 12:02 pm

Just experimenting with the above code if I replace the line

PUT( {lnkConv.ed purchase1.Document code} , {ed purchase1.Document code} )

with
PUT( 121111, {ed purchase1.Document code} )
it works. In this case, 121111 is a document from the case's own history. It almost seems that picking the document code from another case is the issue. But how does one resolve it?
Regards
Rajeev

rajeev108
Posts: 275
Joined: Sat Feb 11, 2012 9:17 am
Has thanked: 9 times
Been thanked: 2 times

Re: Sending an email spanning two cases

Post by rajeev108 » Tue Mar 19, 2013 12:11 pm

In the above code which works for PUT( 121111, {ed purchase1.Document code} )
If 121111 is a document code from another case then it does not work. It says there is an attachment but does not show anything. It is almost right but something is missing when the attachment refrred to is from another case.
Regards
Rajeev

steve
Posts: 388
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 80 times

Re: Sending an email spanning two cases

Post by steve » Wed Mar 20, 2013 11:21 am

Hi Rajeev, you need a few things in place first - most importantly, the embedded document code must be 'linked' to a letter template in order that it can be used in an attachment.

Let me Comment your code:

Code: Select all

#======== 
#define variables for master-case and slave-case, as there may be ambiguity over what CURRENT-CASE refers to
#======== 
v-master-case = {case.key}
v-slave-case ={lnkConv.Link Case Ref}
MESSAGE ("Debug: Slave file ref: ", {lnkConv.Link Case Ref},NEWLINE,"Slave client name: ",{lnkConv.Client.Full Name/Company Name}(
#======== 
#SEND LETTER ON SLAVE CASE
#The template CL1-701TEST MUST embed into an embedded doc field in the slave casetype - this called "ed purchase1"  in the slave casetype - as set in workflow maintenance
#======== 
SEND LETTER (CL1-701TEST) TO (CLIENT) COST UNITS (0.00) DETAIL (TA6 - Property Information Form (Ignire)) CASE (v-slave-case) 
#debug - show us that the document code has been embedded in the slave case
MESSAGE( {lnkConv.ed purchase1.Document code} ) 
#======== 
#COPY the document code from the slave case to the master case
#======== 
PUT( {lnkConv.ed purchase1.Document code} , {ed purchase1.Document code} ) 
#??need an update () here?

#************NOTE 1 **************
#debug - check it has copied
MESSAGE( {ed purchase1.Document code} ) 
#************NOTE 2 **************
#======== 
#create the below SEND LETTER using the wizard after following note 2:
#======== 
SEND LETTER (CL1-100ATEST) TO (CLIENT) COST UNITS (1.00) DETAIL (Client 1 - Introductory Letter to Client (Ignore)) ATTACH (ed purchase1) CASE (v-master-case) 
UPDATE( {case.key} , "" ) 
************NOTE 1 **************
you should copy not just the document code from the embedded doc, but the other embedded doc properties too. Then, overwrite the 'action type' and 'correspondent' to match that on the master file (I guess they are both client so this is less important?)
{ed purchase1.sent on}
.sent at
.sent by
PUT ("SL",{ed purchase1.action type})
.action code
PUT ("CL", {ed purchase1.Correspondent})
.details
.tel/fax/email

************NOTE 2 **************
in the master file casetype, you need to create a letter template in workflow maintenance - call it SLAVEHOLDING01 (slave file attachment placeholder) that is the same type (e.g. Word Document) as your slave case attachment, and to the correct correspondent that matches the {ed purchase1.Correspondent} above, and choose "Embed Into" for this template to be your ed purchase1 field. You never have to send this letter, but it gives the 'attach' something to chew on.
Then in your CL1-100ATEST letter template in workflow maint, you choose this new SLAVEHOLDING01 letter as "embedded document to be sent with this document".
When you go to send your CL1-100ATEST in the maths, use the wizard to create the code for you -it will include the correct ATTACH(xxxxx) for you.

n.b. the 'embedded dodument to be sent with this document' lists LETTER CODES, not EMBEDDED DOC FIELDS to choose, wihch I think is a confusing feature.
If the ED field has first been chosen as an 'embed into' for a letter code (TEST1 - test letter template 1), then the same ED code is chosen as the 'embed into' for a different letter code(TEST2 - test letter template 2), when you go to the 'embedded document to be sent with this document' on any other template you see the first letter code that the ED field was chosen on (TEST1), but it will attach TEST2 if that letter has been sent more recently than TEST1.


Bundle:
The bundle is only necessary if you are attaching more than one item from the slave case to the master case; by sending a bundle on the slave case and choosing your attachments, it creates a single PDF file, that can be embedded into a single field/document. You can then ATTACH this one bundle in your master document to include the many slave case attachments at once, instead of coding up a method of copying each and every attachment's ED codes etc.

rajeev108
Posts: 275
Joined: Sat Feb 11, 2012 9:17 am
Has thanked: 9 times
Been thanked: 2 times

Re: Sending an email spanning two cases

Post by rajeev108 » Wed Mar 20, 2013 1:00 pm

Thanks, Steve. I will give it another go. I had spoken to Eclipse yesterday and they said it is not possible to send an email spanning two cases so I had given up.
Regards
Rajeev

steve
Posts: 388
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 80 times

Re: Sending an email spanning two cases

Post by steve » Wed Mar 20, 2013 1:06 pm

OK.
you're not 'sending' an email across two cases' here, rather you are sending the email on one case and copying it to another case - this is possible!
We have it working at one of our client sites, but the purpose is slightly different. Indeed we have it working across different casetypes too - a letter is sent on one casetype and then copied and sent out from another linked casetype.

rajeev108
Posts: 275
Joined: Sat Feb 11, 2012 9:17 am
Has thanked: 9 times
Been thanked: 2 times

Re: Sending an email spanning two cases

Post by rajeev108 » Wed Mar 20, 2013 3:00 pm

Steve I have used the following code which has not worked

Code: Select all

#======== 
#define variables for master-case and slave-case, as there may be ambiguity over what CURRENT-CASE refers to 
#======== 
v-master-case = {case.key} 
v-slave-case = {lnkConv.Link Case Ref} 
MESSAGE( "Debug: Slave file ref: " , {lnkConv.Link Case Ref} , NEWLINE , "Slave client name: " , {lnkConv.Client.Full Name/Company Name} ) 
#======== 
#SEND LETTER ON SLAVE CASE 
#The template CL1-701TEST MUST embed into an embedded doc field in the slave casetype - this called "ed purchase1"  in the slave casetype - as set in workflow maintenance 
#======== 
SEND LETTER (CL1-701TEST) TO (CLIENT) COST UNITS (0.00) DETAIL (TA6 - Property Information Form (Ignire)) CASE (v-slave-case) 
#debug - show us that the document code has been embedded in the slave case 
#MESSAGE( {lnkConv.ed purchase1.Document code} ) 
#======== 
#COPY the document code from the slave case to the master case 
#======== 
PUT( {lnkConv.ed purchase1.Document code} , {ed purchase1.Document code} ) 
PUT( {lnkConv.ed purchase1.Sent on} , {ed purchase1.Sent on} ) 
PUT( {lnkConv.ed purchase1.Sent at} , {ed purchase1.Sent at} ) 
PUT( {lnkConv.ed purchase1.Sent by} , {ed purchase1.Sent by} ) 
PUT( {lnkConv.ed purchase1.Action type} , {ed purchase1.Action type} ) 
PUT( {lnkConv.ed purchase1.Action code} , {ed purchase1.Action code} ) 
PUT( {lnkConv.ed purchase1.Correspondent} , {ed purchase1.Correspondent} ) 
PUT( {lnkConv.ed purchase1.Details} , {ed purchase1.Details} ) 
PUT( {lnkConv.ed purchase1.Telephone/fax/e-mail} , {ed purchase1.Telephone/fax/e-mail} ) 
UPDATE( {case.key} , "" ) 
#??need an update () here? 
#************NOTE 1 ************** 
#debug - check it has copied 
#MESSAGE( {ed purchase1.Document code} ) 
#************NOTE 2 ************** 
#======== 
#create the below SEND LETTER using the wizard after following note 2: 
#======== 
SEND LETTER (CL1-100ATEST) TO (CLIENT) COST UNITS (1.00) DETAIL (Client 1 - Introductory Letter to Client (Please ignore)) ATTACH (ed purchase1) CASE (v-master-case) 

UPDATE( {case.key} , "" ) 
I created CL1-100ATEST2 which has 'ed purchase1' in embed into. I see this embedded into cl1-100atest.

There is an attachment but it cannot be read.
Regards
Rajeev

Post Reply