Hi,

 

I'm trying to retrieve a collection using EntitySchemaQuery but when try to assign it to a Parameter i get the following error:

System.NotSupportedException: EntityCollection
   at Terrasoft.Core.Process.FlowEngineStateService.InternalSetValue[T](Guid processUId, String parameterPath, T value)
   at Terrasoft.Core.Process.FlowEngineStateService.Terrasoft.Core.Process.IInternalProcessParameterStore.InternalSetParameterValue[T](Guid processUId, String parameterPath, T value)
   at Terrasoft.Core.Process.ProcessInstanceParameterStore.SetParameterValue[TValue](String parameterPath, TValue value)
   at Terrasoft.Core.Process.ProcessInstanceParameterStore.SetParameterValue[TValue](ProcessSchemaParameter parameter, Guid schemaElementUId, TValue value)
   at Terrasoft.Core.Process.ProcessModel.SetParameterValue[T](FoundParameterData result, T value)
   at Terrasoft.Core.Process.ProcessModel.TrySetValue[T](ProcessSchema processSchema, String propertyPath, T value)
   at Terrasoft.Core.Process.ProcessModel.Set[T](String propertyPath, T value)
   at Terrasoft.Core.Process.UsrGetLeadsBySalesCompanyMethodsWrapper.ScriptTask1Execute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessScriptTask.InternalExecute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.Execute(ProcessExecutingContext context)

Example code:

var salesCompanyId = Get<Guid>("InSalesCompany");
 
// Creating a query instance with the "Lead" root schema.
var esqLead = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "Lead");
esqLead.AddColumn("UsrSalesCompany");
esqLead.AddColumn("CreatedOn");
esqLead.AddColumn("UsrLeadPriority");
esqLead.AddColumn("Id");
esqLead.Filters.Add(esqLead.CreateFilterWithParameters(FilterComparisonType.Equal, "UsrSalesCompany.Id", salesCompanyId));
 
// Filters in the query filter collection will be combined with the logical OR operator.
esqLead.Filters.LogicalOperation = LogicalOperationStrict.Or;
 
 
var entities = Get<ICompositeObjectList<ICompositeObject>>("ReadActiveOverrides.ResultCompositeObjectList");
foreach(var entity in entities) {
 
    Guid value;
    var fromSalesCompanyId = entity.TryGetValue<Guid>("UsrFromSalesCompany", out value) ? value : Guid.Empty;
    var toSalesCompanyId = entity.TryGetValue<Guid>("UsrToSalesCompany", out value) ? value : Guid.Empty;
 
    if(fromSalesCompanyId == Guid.Empty){
        throw new Exception($"fromSalesCompanyId it is an empty guid {entity.ToString()}");
    }
 
    if(toSalesCompanyId == Guid.Empty){
        throw new Exception($"toSalesCompanyId it is an empty guid {entity.ToString()}");
    }
 
	esqLead.Filters.Add(esqLead.CreateFilterWithParameters(FilterComparisonType.Equal, "UsrSalesCompany.Id", fromSalesCompanyId));
}
 
/*
Select selectEsq = esqLead.GetSelectQuery(UserConnection);
throw new Exception(selectEsq.GetSqlText());
*/
 
var res = esqLead.GetEntityCollection(UserConnection);
 
Set("OutLeads", res);

Paremeter OutLeads is a Collection of Objects (EntityCollection)

Any help is appreciated

 

Like 0

Like

6 comments

Theoretically, you can debug the business process and find the reason. Please check the "Server code debugging" article in the academy.bpmonline.com. However, I recommend you to investigate the situation one step forward. There is no way to operate EntityCollections in any business processes element except a script task. So probably it will be a good idea to continue processing the collection in the script task where it was created. Transferring collections might consume a lot of the application resources and decrease the performance if the collection is large.  

Additionally, please don't use "throw new Exception" at all. The fact that you use it means that you literally generate errors in the application. C# and JS code should not contain errors. It should communicate with a user in a regular way. 

Eugene Podkovka,

Hi Eugene, so the idea of sharing an EntityCollection created by ESQ on a script task using process parameters is not supported. correct?

I can put all the code inside a single script task but it will make it too big, the idea is to have different subprocess applying different filters.

Is there any other way to share at least a list of Ids between processes? I don't need a full entity only the ids are enough.

Eugene Podkovka,

Thank you for the answer, the throws new Exceptions are there to verify that the data is correct. I don't want the process running if it has missing information. 

How else can i leave the error on the process log?

Luciano De Munno,

I can't say that it's not supported, but it will be hard to do. The reason is that it's incorrect to split a single c# functionality between different business processes.

Just write correct c# code. Use different methods or even different classes. Create your own logging that will track all possible exceptions. This is the general way of good clean coding. 

Eugene Podkovka,

So, short answer is not supported.

The idea is to make a quick simple process to filter a list using what's already provided by bpm.

 

thank you for the answer

Show all comments

Hi Guys ,

Please guide me, how to rename the main page (system ) display name ?

Secondly, How to add web page on the "About" section ?

---pfa--

 

Like 0

Like

1 comments

