Form trigger failure in WHEN-VALIDATE-RECORD still saves data

Hi, I have a WHEN-VALIDATE-RECORD trigger on one of my data blocks. When there is an problem with the data, I use RAISE FORM_TRIGGER_FAILURE. The error dialog appears, but it's still saving the data to the database!
Here is the code for the WHEN-VALIDATE-RECORD trigger:
-- WHEN-VALIDATE-RECORD Trigger for WTL_USERS Block in form MANAGE_ACCOUNTS
DECLARE
     v_user_name VARCHAR2(10);
     v_alert_button NUMBER;
BEGIN
          -- Check if this is the ADMIN account
          -- If it's a new account an error will occur - this is OK, nothing happens
          SELECT user_name
          INTO v_user_name
          FROM wtl_users
          WHERE user_id = :WTL_USERS.USER_ID;
     -- If this is the ADMIN account, you cannot disable it
     IF v_user_name = 'ADMIN' THEN
          -- Ensure that the ADMIN account has not been disabled
          IF :WTL_USERS.USER_ACTIVE = 'N' THEN
               v_alert_button := SHOW_ALERT('ADMIN_ACTIVE_ALERT');
               RAISE FORM_TRIGGER_FAILURE;
          ELSIF :WTL_USERS.USER_NAME != 'ADMIN' THEN
               v_alert_button := SHOW_ALERT('ADMIN_NAME_ALERT');
               RAISE FORM_TRIGGER_FAILURE;
          ELSIF :WTL_USERS.USER_ROLE != 'A' THEN
               v_alert_button := SHOW_ALERT('ADMIN_ROLE_ALERT');
               RAISE FORM_TRIGGER_FAILURE;
          END IF;
     END IF;
EXCEPTION
     WHEN OTHERS THEN
          NULL;               
END;
What am I doing wrong?
Thanks
Adam

Hello,
Exception
  When form_trigger_failure Then
      Raise
  When others Then
The when others exception trap all the exceptions including form_trigger_failure.
Francois

