Dependence of a selection list on an attribute

We have an "Invoice" class, which contains documents that belong to either the "Template" or the "Receipt" category (simple selection from the list of categories).

A document in the "Invoice" class is always assigned to a project (simple selection from the list of projects). A project can be a main project or a follow-up project (Boolean attribute).

Now there is the challenge that documents in the "Template" category can only be assigned to main projects. A document in the category "Receipt", on the other hand, can be assigned to a project regardless of whether it is a main or follow-up project. So I would need a filter for project selection that depends on the category.

Unfortunately, I can't think of a solution for how to implement this. Does anyone have an idea how I can relay this?

Parents
  • One potential solution that comes to mind (I didn't test this):

    Set up two project properties on the Invoice class, one which lists all projects (let's call it Project) and another which only lists the main projects (let's call it Main project). The Main project property is filtered by the Boolean attribute on the Project object to only display main projects.

    Then with metadata card configuration set up two rules:

    • If Category = Template, show Main project property and hide Project property
    • If Category = Receipt, show Project property and hide Main project property

    Now depending on the category selection the users see the relevant property which should fulfill your requirement. (A third rule could be used to hide both project properties by default so that only after the category selection one of them is displayed, to avoid confusion from initially having both of them on the metadata card.)

    You'll need to consider if this approach causes any issues with your other configuration since the project information is recorded in different properties across the invoices. Technically it would be also possible to automatically copy the value from the Main project property to Project property so that regardless of the category the Project property has the project selection.

Reply
  • One potential solution that comes to mind (I didn't test this):

    Set up two project properties on the Invoice class, one which lists all projects (let's call it Project) and another which only lists the main projects (let's call it Main project). The Main project property is filtered by the Boolean attribute on the Project object to only display main projects.

    Then with metadata card configuration set up two rules:

    • If Category = Template, show Main project property and hide Project property
    • If Category = Receipt, show Project property and hide Main project property

    Now depending on the category selection the users see the relevant property which should fulfill your requirement. (A third rule could be used to hide both project properties by default so that only after the category selection one of them is displayed, to avoid confusion from initially having both of them on the metadata card.)

    You'll need to consider if this approach causes any issues with your other configuration since the project information is recorded in different properties across the invoices. Technically it would be also possible to automatically copy the value from the Main project property to Project property so that regardless of the category the Project property has the project selection.

Children
  • Hi Joonas,

    thanks, the proposed solution is clear to me. You wrote 

    Technically it would be also possible to automatically copy the value from the Main project property to Project property so that regardless of the category the Project property has the project selection.

    But how can I automatically set the value of the selection in the main project into the property of the project attribute when the document is saved? I tried it with Meta Card Configuration, but it doesn't work. I make a rule if value of Main Project selection is changed the value should be set for project selection.  But it doesn't work, the project isn't shown in the list of properties.

    I need the value for the assigned project always in the project attribute of the document because we sync the document with an other system. And there the document has only a value for the project.

  • You should be able to use for instance Compliance Kit's Managed Properties or Property Calculator to copy the value between the properties when the changes are checked in. As far as I can tell it's not necessary to do this dynamically on the metadata card before saving.

  • It could be easier to enrich the project record with the same category, and then filter the value list of the project property accordingly. The category value of a project can be automated by using the Metadata Card configuration based on the type of project.

  • Sometimes you don't think of the obvious, thanks for pointing that out. That's how it works now.