3 Replies Latest reply: Sep 23, 2012 7:29 AM by Saro RSS

    Vacation Rule API

    Saro
      Hi friends,

      Is there any API for calculating Vacation Rule in R12. So that if any approver is absent, his Workflow notifications will be forwarded to the other approver.

      Thanks

      Regards,
      Saro
        • 1. Re: Vacation Rule API
          Alejandro Sosa
          Nope. You will need to directly check the tables wf_routing_rules and wf_routing_rule_arguments for the user who would be the recipient role of a given notification.

          Regards,

          Alejandro
          • 2. Re: Vacation Rule API
            Saro
            Hi Alej,

            Thanks for your reply.

            Im using this procedure Submit_Create which is in the package wf_route. But in that procedure i couldnt understand the use of the following parameters in it.
            h_fnames in Name_Array,
            h_fvalues in Value_Array,
            h_fdocnames in Value_Array,
            h_counter in varchar2,
            This is the procedure FYR
            procedure SubmitCreate(
            user in varchar2,
            msg_type in varchar2,
            msg_name in varchar2,
            begin_date in varchar2 ,
            end_date in varchar2 ,
            action in varchar2,
            fmode in varchar2 ,
            action_argument in varchar2 ,
            display_action_argument in varchar2 ,
            h_fnames in Name_Array,
            h_fvalues in Value_Array,
            h_fdocnames in Value_Array,
            h_counter in varchar2,
            rule_comment in varchar2 ,
            -- insert_button in varchar2 default null)
            delete_button in varchar2 ,
            done_button in varchar2 )
            is
            owner varchar2(320);
            realname varchar2(360);
            s0 varchar2(2000);
            l_msg_type varchar2(8) := REPLACE(msg_type, '^', ' ');
            l_msg_name varchar2(30) := REPLACE(msg_name, '^', ' ');
            typebuf varchar2(8);
            namebuf varchar2(30);
            ruleid number;
            begdate date;
            enddate date;
            forwardee varchar2(320);
            l_action varchar2(30) := action;
            
            begin
            -- Validate access
            owner := Wf_Route.Authenticate(user);
            wf_directory.GetRoleInfo(owner, realname, s0, s0, s0, s0);
            
            -- Check if delete
            
            if (delete_button is not null) then
            --
            -- Raise DELETE so that it won't create a record
            --
            Wf_Route.List(user, '--EDITSCREEN--');
            return;
            end if;
            
            if (done_button is not null) then
            -- Validate msg_type
            if (l_msg_type = '*') then
            -- Change '*' for default back to null
            typebuf := '';
            else
            -- All others must by valid via poplist
            typebuf := l_msg_type;
            end if;
            
            -- Validate msg_name
            if (l_msg_name = '*') then
            -- Change '*' for default back to null
            namebuf := '';
            else
            -- All others must by valid via poplist
            namebuf := l_msg_name;
            end if;
            
            -- Get dates
            begdate := StringToDate(begin_date);
            enddate := StringToDate(end_date);
            
            -- Validate date range
            if (enddate <= begdate) then
            wf_core.raise('WFRTG_BAD_DATE_RANGE');
            end if;
            
            -- Validate action
            -- Only rule is RESPOND must have both msg_type and msg_name specified
            if (action = 'RESPOND') then
            if ((typebuf is null) or (namebuf is null)) then
            wf_core.raise('WFRTG_RESPOND_MESSAGE');
            end if;
            end if;
            
            -- Validate action_argument
            if (action = 'FORWARD') then
            forwardee := action_argument;
            wfa_html.validate_display_name (display_action_argument, forwardee);
            l_action := fmode;
            end if;
            
            -- Select new ruleid
            select WF_ROUTING_RULES_S.NEXTVAL
            into ruleid
            from SYS.DUAL;
            
            -- Insert new rule in table with data so far
            insert into WF_ROUTING_RULES (
            RULE_ID,
            ROLE,
            ACTION,
            BEGIN_DATE,
            END_DATE,
            MESSAGE_TYPE,
            MESSAGE_NAME,
            ACTION_ARGUMENT,
            RULE_COMMENT
            ) values (
            ruleid,
            SubmitCreate.owner,
            SubmitCreate.l_action,
            begdate,
            enddate,
            SubmitCreate.typebuf,
            SubmitCreate.namebuf,
            SubmitCreate.forwardee,
            SubmitCreate.rule_comment
            );
            
            -- Go directly to update to finish entering data
            -- Wf_route.UpdateRule(to_char(ruleid));
            --
            -- Update routing attributes if RESPOND
            --
            if (SubmitCreate.action = 'RESPOND') then
            -- Start at 2 to step over the Dummy_Name/Dummy_Value pair added at
            -- the start of the array.
            for i in 2 .. to_number(SubmitCreate.h_counter) loop
            SetAttribute(ruleid, SubmitCreate.h_fnames(i),
            SubmitCreate.h_fvalues(i), SubmitCreate.h_fdocnames(i));
            end loop;
            end if;
            end if;
            -- Go back to the List page
            owa_util.redirect_url(curl=>wfa_html.base_url || '/wf_route.list?user='||user||'&display_user=--EDITSCREEN--',
            bclose_header=>TRUE);
            exception
            when others then
            rollback;
            wf_core.context('Wf_Route', 'SubmitCreate', msg_type, msg_name,
            begin_date, end_date, action);
            wf_route.error;
            end SubmitCreate;
            
            
            --
            -- CreateRule
            -- Create a new routing rule
            -- Part 1, choose msg_type
            -- IN
            -- user - User to query rules for. If null use current user.
            -- Nore: only WF_ADMIN_ROLE can create rules for other users
            -- create_button - create button flag
            -- MODIFICATION LOG:
            -- 06-JUN-2001 JWSMITH BUG 1819232 - Added summary attr for table tag for ADA
            -- - Added ID attr for TD tags
            Thanks for your reply.

            Regards,
            Saro
            • 3. Re: Vacation Rule API
              Saro
              Hi,

              Can anyone reply me.

              regards,
              Saro