Angular Web form get ViException from Formatting Script

Hello,

i have a Custom Table with an Formatting Script on one Column for checking input and data, this script throw ViException like:

Throw New ViException(#LD("This Groupname is not allowed")# & " " & Value.ToString(), ExceptionRelevance.EndUser)

how can i get this error message in the UI, i use a  imx-cdr-editor and interactive requests?

does anyone has a simple example?

at the moment if an formatting exception raise i get the http 500 response from the API with content:

[
    {
        "Message": "This Groupname is not allowed",
        "Number": 0
    }
]

but is not displayed in the UI and input field is cleared.

Regards Bertram

Parents
  • Hi ,

    In v92 I have some fields with template/format scripts and the exceptions are being shown correctly under the corresponding field.
    Ex: Formatting script for custom field CCC_Apellido1 (spanish first family name) in table Person:

    Dim propuesto As String  = StrConv(value.ToString, VbStrConv.ProperCase)
    
    If propuesto="Camargo" Then
    		Throw New ViException(#LD("No puedes usar ese apellido")#, ExceptionRelevance.EndUser)
    Else
    	Value = propuesto
    End If

    qbm/src/lib/cdr/edit-default/edit-default-component.html

    <mat-form-field appearance="outline" *ngIf="columnContainer?.canEdit; else isReadonly">
        <mat-label>
            {{ columnContainer?.display | translate }}
        </mat-label>
        <input matInput type="text" [formControl]="control" [readonly]="!columnContainer?.canEdit"
            [attr.data-imx-identifier]="'cdr-edit-default-input-' + columnContainer?.name" [maxlength]="maxlength"
            [required]="columnContainer.isValueRequired">
            <div matSuffix class="imx-suffix-container">
                <mat-spinner diameter="30" *ngIf="isBusy"></mat-spinner>
            </div>
            <mat-error *ngIf="control.errors?.['required']">
                {{ '#LDS#This field is mandatory.' | translate }}
            </mat-error>
            <mat-error *ngIf="control.errors?.['generalError']">
                ¡Gensanta qué errorazo! :  {{validationErrorMessage}} 
            </mat-error>
    </mat-form-field>

    Result:

  • Hi, 

    Thanks for response, in my case it doesn´t work. 

    i also tested with v92 Branch from GitHub in component identity-sidesheet.component -> /myresponsibilities/identities 

    and use for this test the "DefaultEmailAddress" field.

  • Hmm.. I've added a formatting script to the DefaultEmailAddress field and it works, message appears just as I've shown on my screenshot.

    Can we see your value calculation tab and script for that column? And can you use a testing message, without params or similar?

  • i am confused ...

    i set this formatting Script (only this for testing)

    Throw New ViException(#LD("test message initials")#, ExceptionRelevance.EndUser)

    if i change value in the form, first http PUT request to /portal/person/reports/interactive get an http 500 with response body
    [{"Message":"test message initials","Number":0}]

    and then a second PUT is send with no Data in insight Data: []  and the response is the Entity with the empty "Value": ""

    after that no error is displayed and input field is blank.

  • Hi , Bertram,

    I've reproduced your case again:

    * Set the formatting script for field DefaultEmailAddress in Person  to "Throw New ViException(#LD("test message initials")#, ExceptionRelevance.EndUser)"

    * Compiled the db.

    * Open the web interface, created a new user and edit the default email address field. 

    * I get the error "test message initials" , the field retains its value and the form is unclean, so I cannot save any changes. That's the normal, correct behaviour.

    You said you're using code from the v92 branch for that component. If you're not mixing versions, I would suggest you filed an issue at the github project page (https://github.com/OneIdentity/IdentityManager.Imx/issues)

Reply
  • Hi , Bertram,

    I've reproduced your case again:

    * Set the formatting script for field DefaultEmailAddress in Person  to "Throw New ViException(#LD("test message initials")#, ExceptionRelevance.EndUser)"

    * Compiled the db.

    * Open the web interface, created a new user and edit the default email address field. 

    * I get the error "test message initials" , the field retains its value and the form is unclean, so I cannot save any changes. That's the normal, correct behaviour.

    You said you're using code from the v92 branch for that component. If you're not mixing versions, I would suggest you filed an issue at the github project page (https://github.com/OneIdentity/IdentityManager.Imx/issues)

Children
No Data