valueConstraint and LimitedValues doesn't seem to work

I have a custom table where we stage HR-data before syncing to Person. 

There's also a custom angular module where you can create and edit new external identities. 

On column has a a defined list of values 0,1,2,3. 

I want to be able to limit what certain users see in the Webportal when they create a new external identities. 

But it doesn't seem to work, I can se that valueConstraint.LimitedValues are set correctly, but all values are still showing in the dropdown list. 

Am I missing something, or is this not supported for imx-cdr-editor?

According to the documentation: 

Custom valueConstraint - if it is set it will be used instead of column.GetMetadata().valueConstraint

  private createCdrList(columnNames: string[], entity: IEntity): (ColumnDependentReference | undefined)[] {  
    let cdrList: (ColumnDependentReference | undefined)[] = [];
    cdrList = this.cdrFactoryService.buildCdrFromColumnList(entity, columnNames, false);

    cdrList.map((field) => {
      // Set minimum length for EmployeeID
      if (field?.column.ColumnName === 'CCC_EmployeeID') {
        field.minLength = 12;
      }
      // Limit CCC_EmployeeType to allowed values
      if (field?.column.ColumnName === 'CCC_EmployeeType') {
        const allowed = this.allowedEmployeeTypes;
        const limitedValues = field.column.GetMetadata().GetLimitedValues();
        if (limitedValues) {
          field.valueConstraint = {
            ...field.valueConstraint,
            LimitedValues: limitedValues.filter(v => allowed.includes(String(v.Value)))
          };

        }
      }
    })
    return cdrList;
  }

Parents
  • Same issue here: had a quick try to limit the default 'Gender' limitedValues on the profile page.

    Maybe   can confirm or correct the code ;-)

    v9.3:
    imxweb\projects\qer\src\lib\profile\profile.component.ts

       this.cdrList = (this.columns ?? []).map((columnName) => {
            let column = this.selectedIdentity.GetColumn(columnName);
            if (column.ColumnName == 'Gender') {
              return {
                column,
                isReadOnly: () => !column.GetMetadata().CanEdit(),
                hint: this.hints[columnName],
                valueConstraint: {
                  LimitedValues: [
                    {
                      Value: 1,
                      Description: '1 - male',
                    },
                    {
                      Value: 2,
                      Description: '2 - female',
                    },
                  ],
                },
              };
            } else {
              return {
                column,
                isReadOnly: () => !column.GetMetadata().CanEdit(),
                hint: this.hints[columnName],
              };
            }
          });


Reply
  • Same issue here: had a quick try to limit the default 'Gender' limitedValues on the profile page.

    Maybe   can confirm or correct the code ;-)

    v9.3:
    imxweb\projects\qer\src\lib\profile\profile.component.ts

       this.cdrList = (this.columns ?? []).map((columnName) => {
            let column = this.selectedIdentity.GetColumn(columnName);
            if (column.ColumnName == 'Gender') {
              return {
                column,
                isReadOnly: () => !column.GetMetadata().CanEdit(),
                hint: this.hints[columnName],
                valueConstraint: {
                  LimitedValues: [
                    {
                      Value: 1,
                      Description: '1 - male',
                    },
                    {
                      Value: 2,
                      Description: '2 - female',
                    },
                  ],
                },
              };
            } else {
              return {
                column,
                isReadOnly: () => !column.GetMetadata().CanEdit(),
                hint: this.hints[columnName],
              };
            }
          });


Children
No Data