Similar Messages

  • WHEN VALIDATE RECORD

    DECLARE
         PO_TSF_INDICATOR VARCHAR2(1);
         LOC_TYPE VARCHAR2(10);
         TSF_FROM_LOCATION VARCHAR2(50);
         PO_SUPP NUMBER(10);
         QTY NUMBER(12,4);
    BEGIN
    IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
         PO_TSF_INDICATOR := TRIM(:B_REQUEST.LI_PO_TSF_IND);
         LOC_TYPE := TRIM(:B_REQUEST.LI_REQUEST_LOC_TYPE);
         TSF_FROM_LOCATION := TRIM(:B_REQUEST.TI_TSF_FROM_LOC);
         PO_SUPP := TRIM(:B_REQUEST.TI_PO_SUPPLIER);
         QTY := TRIM(:B_REQUEST.TI_FULFILLED_QTY);
    IF PO_TSF_INDICATOR = 'P' THEN
         EMESSAGE('PO_TSF_INDICATOR IS "P" ');
    UPDATE AFE_STORE_ORDERS
              SET PO_TSF_IND = PO_TSF_INDICATOR,
              PO_SUPPLIER = PO_SUPP,
              FULFILLED_QTY = QTY,
              TSF_LOC_TYPE=' ',
              TSF_FROM_LOC=' '
              WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
         EMESSAGE('PO-TSF-INDICATOR :' || PO_TSF_INDICATOR);
         EMESSAGE('PO-SUPPLIER:' || PO_SUPP);     
         EMESSAGE('QTY :' || QTY);
         COMMIT;     
    ELSIF PO_TSF_INDICATOR = 'T' THEN
         EMESSAGE('PO_TSF_INDICATOR IS "T" ');
         UPDATE AFE_STORE_ORDERS
         SET PO_TSF_IND = PO_TSF_INDICATOR,
         TSF_LOC_TYPE = LOC_TYPE,
         TSF_FROM_LOC = TSF_FROM_LOCATION,
         FULFILLED_QTY = QTY,
         PO_SUPPLIER = ' '
         WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
         EMESSAGE('PO-TSF-INDICATOR :' || PO_TSF_INDICATOR);
         EMESSAGE('LOC-TYPE :' || LOC_TYPE);
         EMESSAGE('TSF-FROM-LOC :' || TSF_FROM_LOCATION);
         EMESSAGE('QTY :' || QTY);
    END IF;
    END IF;
    END;
    This is trigger written in when validate record. Now the problem is, update statement isnt working ....Is it like in when validate record (block level), update command dont work ? And is when validate record trigger (when written at the block level) will fire for each record (if its multi record block) ? Please clarify ..
    Regards
    Message was edited by:
    Seshu

    Hi,
    As suggested by you, I have written the code in on-update trigger (block level)
    EMESSAGE('ON UPDATE TRIGGER');
    :GLOBAL.QTY := TRIM(:TI_FULFILLED_QTY);
    IF :GLOBAL.IND = 'P' THEN
         EMESSAGE('INSIDE "P" LOOP"');
         UPDATE AFE_STORE_ORDERS
         SET PO_TSF_IND = :GLOBAL.IND,
                   PO_SUPPLIER = :GLOBAL.PO_SUPPLIER,
                   FULFILLED_QTY = :GLOBAL.QTY,
                   TSF_FROM_LOC = ' ',
                   TSF_LOC_TYPE = ' '
         WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
         COMMIT;
         EMESSAGE('RECORD UPDATED');
    ELSIF :GLOBAL.IND = 'T' THEN
         EMESSAGE('INSIDE "T" LOOP"');
    EMESSAGE(:GLOBAL.IND);
    EMESSAGE(:GLOBAL.QTY);
    EMESSAGE(:GLOBAL.FROM_LOC);
    EMESSAGE(:GLOBAL.LOC_TYPE);                    
    BEGIN     
         UPDATE AFE_STORE_ORDERS
         SET PO_TSF_IND = :GLOBAL.IND,
                   PO_SUPPLIER = null,
                   FULFILLED_QTY = TO_NUMBER(:GLOBAL.QTY),
                   TSF_FROM_LOC = TO_NUMBER(:GLOBAL.FROM_LOC) ,
                   TSF_LOC_TYPE = :GLOBAL.LOC_TYPE
         WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
         commit;
         EMESSAGE('RECORD UPDATED');
    EXCEPTION
         WHEN OTHERS THEN
         EMESSAGE(SQLERRM);
    END;     
    END IF;
         ERASE ('GLOBAL.IND');
         ERASE ('GLOBAL.QTY');
         ERASE ('GLOBAL.FROM_LOC');
         ERASE ('GLOBAL.LOC_TYPE');
         ERASE ('GLOBAL.PO_SUPPLIER');
    Tell me how am i to know whether its getting fired or not ? because, i cant see message being populated
    Regards

  • Form personlization using WHEN-VALIDATE-RECORD to call PLSQL Package

    Hi
    I am writing a Form Personalization on master Item Form for New Records Only.
    Once Item Is defined and saved, it should Invoke the Custom Procedure to insert the same record in Custom Table.
    ===========
    Trigger Event - WHEN-VALIDATE-RECORD
    Trigger Block:MTL_SYSTEM_ITEMS
    Condition: :MTL_SYSTEM_ITEMS.INVENTORY_ITEM_ID<>-1 AND 0=(SELECT COUNT(inventory_item_id ) FROM Custom table
    WHERE inventory_item_id = :MTL_SYSTEM_ITEMS.inventory_item_id
    AND Organization_id=:MTL_SYSTEM_ITEMS.organization_id )
    ACTION
    Built In type = Execute Procedure
    Argument = ='DECLARE
    v_field_value VARCHAR2(200);
    BEGIN
    UPDATE_CUSTOM('''||${item.MTL_SYSTEM_ITEMS.ORGANIZATION_ID.Value}||''','''||${item.MTL_SYSTEM_ITEMS.INVENTORY_ITEM_ID.Value}||''');
    END'
    ============
    Here its not firing as required for evey required.
    Please advice.
    Thanks in advance.

    Hi Srini,
    Yes, it does work...but in a Form Session if i Create more then one Item, in some cases it fires for the first records and not sleeps for the second.
    Sometimes it doesn't give any response.
    Appreciated if you divert to the link to check the Pacthes for 11.5.10 on Form Personalization.
    Please share any ideas/example if yiou have to achieve the below requirement.
    Requirement:
    Once New record is created , a Custom Procedure should be invoked.
    with out closing Form i am able to create n number of Items, so for every Item it should invoke Custom PLSQL Code on Save.
    Let me know if i can achieve the same in Custom.pll .....as i can use either of Options.(Form Personalization/Custom.pll)
    Thanks & regards,
    Edited by: user632004 on Mar 16, 2010 7:50 PM
    Edited by: user632004 on Mar 16, 2010 8:09 PM

  • Frm-40735: when validate record trigger raised unhandled exception ORA-0406

    while on production when i open any form and inserting some valeus after that when i want ot save the information it is showing me following error
    frm-40735: when validate record trigger raised unhandled exception ORA-04062

    ORA-04062: %s of string has been changed Cause: Attempt to execute a stored procedure to serve an RPC stub which specifies a timestamp or signature that is different from the current timestamp/signature of the procedure.
    Action: Recompile the caller in order to pick up the new timestamp >
    Check the When-Validate-Record trigger in your form and look for any calls to a database stored procedure. Then check the status of the database procedure to ensure it is "Valid." If the procedure is not valid - find out why and fix it.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Equivalent command in OAF for when when validate record in forms

    Hi,
    what is the equivalent command in OAF to when when validate record in forms
    kumar

    Hi Kumar,
    validateRow() of your XXVORowImpl is equivalent of When-Validate-Record of forms.
    This method calls validateEntity() of your XXEOImpl
    This method is generally invoked on form submits (POST Requests)
    Regards,
    Ravi

  • Form_trigger_failure in when-validate-record fired message three times

    Hello all,
    I have a problem with one of my forms. Indeed, I have used when-validate-record trigger to validate fields block.
    So, when user fills a duplicate I display an error message with two choices. Accept or proceed to change. The action button 1 is impeccable.
    But when the user clicks the button 2 of the message, I raise form_trigger_failure exception. What is strange is that my error message appears three times if I get out of the record by the mouse but once I get out of line by the tab.
    Is there someone who can help me on that?
    Please, find below the code that produce this result :
    IF :CTRL2.MATCH_REC > 1 then
         L_ALERT := SHOW_ALERT('ALERTE_1');
         IF L_ALERT = ALERT_BUTTON1 Then
    NULL;
         elsif L_ALERT = ALERT_BUTTON2 Then
         raise Form_trigger_failure;
         end IF;
    end IF;
    Thank you in advance

    Dear CraigB,
    Thank you for your answer but I still working without success.
    I found that the trigger W-V-R is fired thee times so the value of :CTRL2.MATCH_REC is recalculated every time (as shown by Kevin D Clarke about validating duplicate http://forums.oracle.com/forums/profile.jspa?userID=8905) witch is correct.
    If I affect 0 or null to :CTRL2.MATCH_REC, it's not raising finally the form_trigger_failure (F_T_F), so it's working has button 1.
    Note that I found after catching others exception (exception when others then...) a 100501 non-oracle exception.
    I don't know if my repetition is caused by this exception?
    Note again that, when I put other statement instead of raising F_T_F, it's working fine. His just only when I raise F_T_F that I have this behaviour.
    Do you have any idea ?
    Thanks in advance
    Edited by: pkn87897 on Oct 23, 2008 7:09 AM

  • Restricting User from creating new records using when-validate-record

    Hi,
    I have a requirement for which I have to restrict he user from creating a record in the Supplier Master form if the suppliier type is 'Affiliate Supplier'.
    I have done the following setups
    Seq 10
    Description Restricting user from creating Affiliate records
    Level Function
    Enabled Yes
    Condition:
    Trigger Event WHEN-VALIDATE-RECORD
    Trigger object VNDR
    Condition "${item.VNDR.VENDOR_TYPE_DISP_MIR.value} is NOT NULL
    and
    ${item.VNDR.VENDOR_TYPE_DISP_MIR.value} LIKE 'Affiliate%'
    Processing Mode BOTH
    Context
    Level User
    Value User Name
    Action Sequence 1
    Type Message
    Action Description Saving Affiliate record
    Language ALL
    Message Type Show
    Message Text You Cannot Create Affiliate records Here
    Action Sequence 2
    Type Builtin
    Action Description Stop Proceesing
    Language ALL
    Action Enabled Yes
    Builtin Type RAISE FORM_TRIGGER_FAILURE;
    This is working good on one instance but when I moved it to another instance
    when I query the form and try to navigate to the bank accounts tab of the form which is based on a differnt block i.e VNDR_USES block, the when-validate-record trigger fires there also and stops the processing.
    Any suggestions on this would be higly appriciated.
    Thanks in Advance.

    Hi Srini,
    Yes, it does work...but in a Form Session if i Create more then one Item, in some cases it fires for the first records and not sleeps for the second.
    Sometimes it doesn't give any response.
    Appreciated if you divert to the link to check the Pacthes for 11.5.10 on Form Personalization.
    Please share any ideas/example if yiou have to achieve the below requirement.
    Requirement:
    Once New record is created , a Custom Procedure should be invoked.
    with out closing Form i am able to create n number of Items, so for every Item it should invoke Custom PLSQL Code on Save.
    Let me know if i can achieve the same in Custom.pll .....as i can use either of Options.(Form Personalization/Custom.pll)
    Thanks & regards,
    Edited by: user632004 on Mar 16, 2010 7:50 PM
    Edited by: user632004 on Mar 16, 2010 8:09 PM

  • Pre_insert  and form trigger failure

    hi gurus,
    i'm adding security to a pre-insert trigger. if a user tries to insert something they shouldn't - the trigger fails. this is working.
    however, i want to somehow flush this record from the form. i cannot use clear_record, as its restricted for PRE triggers.
    how can i remove the "invalid" record?
    any ideas for me?
    thank you.

    Why can't you check the record in a when-validate-record trigger? Pre-insert only runs when user tries to commit (or post) the records.
    Although you cannot remove the record in the WVR trigger either, you could give the user a warning to either correct the error or delete the record.
    And if it is a record being inserted, just delete it, rather than trying to do a clear_record.

  • Problem while handling When-Validate-Record Trigger in Forms 6i

    I am using below mention code in when validate trigger and use go block loop in when button pressed. if Check_Date_Range gives RAISE Form_Trigger_Failure error user will enter in a loop. kindly provide me solution for below mention problem.
    BEGIN
    Check_Date_Range(:Experiment.Start_Date,:Experiment.End_Date);
    END;
    ** The procedure looks like this
    PROCEDURE Check_Date_Range( d1 DATE, d2 DATE ) IS
    BEGIN
    IF d1 > d2 THEN
    Message('Your date range ends before it starts!');
    RAISE Form_Trigger_Failure;
    END IF;
    END;

    You have more chance to find a response if you post into Forms<br>
    <br>
    Nicolas.

  • When-validate-record trigger only if  a non database item is changed

    Hi,
    I am trying a code in the when-vaidate-record trigger in the BLOCK level.
    The trigger should fire only if a checkbox item value is ticked(Value ='Y) for the present record(i.e, if already existing other records have a value ticked (='Y), it doesnt matter and trigger shouldnt fire)
    Please help me achieve this :
    The code I have tried in when-vaidate-trigger, which does not work as what I want :
    DECLARE
    X NUMBER;
    BEGIN
    if
      nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
      and :SYSTEM.RECORD_STATUS ='CHANGED'
         then
        set_alert_property(
             'err_alert',
             alert_message_text,
             'You must enter a comment when defaulting localities.');
              x := show_alert('err_alert');
              RAISE FORM_TRIGGER_FAILURE;
              end if;
    END;The above code does not fire at all..
    If I remove the part,
    and :SYSTEM.RECORD_STATUS ='CHANGED'
    it fires for "all records"(not just the currently changed records) where nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
    Please help !!
    Note: :DEFLOC.to_be_defaulted is a non database item ; :DEFLOC.COMMENTS is a database item

    Hi kriti,
    There is one more way,
    In the when-checkbox-changed trigger,
    if :your_chk_box = 'Y' then
    set_Record_property(:system.cursor_Record, 'your_blk',status,changed_Status);
    else
    set_Record_property(:system.cursor_Record, 'your_blk',status,Query_Status);
    end if;
    Then it is easy for you to find out the changed records using get_Record_property((:system.cursor_Record, 'your_blk',status)
    Hey let me ask you one Question, is that check_box item is database item ???
    If so,
    it is easier..the fol. code will work for that
    if   nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
      and nvl(get_item_property('DEFLOC.to_be_defaulted',database_value),'N') = 'N'      then
                      set_alert_property(
             'err_alert',
             alert_message_text,
             'You must enter a comment when defaulting localities.');
              x := show_alert('err_alert');
              RAISE FORM_TRIGGER_FAILURE;
              end if;otherwise
    If your are creating that temp. item, it should be in the same block as non-db item.
    I will explain this... You are setting the status of to_be_defaulted check box of some queried record to Y based on some conditions, right?
    These records anyways are not updateable. Now your requirement is to find out the newly checked check boxes.
    So in the post query or the place where you set to_be_defaulted as 'Y, we will default the new item with value Y, so that in the when validate trigger, you
    know which record needs to attacked, It is those records with nvl( new item ,'N') = 'N' and to_be_defaulted = 'Y'...
    Regards
    Dora...

  • Trigger a process when a record is inserted into database

    Hi, could someone tell me how to do the following (if it's possible):
    when a record is inserted into a table in a database,
    I want it to somehow trigger an action which will put an item into user's To-Do inBox of the WorkSpace,
    the user can then open the form in the To-Do and use it to view the data in the newly inserted record.
    this "user"'s login ID is part of the inserted record.
    thanks

    Mmm, trigger?  I don't know of a way.
    But I supposed you could have a process that has a timer that peroidically queries the database for changes and then do the same thing.
    You could also perhaps write a Service and then use the Java API to start a process?
    Maybe take a look here
    http://blogs.adobe.com/livecycle/2010/12/how-to-invoke-a-livecycle-process-periodically.ht ml

  • Raise form trigger failure does not terminate processing

    There is a field in my form, on which there is a when-validate-item trigger, which cheks that the value in the field should be selected from list of values(LOV). If not done that way, error message is displayed.
    This works fine, when I enter a value myself and navigate to the next field, it throws an error. This is fine.
    But, problem occurs when I enter a value in the field and without navigating to the next field, I press Save(commit).
    When this is done - Key commit is invoked, which inturn invokes when-validate-item and erros is displayed. But when
    I press the Ok button, the error is displayed again and again. I have to close down the form to get out of it.
    In case of error, I have displayed the error and raised form_trigger_failure.
    I do not understand why form_trigger_failure terminates processing when I navigate to next field and does not terminate processing when I directly press Save(Commit)?
    Regards,
    Balaji

    find the code in When validate item trigger below. I don't much of code in key commit. It does not do anything with the field in question.
    DECLARE
    l_lov_indicator VARCHAR2(20);
    BEGIN
         IF :abc.code IS NOT NULL THEN
              -- If global is not initialized, that means that the value in
              -- code is not fetched from List Of Values and an error
              -- (FRM-40815) is raised. This error is handled in on-error
              -- trigger in Aon block.
              l_lov_indicator := :GLOBAL.lov_indicator;
              -- If global is initialized, the value in code
              -- is fetched from List Of Values and everything is ok.
              -- Otherwise, an error message is displayed.
              IF l_lov_indicator = 'TRUE' THEN
                   ERASE('GLOBAL.lov_indicator');
              ELSE
                   ERASE('GLOBAL.lov_indicator');
              raise form_trigger_failure;
              END IF;
         END IF;
    END;

  • How to trigger so action when ServerletOuput stream writes all data as byte

    Hi ,
    I have a servlet which accepts the index , size of a .3gp file in bytes as input parameters.
    If index=0 ...i am reading whole file into buffered input streame and writing to client as Servlet output steam as bytes.
    If index !=0 , or index=100 ...say suppose
    im ommiting first 100 bytes and rading101 byte to till the end of file in to buffered input streame and writing to client as Servlet output steam as bytes.
    Here i would like to trigger some action when the servlet writes entire bytes to the client .
    But im not able to notify exactly when the connection can close between client and server.
    Can any one help me to overcome this.
    Thanks in advance.

    Hi ,
    Thanks for reply..
    But reallu i couldnt get you.
    please go though the code snippet i have...and suggest me.
    try{
    File fFile = new File (fileName);
    BufferedInputStream bif = new BufferedInputStream(new FileInputStream(fFile));
         bif.skip(Integer.parseInt(((DownloadFileForm)o).getIndex()));
    int byteSize = (bif.available() < Integer.parseInt(((DownloadFileForm)o).getSize())) ? bif.available() : Integer.parseInt(((DownloadFileForm)o).getSize());
    byte[] b = new byte[byteSize];
    bif.read(b, 0, byteSize);
    sosStream = response.getOutputStream();
    sosStream.write(b);
    // here i have to do something
    sosStream.close();
    logger.info("file has been downloaded from Server is sending out to client");
    }catch(Exception e)
    // e.printStackTrace();
    logger.info("Exception :"+e.toString());
    regards,

  • List of values failure error when trying to use dynamic data values

    Hi there,
    I have a user who is experiencing problems when trying to use dynamic values in a report.  Whenever he tries to insert dynamic parameters he gets the following error message:
    Prompting failed with the following message: 'List of Values failure: Failed to get values.  [Cause of error: Access is denied.]  Error Source: prompt.dll  Error Code: 0x8004380D
    He even opened the sample report - prompting.rpt - that is included with CR and gets the same error.
    We are using Crystal Reports XI Release 2 ver. 11.5.11.1470.
    Any help would be appreciated.

    Please excuse my ignorance of the product.  I've had this problem dropped in my lap and I know practically nothing about Crystal Reports.  In doing some digging it appears to me as if the BusinessObjects Enterprise software may not be installed properly, if at all.  In the programs menu under the BusinessObjects XI Release 2 folder I see a BusinessObjects Enterprise folder, but the only icon listed in that folder is Software Inventory Tool.
    Is the BusinessObjects Enterprise software a separate install from Crystal Reports or is it bundled together?  I talked with the tech that did the install and he said that all he had was the Crystal Reports install media.

  • How to get max sequence number when some record exists in data base table

    Hi,
    I need to create sequence such a way that it should starts from max value already exists in table.
    Example:
    I have table like below:
    ID NAME
    1 A
    2 B
    3 C
    4 D
    Now when creating sequence it should start from 5 but I should't hard code STARTS WITH 5 in the create sequence. Is there any way to do this without hard code the max value in the sequence. It should automatically take the max + 1 value for next data when I insert.
    CREATE SEQUENCE TEST_SEQ.NEXTVAL
    START WITH [Max + 1 val from the table]
    MAXVALUE 9999999999999999999999999999
    MINVALUE 1
    NOCYCLE
    CACHE 20
    NOORDER;
    Thanks.....
    Edited by: 998976 on Apr 18, 2013 4:37 AM
    Edited by: 998976 on Apr 18, 2013 4:38 AM

    Hi,
    The numbers in a CREATE SEQUENCE statement are all literals; no other kinds of numeric expressions are allowed.
    You need dynamic SQL to do anything like what you want. For example:
    COLUMN     seq_start_col     NEW_VALUE  seq_start
    SELECT     1 + MAX (val)     AS seq_start_col
    FROM     table_x;
    CCREATE SEQUENCE TEST_SEQ.NEXTVAL
    START WITH  &seq_start
    MAXVALUE 9999999999999999999999999999
    MINVALUE 1
    NOCYCLE
    CACHE 20
    NOORDER;

Maybe you are looking for