Hi,
Does anyone have an example on how to attach a report to a mail on a workflow script ?
Regards,
Oli
Hi,
Does anyone have an example on how to attach a report to a mail on a workflow script ?
Regards,
Oli
You can use the manageEmail widget (Workflow Manual, page 38) or the NewMail API (Workflow Manual, page 53).
CMDBuild Team
You can use the manageEmail widget (Workflow Manual, page 38) or the NewMail API (Workflow Manual, page 53).
CMDBuild Team
You can use the manageEmail widget (Workflow Manual, page 38) or the NewMail API (Workflow Manual, page 53).
CMDBuild Team
Thanks for your reporting, we will update the manual
CMDBuild Team
I still have trouble using the NewMail object with the message :
Thanks for your reporting, we will update the manual
CMDBuild Team
I still have trouble using the NewMail object with the message :Error in method invocation: Method withAttachment( java.lang.String ) not found in class'org.cmdbuild.common.mail.DefaultNewMailHere's the simple piece of codeEmail = xxx@yyyy.com";Datum=Calendar.getInstance();FlowStatus = cmdb.selectLookupByCode("FlowStatus", "open.running");newReport=cmdb.createReport("test 1NA","pdf").download();cmdb.newMail().withFrom(cmdbuild@oxya.com").withTo(Email).withSubject("Mail subject " + Datum.getTime().toString()).withContent("Mail content").withAttachment(newReport.getUrl()).send();Previously Tecnoteca wrote:Thanks for your reporting, we will update the manual
CMDBuild Team
The .getUrl() method of the DownloadedReport object returns a String (not a URL). So you have to create a new URL object and then use it into to the .withAttachment() method in this way:
reportURL = new URL(newReport.getURL());
cmdb.newMail()
...
.withAttachment(reportURL)
...
.send();
Best regards
CMDBuild Team
Previously Oli wrote:
Hi,Can't figure out where the error is !I tried to parse the source code for the withAttachement() method but it is defined correctly.Tried to update my libs both in shark and cmdbuild webapps (using 2.1.4) but still stuck at this pointanybody tried to send report through workflow ?no script example, really ?Regards,OliPreviously Oli wrote:I still have trouble using the NewMail object with the message :Error in method invocation: Method withAttachment( java.lang.String ) not found in class'org.cmdbuild.common.mail.DefaultNewMailHere's the simple piece of codeEmail = xxx@yyyy.com";Datum=Calendar.getInstance();FlowStatus = cmdb.selectLookupByCode("FlowStatus", "open.running");newReport=cmdb.createReport("test 1NA","pdf").download();cmdb.newMail().withFrom(cmdbuild@oxya.com").withTo(Email).withSubject("Mail subject " + Datum.getTime().toString()).withContent("Mail content").withAttachment(newReport.getUrl()).send();
The .getUrl() method of the DownloadedReport object returns a String (not a URL). So you have to create a new URL object and then use it into to the .withAttachment() method in this way:
reportURL = new URL(newReport.getURL());
cmdb.newMail()
...
.withAttachment(reportURL)
...
.send();
Best regards
CMDBuild Team
Previously Oli wrote:
Hi,Can't figure out where the error is !I tried to parse the source code for the withAttachement() method but it is defined correctly.Tried to update my libs both in shark and cmdbuild webapps (using 2.1.4) but still stuck at this pointanybody tried to send report through workflow ?no script example, really ?Regards,OliPreviously Oli wrote:I still have trouble using the NewMail object with the message :Error in method invocation: Method withAttachment( java.lang.String ) not found in class'org.cmdbuild.common.mail.DefaultNewMailHere's the simple piece of codeEmail = xxx@yyyy.com";Datum=Calendar.getInstance();FlowStatus = cmdb.selectLookupByCode("FlowStatus", "open.running");newReport=cmdb.createReport("test 1NA","pdf").download();cmdb.newMail().withFrom(cmdbuild@oxya.com").withTo(Email).withSubject("Mail subject " + Datum.getTime().toString()).withContent("Mail content").withAttachment(newReport.getUrl()).send();