MUX - Different version of error message on insert vs. update action for a custom trigger
search cancel

MUX - Different version of error message on insert vs. update action for a custom trigger

book

Article ID: 385635

calendar_today

Updated On:

Products

Clarity PPM On Premise

Issue/Introduction

You are using a custom DB Trigger error message to indicate when the sum of values on sub object records exceeds 100. 

On insert of a new record, this error message displays a "clean" version. 

On update of a record however, the trigger alert / error message has extra unnecessary text included. 

STEPS TO REPRODUCE: 

1. Login as Administrator to Clarity.
2. Create new sub object of project
Sub object of Project:
Name: My Services
ID: a_impacted_svc
3. Create new number attribute on that sub object object.
Attribute Name: Allocation
Attribute ID: a_allocation
Data Type: Number
Validation Range: 0,00% to 100,00%
Decimal Places: 2
Value Required: True
API Attribute ID: a_allocation

4. Navigate to MUX->Administration and update project blueprint to include sub object created above as a module.

5. Create trigger in the database as below:
create or replace TRIGGER Z_ODF_CA_A_IMPACTED_SVC_ALC_PCT
BEFORE INSERT OR UPDATE OF A_ALLOCATION
    ON ODF_CA_A_IMPACTED_SVC
    REFERENCING OLD AS OLD NEW AS NEW
    FOR EACH ROW

DECLARE
    vAlc DECIMAL (5,2);
    vNewAlc DECIMAL (5,2);
    V_NO_DATA NUMBER;

PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN

    /* Get Total Sum of Allocations */
    SELECT  ROUND(SUM(s.a_allocation)*100,2) INTO vAlc  
    FROM    odf_ca_a_impacted_svc s
    WHERE   s.odf_parent_id = :NEW.odf_parent_id
            AND s.id NOT IN (:NEW.id);

    /* Add current allocation to the sum obtained */
    SELECT  ROUND((:NEW.a_allocation)*100,2) INTO vNewAlc
    FROM    DUAL;

    vAlc := vAlc + vNewAlc;

    /* Comparison */
    IF (vAlc > 100) THEN
        RAISE_APPLICATION_ERROR(-20011, 'Allocation should not exceed 100%');
    END IF;

    EXCEPTION WHEN NO_DATA_FOUND THEN V_NO_DATA:=0;
END;

6. Update messages_en.properties file in this directory C:\1623\clarity\resource
Add file below at the bottom of the file and Save
odf-pmd.20011=ODF-20011: Allocation should not exceed 100%.

7. Navigate to any project in MUX which is configured to the Blueprint modified earlier and attempt to create instances of the sub object.

8. Observe message you see when attempting to create an instance versus updating an existing instance.

Expected Results: It should produce same error message

Actual Results: it is producing different message.

Environment

16.2.3

Resolution

DE154875, Fixed in 16.3.1