AnsweredAssumed Answered

Shutting off Notifications

Question asked by ma12 on Oct 29, 2015
Latest reply on Oct 30, 2015 by Dave_3.0

Hello ,


We run the below process to shut off the notifications for all users. The process is finishing successfully but in the UI under personal setting the notifications are still selected. Shouldn't they be unchecked after the query is run.


Appreciate all help.





<gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

    xmlns:core="jelly:core"

    xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"

    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"

    xmlns:sql="jelly:sql" xmlns:xog="http://www.niku.com/xog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <gel:setDataSource dbId="Niku"/>

    <!-- SQL UPDATE TO TURN OFF NOTIFICATIONS -->

    <core:catch var="sqlerr">

        <sql:update var="result"><![CDATA[

            INSERT INTO CLB_NOTIFICATION_PREFS (USER_ID, NOTIFICATION_TYPE, METHOD, CREATED_BY, CREATED_DATE, LAST_UPDATED_BY, LAST_UPDATED_DATE)

            select usr.id "USER_ID", NTF.NOTIFICATION_TYPE "NOTIFICATION_TYPE", MTH.METHOD "METHOD",

                   1 "CREATED_BY", sysdate "CREATED_DATE",

                   1 "LAST_UPDATED_BY", sysdate "LAST_UPDATED_DATE"

              from cmn_sec_users usr

                cross join ( select METHOD

                               from (select 2 B, 3 C from dual)

                            UNPIVOT (X for METHOD in (B AS 'EMAIL', C AS 'SMS'))

                              where METHOD in ('EMAIL', 'SMS')) MTH

                cross join ( select NOTIFICATION_TYPE

                               from (select 1 A, 2 B, 3 C, 4 D, 5 E, 6 F, 7 G, 8 H, 9 I, 10 J, 11 K, 12 L, 13 M, 14 N from dual)

                            UNPIVOT (X for NOTIFICATION_TYPE in (A AS 'NOTIFICATION_CHANGES',

                                                                 B AS 'NOTIFICATION_DISCUSSION_TYPE',

                                                                 C AS 'NOTIFICATION_DOCUMENT_TYPE',

                                                                 D AS 'NOTIFICATION_ESCALATION',

                                                                 E AS 'NOTIFICATION_FIN_MANAGEMENT',

                                                                 F AS 'NOTIFICATION_INCIDENTS',

                                                                 G AS 'NOTIFICATION_ISSUES',

                                                                 H AS 'NOTIFICATION_PROJ_PARTICIPANTS',

                                                                 I AS 'NOTIFICATION_REQUISITIONS',

                                                                 J AS 'NOTIFICATION_RISKS',

                                                                 K AS 'NOTIFICATION_TIMESHEETS_TYPE',

                                                                 L AS 'NOTIFICATION_TO_DO_TYPE',

                                                                 M AS 'NOTIFICATION_WORKFLOW',

                                                                 N AS 'SCHEDULER_TYPE'))) NTF

             --where usr.user_name = 'admin'

             order by usr.id, NTF.NOTIFICATION_TYPE, MTH.METHOD

            ]]>

        </sql:update>

    </core:catch>

  

    <!-- ERROR LOG IF DEBUG IS TURNED ON -->

    <core:if test="${v_DEBUG == 'Y'}">

        <core:choose>

            <core:when test="${sqlerr != null}">

                 <gel:log level="error">Error with the SQL statement, notifications not deleted. sqlerr = ${sqlerr}</gel:log>

            </core:when>

            <core:otherwise>

                 <gel:log level="info">SQL update successful.</gel:log>

            </core:otherwise>

        </core:choose>

    </core:if>

  

</gel:script>

Outcomes