Generating printable and attaching it to an email.

I am trying to generate a printable from the opportunity object (which will be a quote) and attach this printable to an email after generating.

 

I am getting stuck on the generate and save printable script task. 

This is the error I am getting

Terrasoft.Common.ItemNotFoundException: Value "Name" was not found.
   at Terrasoft.Core.Entities.EntityColumnValueCollection.GetByName(String name)
   at Terrasoft.Core.Entities.Entity.SetColumnValue(String valueName, Object value)
   at Terrasoft.Core.Process.UsrlabSavePrintableAndEmailQuote1Custom6.ScriptTask1Execute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.Execute(ProcessExecutingContext context)

 

I'm not sure what the issue is. I tried hardcoding the name in the script but that doesn't seem to work either. 

 

My script action that is failing.

var reportService = new Terrasoft.Configuration.ReportService.ReportService();
Terrasoft.Configuration.ReportService.ReportData report = reportService.GenerateMSWordReport(
    (PrintableId.ToString()), ObjectId.ToString(), ConvertToPdf);
var entity = UserConnection.EntitySchemaManager.GetInstanceByName("Opportunity");
var fileEntity = entity.CreateEntity(UserConnection);
fileEntity.SetDefColumnValues();
fileEntity.SetColumnValue("Id", OpportunityId);
fileEntity.SetColumnValue("TypeId", AttachmentType);
fileEntity.SetColumnValue("Name", "ExamplePrintable.docx");
fileEntity.SetColumnValue("Data", report.Data);
fileEntity.Save();
 
 
return true;

 

Let me know if you need any more information.

Also, any documentation where I can read up on this myself. Like the fileEntity variable, or just how this code works in general.

 

Any help is appreciated thanks!

Like 0

Like

1 comments

Hi Tyler,

Implemented this week a very similiar feature throw a business process.

I reversed engeneered this market place app: https://marketplace.bpmonline.com/template/creating-quotes-opportunities

But I used the user task instead of the script task in the processes as I was getting in trouble passing the process parameters to the script task.

 

Hope it helps,

Luis

Show all comments