Solved

An edit in the dynamic model results in an error on a SF-database reference

  • 30 April 2024
  • 4 replies
  • 50 views

Badge +1

Hello everyone,

I have made an update to my dynamic model which edits the data model and the subjects. It sets certain columns to hidden in the subjects, while leaving the newly created display columns visible to the user. I had to make an edit to this dynamic model to prevent the following from happening: (link to a previous post)

I made sure the dynamic model made these columns hidden in the data model. But the following error occurs when I run this dynamic model object more than once:

It is an unclear error. I must add that we use the staged strategy, so that it does it's job every regeneration of the model. And this never posed a problem. But only after making this edit, so that the database columns are hidden on data model level, this error shows after a first successful run.

This is the error it gives when I run it using the generate model in the creation tab:

What must I do to resolve this error? I think the error is a little to unclear to actually know what is going on here. I know a reference constraint is violated, but the table it is on does not make sense to me, as everything is correctly configured in that table after checking by querying on the table.

icon

Best answer by Mark Jongeling 1 May 2024, 09:58

View original

4 replies

Userlevel 7
Badge +23

Hi Sander,

As communicated in the 2023.2 release notes, there is a enforced reference between the object and role rights. This means an object cannot be removed if there are rights for it; unless you use the Delete tasks available for many objects such as table (task_delete_tab) and column (task_delete_col).

To resolve this error, either ensure the object is not generated or include the role rights creation in the Dynamic model procedure.

Badge +1

Hi Mark,

I can try to update the roles of the columns I want to update (so they will be hidden in the data model) to see if the error goes away, but that does not explain why it goes right once, and doesn’t give me an error immediately. Is that because in a staged strategy the first update of these columns they do not have to be deleted? That would make sense and explains why it goes wrong the second time.

I am trying to update, non generated, existing columns. The generated columns are based on these columns. The generated columns go well, these are used for display purposes, but the actual, existing database columns need to be hidden so they won't pop up in the export list.

Userlevel 7
Badge +23

I am trying to update, non generated, existing columns.

That conflicts with the error you are getting. It seems the #col table does therefore miss a column. After running the code, the Software Factory will merge the #col records with the col table. The complete code can be seen using the task with the eye icon: 

So if the column is truly obsolete, the rights must be deleted first or column must be deleted using the task_delete_col; which will clean up the rights automatically no matter they were generated or not.

It's difficult for me to tell what the best solution is as I don't see the code nor the data model, so I do hope my replies help you make the correction 😄

Badge +1

Hi Mark,

Thank you for your help. I found the problem, I apparently set in the where clause that only visible columns must be used to create the new columns. Seeming that I already use a column tag to filter out the columns that I need, the conditional clause on visible columns was a bit redundant. Now that has been removed and now it works just fine.

Again thanks for your help, as it helped me find the problem by searching for rights and where they were set and possibly edited 😃

Reply