Hello,
I am trying to do some mass creation of records using a script task in a business process. I have a for loop looping through entities, and on each of these entities there is a account address, but I need the account off of that account address so I have another esq for the account address. The issue is when I try to use the column accountaddress to get the account id I receive the error
Terrasoft.Common.InvalidObjectStateException: Column UpAccountAddress value cannot be obtained because it has not been loaded.
This is my code.
// Get business process parameters.
var tagId = Get("TagId");
var userId = Get("userId");
// Create a reference to the UpMapSearchAccounts schema.
var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "UpMapSearchAccounts");
// Add the [UpMapping] column in order to filter for relevants records.
esq.AddColumn("UpMapping");
esq.AddColumn("UpAccountAddress");
var esqFilter = esq.CreateFilterWithParameters(FilterComparisonType.Equal, "UpMapping", userId);
esq.Filters.Add(esqFilter);
var entities = esq.GetEntityCollection(UserConnection);
foreach(Entity entity in entities)
{
// Creating a reference to AccountAddress to get the Account off of it.
var esqAccountAddress = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "AccountAddress");
esqAccountAddress.AddColumn("Account");
var accountAddressEntity = esqAccountAddress.GetEntity(UserConnection,
entity.GetTypedColumnValue("UpAccountAddress"));
// Create a reference to the AccountInTag schema in order to create records.
var AccountInTagSchema = UserConnection.EntitySchemaManager.GetInstanceByName("AccountInTag");
var tagEntity = AccountInTagSchema.CreateEntity(UserConnection);
tagEntity.SetColumnValue("TagId", tagId);
tagEntity.SetColumnValue("EntityId", accountAddressEntity.GetTypedColumnValue("Account"));
tagEntity.SetColumnValue("CreatedById", userId);
tagEntity.SetDefColumnValues();
tagEntity.Save();
}
return true;
Any help is appreciated. Please ask any questions if I am not clear enough.
Thanks!
Like
Additional comments.
I went on and tried to recreate the error in a simpler process. This process just has an auto-generated page to show parameters passed from the client side.
See attached

The code that fires this process is here.

I still get this error.
Terrasoft.Common.InvalidObjectStateException: Column Name value cannot be obtained because it has not been loaded.
I'm not sure what could be causing this error. I have created stuff along these lines before, but I have never faced this issue.
Help is appreciated!
Thanks!
Dear Tyler,
Unfortunately, it is difficult to determine the root cause of the issue. I tried to reproduce the issue, however I were not able to face it.
Therefore, please try to debug the source code of the process. In order to do it please do the following:
1. Deploy an application on-site. Please find more information in the article by the link below:
https://academy.creatio.com/documents/administration/7-15/installing-cr…
2. Debug the process. Please find more information about it in the article by the link below:
https://academy.creatio.com/documents/technic-sdk/7-15/server-code-debu…
Best regards,
Norton