Dear Nikhil,

You can check the following article on how to integrate other web site within bpm'online.

https://academy.bpmonline.com/documents/technic-sdk/7-13/integration-third-party-sites-iframe

As for the section renaming, please open section wizard within needed section and change the title of section.

Regards,

Anastasia

Show all comments

In short, is this possible? For example, I want to require entry of a Contact Type on a new contact entry page, but I want to do it in the UI, not by making the underlying data column a NOT NULL column.

Like 0

Like

2 comments

Dear Jeffrey, 

You can do this with the field validation on the page. Here is the academy article on how to do that: 

https://academy.bpmonline.com/documents/technic-sdk/7-13/how-add-field-validation

Best regards,

Dennis

 

Thanks Dennis!

Show all comments

Hi guys, 

Do you know how to include a space between 2 buttons in an Edit page?

 

 

 

 

Thank you so much!

Like 0

Like

3 comments

Dear Eric,

In order to add a space between two buttons please use custom css style. Please find more information in the article by the link below:

https://community.bpmonline.com/questions/how-add-custom-style-control-page-based-condition

Best regards,

Norton

Hi Norton, thanks for your reply. Actually I applied the following code and now we got spaces between the buttons but unfortunately when we hit the buttons they are not working anymore. Is there any other trick here?

 

 

Dear Eric,

In general, adding custom css style does not affect the working of the buttons on the page. Therefore, most likely the issue is in the code that implement the custom buttons in the section. In order to identify the issue please do the following:

1. Delete custom css style.

2. If the issue was resolved, please read the article about how to add custom css again.

3. If the issue remained, please check the source code of custom buttons.

In order to get an additional information, please contact the account manager regarding receiving the “Advisory hours” service.

Best regards,

Norton

Show all comments

Hi, 

Is it possible to specify a different attribute (unique attribute from the source table) instead of Name in the Data Import templates for Lookup columns? 

For example, to update existing prices an import to Product Price table must be done. In the Data Import Template for Product Price table, there is a Product (Lookup) column. The name of the product goes in the Product column for bpmonline to identify the referenced product. Is it possible to use Product code instead of Product Name as there may be more than 1 product with the same name but the code is unique across the entire product catalog. 

Regards,

Hatim

 

Like 0

Like

1 comments

Dear Hatim,

You can specify any value as an attribute for duplication check as long as this value is unique.

Best regards,

Angela

Show all comments

Hi guys,

 

Can you please guide me to how to add images in dashboard sections ?

Like 0

Like

1 comments

Dear Nikhil,

It is possible to add an image to the dashboard section only using custom CSS styles. However, the custom CSS styles can be added only to a custom widget in the dashboard. Therefore, in order to add the image please firstly create the custom widget.

Please find more information in the article from the link below:

https://academy.bpmonline.com/documents/technic-sdk/7-12/adding-custom-dashboard-widget?document=&_ga=2.252225801.1861100856.1568022560-1432738620.1562155819

Best regards,

Norton

Show all comments

Hi,

I have the Project detail section included on one of my Account tabs, so that users can see all current and past projects we have worked on with that customer.

The issue is that his Project section detail list includes Project Tasks as well as the Project, where I only wish to display the Projects. I cannot find a way to filter out the Project Tasks from this display and the simple workaround of displaying the Project Task Type in the output is not great, as this only allows the user to identify and not remove. The live filter option is a one time thing and would mean a user has to create the filter each time they load the page up, which is not efficient.

How can I have this only showing Projects?

 

Like 0

Like

1 comments

Dear Mark, 

You can add a filter to the detail in code of this detail. Here is the example of how to do this (you can ignore the part of reading the MasterDetailRecordId and just adjust the filter part to your needs):

https://community.bpmonline.com/articles/filtering-detail-records-based-selected-record-other-detail

Best regards,

Dennis

Show all comments

Добрый день, коллеги!

На нашем коммерческом проекте сильно увеличился размер БД - разрослись системные таблицы.

Подскажите, можно ли уменьшить размер системных таблиц в БД? 

Предполагаю, что возможно очистить таблицу SysProcessElementLog.

Like 0

Like

1 comments

I am trying to used lookup for “VwSysSchemaInfo” which lists the Object’s Name(For example : in LandingType table, column name schemaUid for object lists). But am getting foreign key error like

“SqlException. Foreign key 'FKYLKAi7ejsTUaCmQl1hwk3jQcw' references object 'dbo.VwSysSchemaInfo' which is not a user table. Could not create constraint or index. See previous errors.”

Please help.

I need to have this lookup. Why am I not able to use this. Since its already by implemented in one of the table (LandingType), why is this not possible for custom objects.

Also please help me to use this as a lookup column.

Like 0

Like

1 comments

Hello Sriraksha,

The cause of this message is in fact that there is no possibility to bind lookup to a view table via section wizard - it will result in this error message, but it will work (you can bind lookup to a view table) via configurations and object directly. Please go to configurations, find needed object and column in it, add necessary binding, save and publish the object and you will be able to bind a lookup field to a view table.

Best regards,

Oscar

Show all comments

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