Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecordService.Delete triggers workflows that refer non deleted record #198

Closed
ArnoldV opened this issue Aug 5, 2019 · 6 comments

Comments

@ArnoldV
Copy link

commented Aug 5, 2019

When creating a custom workflow where you delete a record a YSOD shows and the following callstack shows that after the delete of a record the workflows are called again referecing a now deleted record.

It crashes when using this code in the workflow:

record.State = Umbraco.Forms.Core.Enums.FormState.Deleted;

or/also:
var recordService = new RecordService(); recordService.Delete(record, record.GetForm());

Since this code seems to be called async from Forms Core it can't be worked around by us.

Object reference not set to an instance of an object.] Umbraco.Forms.Data.Storage.RecordFieldStorage.GetAllRecordFields(Record record, Form form) +137 Umbraco.Forms.Data.Storage.RecordStorage.GetRecord(Object id, Form form) +330 Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(List1 workflows, RecordEventArgs e) +1688
Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(Record record, Form form, FormState state, Boolean editMode) +238
Umbraco.Forms.Web.Services.RecordService.Delete(Record record, Form form) +385`


This item has been added to our backlog AB#2214

@nul800sebastiaan

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

Thanks @ArnoldV - looks like a bug!

Out of curiosity, what are you using the Delete functionality for in this case?

@ArnoldV

This comment has been minimized.

Copy link
Author

commented Aug 8, 2019

@nul800sebastiaan We use Umbraco Forms to let people vote. We check their email and/or IP address and if they already voted there record will be deleted in one of the workflows. Currently we just replace all the voting info with emtpy strings.. and handle some other stuff.. like different redirect based on if you already voted or not.

@nul800sebastiaan

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

This looks like a duplicate of #136 - can you confirm which versions you're using @ArnoldV

@ArnoldV

This comment has been minimized.

Copy link
Author

commented Aug 21, 2019

@nul800sebastiaan seems indeed to be a duplicate. Using latest version (cloud project)

@nul800sebastiaan

This comment has been minimized.

Copy link
Member

commented Aug 21, 2019

@ArnoldV Thanks! v7 or v8, that's the big question? 😁

@ArnoldV

This comment has been minimized.

Copy link
Author

commented Aug 21, 2019

@nul800sebastiaan ah! actually a v7 project this time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.