Skip to content

AB#128968-use-user-context-fields#2850

Open
GhaziAlibi wants to merge 1 commit intonextfrom
AB#128968-use-user-context-fields
Open

AB#128968-use-user-context-fields#2850
GhaziAlibi wants to merge 1 commit intonextfrom
AB#128968-use-user-context-fields

Conversation

@GhaziAlibi
Copy link
Copy Markdown

Description

Adds support for user contextual fields in calculated fields.

This updates the calculated field parser and aggregation pipeline to accept expressions such as {{user.country}} and resolve them from the logged-in user's attributes. Missing user attribute values now resolve to empty strings. The resource mutation logic was also updated so these direct user expressions can be saved safely as calculated fields.

Useful links

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (refactor or addition to existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Added a unit test for user contextual calculated fields
  • Tested {{user.country}} manually
  • Tested that empty user values return an empty string
  • Tested autocomplete in the UI

Screenshots

  • auto complete:
image
  • aggregetion view
image

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-backend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

More explanation

https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UI-side autocompletion support for user contextual placeholders (e.g. {{user.country}}) when editing calculated fields, backed by environment-configured user attributes.

Changes:

  • Added {{user.*}} placeholder prefix support and a getUserKeys() helper for generating user attribute autocomplete keys.
  • Updated the calculated field editor modal to include user attribute keys in the TinyMCE autocomplete key list (read from injected environment).
  • Added a user.attributes list to the back-office default environment config.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
libs/shared/src/lib/components/edit-calculated-field-modal/utils/keys.ts Introduces USER_PREFIX and getUserKeys() to generate {{user.<attr>}} autocomplete entries.
libs/shared/src/lib/components/edit-calculated-field-modal/edit-calculated-field-modal.component.ts Injects environment and appends user keys to the editor autocomplete dataset.
apps/back-office/src/environments/environment.ts Adds user.attributes configuration used to drive the autocomplete list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GhaziAlibi GhaziAlibi changed the title feat: add user contextual field autocomplete to calculated fields AB#128968-use-user-context-fields Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants