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

Using Model.Summary in email templates does not show all steps. Just the first step. #94

Open
bythewiseman opened this issue Feb 25, 2025 · 6 comments
Assignees
Labels
state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks

Comments

@bythewiseman
Copy link

bythewiseman commented Feb 25, 2025

We want all the steps in the current workflow to be present in the email that gets sent on all states. @Model.Summary I expect to do that, but doesn't.

Reproduction

Editing the Rejection notification email template; adding @Model.Summary; one would expect all the steps of the workflow messaging to be in the email. Or at least the last message applied to the workflow, in this case the Rejection Message.

However only the first Step appears.

The rejection message is in the Model. I know this by adding:

@Newtonsoft.Json.JsonConvert.SerializeObject(Model)

and seeing all the data contained therein. Things I have noted in this JSON output is that "currentStep" is always 0 and that tasks[x].instance object is always the a copy of the first task as the message is always the same. I don't know if that is by design.

And the Summary never contains tasks[x].comment only containing tasks[x].instance.comment again I don't know if that is by design.

The loop in your code (looking via dotPeek) feels like it doesn't work, looking for ApprovedByUserId but the JSON I can see shows approvedByIds, so maybe something is wrong there to stop the loop from going round each task?

Expected result

Upon using @Model.Summary I should see all the steps in descending order that has happen in the current workflow.

Actual result

Upon using @Model.Summary I only see the first step in the email.


This item has been added to our backlog AB#49684

@nathanwoulfe
Copy link

Hey @bythewiseman, thanks for the report. The Summary property should behave as you've described - it should include the same list as shown in the backoffice, which includes all completed steps and all pending.

Will get this into the next sprint and find a solution.

@nathanwoulfe nathanwoulfe added the state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks label Feb 25, 2025
@nathanwoulfe
Copy link

Which Workflow + CMS versions are you using?

@nathanwoulfe nathanwoulfe self-assigned this Feb 25, 2025
@bythewiseman
Copy link
Author

Which Workflow + CMS versions are you using?

We are using U13 latest version and I upgraded Workflow via Nuget before testing to the latest version for U13.

@nathanwoulfe
Copy link

I haven't been able to reproduce this. In my tests latest v13 sends the following emails (this is a very simple site setup, with three groups each with a single user. Workflow was initiated, then approved by Group 1 and Group 2, before being rejected by Group 3):

Workflow submitted for approval

Hello test@test.test,
Please review the following page for publish approval:

[Home](https://my.site.com/umbraco#/content/content/edit/1057?ref=workflow)
Summary

Current status: Pending approval

Change description
Publish requested by test@test.test on March 3, 2025 at 11:40 AM
    Comment: test test

Stage 1
Pending approval by Group 1
Stage 2
Pending approval by Group 2
Stage 3
Pending approval by Group 3

Approved by Group 1, request sent to Group 2:

Hello test@test.test,
Please review the following page for publish approval:

[Home](https://my.site.com/umbraco#/content/content/edit/1057?ref=workflow)
Summary

Current status: Pending approval

Change description
Publish requested by test@test.test on March 3, 2025 at 11:40 AM
    Comment: test test

Stage 1
Approved by test@test.test on March 3, 2025 at 11:40 AM
    Comment: stage 1 comment
Stage 2
Pending approval by Group 2
Stage 3
Pending approval by Group 3

Approved by Group 2, email sent to Group 3:

Hello test@test.test,
Please review the following page for publish approval:

[Home](https://my.site.com/umbraco#/content/content/edit/1057?ref=workflow)
Summary

Current status: Pending approval

Change description
Publish requested by test@test.test on March 3, 2025 at 11:40 AM
    Comment: test test

Stage 1
Approved by test@test.test on March 3, 2025 at 11:40 AM
    Comment: stage 1 comment
Stage 2
Approved by test@test.test on March 3, 2025 at 11:40 AM
    Comment: foo comment
Stage 3
Pending approval by Group 3

Rejected by Group 3

Hello test@test.test,


The publish approval request for Home has been rejected.

Summary

Current status: Pending resubmission

Change description
Publish requested by test@test.test on March 3, 2025 at 11:40 AM
    Comment: test test

Stage 1
Approved by test@test.test on March 3, 2025 at 11:40 AM
    Comment: stage 1 comment
Stage 2
Approved by test@test.test on March 3, 2025 at 11:40 AM
    Comment: foo comment
Stage 3
Rejected by Group 3

Approval request for Group 3 after rejected task was resubmitted

Hello test@test.test,
Please review the following page for publish approval:

[Home](https://my.site.com/umbraco#/content/content/edit/1057?ref=workflow)
Summary

Current status: Pending approval

Change description
Publish requested by test@test.test on March 3, 2025 at 11:40 AM
    Comment: test test

Stage 1
Approved by test@test.test on March 3, 2025 at 11:40 AM
    Comment: stage 1 comment
Stage 2
Approved by test@test.test on March 3, 2025 at 11:40 AM
    Comment: foo comment
Stage 3
Pending approval by Group 3

@bythewiseman
Copy link
Author

I am going to write down the exact steps and messaging I used in order to make sure I have done something correct or not:

  1. Log in as a user with limited editing functionality.

  2. Head to "Crinan Trail"

  3. Change "Status" to "Closed".

  4. Hit "Request Publish"

  5. Enter "I am closing the trail" into "Describe changes".

  6. Hit "Request publish"

  7. Log in as a user with full editing functionality and access to Workflows.

  8. Go to "Crinan Trail"

  9. In Add a comment type "I do not wish this trail to be closed."

  10. Hit "Reject".

At this point I would expect an email from Workflows with the message "I do not wish this trail to be closed." within. But even after upgrading to the latest version of Workflows that came out on the 6th March, this emails that I receive only contain the first comment.

The following is the code in the Reject Email:

Image

The result we get is this:

Image

Below is the raw Json from the code @Newtonsoft.Json.JsonConvert.SerializeObject(Model):

rawJson.txt

which contains the message I entered at rejection ("comment": "I do not wish this trail to be closed.",), but is not displayed via Model.Summary as I would expect it.

Anything I am doing wrong?

@nathanwoulfe
Copy link

That's all a bit odd - everything you're doing looks correct. Wondering now if it's somehow related to rejecting at the first stage, compared to my example where I rejected at stage 3.

I'll take a look at a first-stage rejection and see what I can reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks
Projects
None yet
Development

No branches or pull requests

2 participants