The API disabledAllWarnings not work

Anyone can help me a question? I use API disableAllWarning but it not work. When I insert row in affected item, it always have exception.The excepion show my change has pending change.I just hope it will not be interrupt by pending change.Thanks.My main code like as following.

<br />session.disableAllWarning();<br />obj.createRow(xxx);<br />session.enabledAllWarning();<br />

No Files Were Attached
chlin2828 Agile User Asked on March 8, 2018 in Other APIs.
Add Comment
1 Answer(s)
Best answer

Hi,

Are you trying to catch warning when your Item has pending change ? Here is the general pattern i followed …

Not sure how exactly you used it but it worked mostly. Below is normal sample i used to catch exceptions. You can give it a shot. 

——————————————————————————————————————————————————-
        try {
            m_session.disableAllWarnings();
            //Your code for your business logic
            m_session.enableAllWarnings();
            

        } catch (APIException e) {
            try {
                objLogger
                        .info(“~~~~~~ Handling Exception ~~~~~~”);
                objLogger.error(e.getMessage());
                objLogger.error(e.getErrorCode());
                if (e.getErrorCode() == ExceptionConstants.APDM_ITEMHAS_PENDINGCHANGES_WARNING
                        || e.getErrorCode() == ExceptionConstants.APDM_ITEMHASPENDINGCHANGES_WARNING) {
                    m_session
                            .disableWarning(ExceptionConstants.APDM_ITEMHAS_PENDINGCHANGES_WARNING);
                    m_session
                            .disableWarning(ExceptionConstants.APDM_ITEMHASPENDINGCHANGES_WARNING);
                    //Re-Try your code for business logic.
                    m_session
                            .enableWarning(ExceptionConstants.APDM_ITEMHAS_PENDINGCHANGES_WARNING);
                    m_session
                            .enableWarning(ExceptionConstants.APDM_ITEMHASPENDINGCHANGES_WARNING);

                }
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
                objLogger.error(e.getMessage());
            }

        }

——————————————————————————————————————————————————-

Regards,
Arif

Arif Agile Angel Answered on March 9, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.