Trigger updates more values

Hi guys, I have the trigger below on my db, the trigger is suppose to update a column "Total_qty" in tbl_supply_s table with a value "qty_sold" from vw_receipt_pos. but depending on the number of record that was entered from the application, the triger doubles the update. take for instance, if someone enters two rows with qty_sold = 2 for the two rows, the triger updates total_qty to minus 8 instead of minus 4.
Pls guys help me look at the triger n tell me the problem. thanks
CREATE OR REPLACE TRIGGER "TRG_UPDATE_TOTAL_QTY"
AFTER insert on "TBL_SALES_DETAILS"
begin
declare
v_sales_id number;
v_supply_id number;
v_qty number;
CURSOR cur_update_total IS SELECT distinct supply_id, qty_sold FROM VW_RECEIPT_POS where sales_id = (select max(sales_id) from tbl_sales_s);
begin
select max(sales_id) into v_sales_id from tbl_sales_s;
OPEN cur_update_total;
LOOP
FETCH cur_update_total INTO v_supply_id, v_qty;
EXIT WHEN cur_update_total%NOTFOUND;
update tbl_supply_s
set total_qty = total_qty - v_qty
where supply_id = v_supply_id;
END LOOP;
CLOSE cur_update_total;
end;
end;

Hi,
If I insert 5 rows in one transaction then your trigger fires ONCE and the updates will not be record specific.
For this trigger to work you need to coordinate it behaviour with the rows that have been updated, to do this people typically create a before trigger to clear records in a package, a row level trigger to record which records have been updated, and a table level trigger, not unlike your own, that uses the records that have been updated to correlate their cursor updates. This can be simplified if you write a trigger against a view (to avoid mutating table issues), but for a full description look for 'Mutating Table' on 'Ask Tom' or even this site...
regards,
Robert.

Similar Messages

  • Trigger updating more than reqiured rows

    Hi guys, I have the trigger below on my db, the trigger is suppose to update a column "Total_qty" in tbl_supply_s table with a value "qty_sold" from vw_receipt_pos. but depending on the number of record that was entered from the application, the triger doubles the update. take for instance, if someone enters two rows with qty_sold = 2 for the two rows, the triger updates total_qty to minus 8 instead of minus 4.
    Pls guys help me look at the triger n tell me the problem. thanks
    CREATE OR REPLACE TRIGGER "TRG_UPDATE_TOTAL_QTY"
    AFTER insert on "TBL_SALES_DETAILS"
    begin
    declare
    v_sales_id number;
    v_supply_id number;
    v_qty number;
         CURSOR cur_update_total IS SELECT distinct supply_id, qty_sold FROM VW_RECEIPT_POS where sales_id = (select max(sales_id) from tbl_sales_s);
    begin
    select max(sales_id) into v_sales_id from tbl_sales_s;
    OPEN cur_update_total;
    LOOP
    FETCH cur_update_total INTO v_supply_id, v_qty;
    EXIT WHEN cur_update_total%NOTFOUND;
    update tbl_supply_s
    set total_qty = total_qty - v_qty
    where supply_id = v_supply_id;
    END LOOP;
    CLOSE cur_update_total;
    end;
    end;

    Hi!
    This is the wrong forum to ask SQL or PL/SQL questions!
    Please ask your question here:
    PL/SQL
    Best regards,
    Matt

  • Update trigger fails with value too large for column error on timestamp

    Hello there,
    I've got a problem with several update triggers. I've several triggers monitoring a set of tables.
    Upon each update the updated data is compared with the current values in the table columns.
    If different values are detected the update timestamp is set with the current_timestamp. That
    way we have a timestamp that reflects real changes in relevant data. I attached an example for
    that kind of trigger below. The triggers on each monitored table only differ in the columns that
    are compared.
    CREATE OR REPLACE TRIGGER T_ava01_obj_cont
    BEFORE UPDATE on ava01_obj_cont
    FOR EACH ROW
    DECLARE
      v_changed  boolean := false;
    BEGIN
      IF NOT v_changed THEN
        v_changed := (:old.cr_adv_id IS NULL AND :new.cr_adv_id IS NOT NULL) OR
                     (:old.cr_adv_id IS NOT NULL AND :new.cr_adv_id IS NULL)OR
                     (:old.cr_adv_id IS NOT NULL AND :new.cr_adv_id IS NOT NULL AND :old.cr_adv_id != :new.cr_adv_id);
      END IF;
      IF NOT v_changed THEN
        v_changed := (:old.is_euzins_relevant IS NULL AND :new.is_euzins_relevant IS NOT NULL) OR
                     (:old.is_euzins_relevant IS NOT NULL AND :new.is_euzins_relevant IS NULL)OR
                     (:old.is_euzins_relevant IS NOT NULL AND :new.is_euzins_relevant IS NOT NULL AND :old.is_euzins_relevant != :new.is_euzins_relevant);
      END IF;
    [.. more values being compared ..]
        IF v_changed THEN
        :new.update_ts := current_timestamp;
      END IF;
    END T_ava01_obj_cont;Really relevant is the statement
    :new.update_ts := current_timestamp;So far so good. The problem is, it works the most of time. Only sometimes it fails with the following error:
    SQL state [72000]; error code [12899]; ORA-12899: value too large for column "LGT_CLASS_AVALOQ"."AVA01_OBJ_CONT"."UPDATE_TS"
    (actual: 28, maximum: 11)
    I can't see how the value systimestamp or current_timestamp (I tried both) should be too large for
    a column defined as TIMESTAMP(6). We've got tables where more updates occur then elsewhere.
    Thats where the most of the errors pop up. Other tables with fewer updates show errors only
    sporadicly or even never. I can't see a kind of error pattern. It's like that every 10.000th update
    or less failes.
    I was desperate enough to try some language dependend transformation like
    IF v_changed THEN
        l_update_date := systimestamp || '';
        select value into l_timestamp_format from nls_database_parameters where parameter = 'NLS_TIMESTAMP_TZ_FORMAT';
        :new.update_ts := to_timestamp_tz(l_update_date, l_timestamp_format);
    END IF;to be sure the format is right. It didn't change a thing.
    We are using Oracle Version 10.2.0.4.0 Production.
    Did anyone encounter that kind of behaviour and solve it? I'm now pretty certain that it has to
    be an oracle bug. What is the forum's opinion on that? Would you suggest to file a bug report?
    Thanks in advance for your help.
    Kind regards
    Jan

    Could you please edit your post and use formatting and tags.  This is pretty much unreadable and the forum boogered up some of your code.
    Instructions are here: http://forums.oracle.com/forums/help.jspa                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need Trigger reject when update more than 1 row

    I need make a trigger who rejects when a user intents update more than one record.
    The user only can update one row, but when update without WHERE all data was modified and cause problems.
    Thanks,
    MIGUEL ANGEL CARO
    [email protected]

    YTou can keep track of the number of updated records in a global package variable, as in the next example.
    create or replace package pkg_test as
    g_count number;
    procedure p_reset;
    procedure p_increase;
    function f_updated return number;
    end;
    create or replace package body pkg_test as
    procedure p_reset is
    begin
    g_count := 0;
    end;
    procedure p_increase is
    begin
    g_count := g_count + 1;
    end;
    function f_updated return number is
    begin
    return g_count;
    end;
    end;
    create table ttemp (t_col varchar2(10))
    create trigger bu_tmp before update on ttemp
    begin
    pkg_test.p_reset;
    end;
    create trigger au_tmp after update on ttemp for each row
    begin
    if pkg_test.f_updated > 0 then
    raise_application_error(-20000,'Trying to update more than 1 record at the same time');
    end if;
    pkg_test.p_increase;
    end;

  • Trigger firing more than once

    Can any one help me i am having the problem with trigger . The trigger fires more than once. I want the trigger to be fired for every COMMIT and not for each row.
    The pl/sql used for populating the table in given below
    CREATE OR REPLACE TRIGGER REFRESH_MV_TRIGGER
    AFTER INSERT OR UPDATE ON CONTACT_HISTORY
    DECLARE
    cnt NUMBER;
    BEGIN
    IF ( INSERTING ) THEN
    dbms_output.put_line('INSERTING');
    END IF;
    IF ( UPDATING ) THEN
    dbms_output.put_line('UPDATING');
    END IF;
    END;
    DECLARE
    BEGIN
    FOR i IN 1..2 LOOP
    INSERT INTO CONTACT_HISTORY(TARGET_ID,CAMPCODE,COMMSTAGE,CUSTOMER_KEY,solicit_dt)
    VALUES(i,'CAMP4','COMM1',i,SYSDATE);
    END LOOP;
    COMMIT;
    END;
    sql> output when i run pl/sql block
    INSERTING
    INSERTING

    I am not shure what you need exactly but maybe this might help:
    CREATE TABLE dept (
      deptno NUMBER(2) PRIMARY KEY,
      dname  VARCHAR2(14),
      loc    VARCHAR2(13)
    CREATE TABLE dept_history (
      deptno NUMBER(2),
      dname  VARCHAR2(14),
      loc    VARCHAR2(13)
    CREATE MATERIALIZED VIEW dept_mv
      BUILD IMMEDIATE
      REFRESH ON COMMIT
      AS SELECT * FROM dept
    CREATE OR REPLACE TRIGGER bir_dept_mv
      BEFORE INSERT ON dept_mv
      FOR EACH ROW
    BEGIN
      INSERT INTO dept_history VALUES (:NEW.deptno, :NEW.dname, :NEW.loc);
    END;
    INSERT INTO DEPT (deptno, dname, loc) VALUES (1, 'D1', 'L1');
    1 row created.
    INSERT INTO DEPT (deptno, dname, loc) VALUES (2, 'D2', 'L2');
    1 row created.
    SELECT * FROM dept;
        DEPTNO DNAME          LOC
             1 D1             L1
             2 D2             L2
    SELECT * FROM dept_history;
    no rows selected
    SELECT * FROM dept_mv;
    no rows selected
    COMMIT;
    Commit complete.
    SELECT * FROM dept_history;
        DEPTNO DNAME          LOC
             1 D1             L1
             2 D2             L2
    SELECT * FROM dept_mv;
        DEPTNO DNAME          LOC
             1 D1             L1
             2 D2             L2Regards,
    Zlatko Sirotic

  • Trigger for more  than One table

    Hi,
    is it possible to create a trigger for more than one table?
    I need a trigger that fires when anyone of the users updates a special value in one of the DB tables.
    this value is in about 8 or 10 tables, or must i create a trigger for each table?
    thanx
    marcel

    You would wrap the functionality required into a packaged procedure and then have a trigger on each of these tables that simply call this packaged procedure.
    Yes, you would have one trigger per table.

  • Created a trigger but new values are not inserting in the backup table

    I have created a backup table and writter a trigger on a table such that after update old values and new values are to be inserted into the backup table, but new values are not inserting. I am giving the code please help me
    create or replace trigger "SUPPQUOTES_AUDIT"
    after update or delete on phsuppquotes for each row
    begin
    insert into phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values
    (:new.cprc,:old.suppcode,:old.itemcode,:old.cprc,:old.negodt,:old.validdt,:old.userid,SYSDATE);
    end;

    old values and new
    values are to be inserted into the backup table, butwell you have only one insert there, inserting old values with a new id (which is ok if you don't update the id column, but I don't think that :new is available for deleting ops); you should have two inserts:
    insert into
    phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values (:old.cprc,:old.suppcode,:old.itemcode,:old.cprc,:old.negodt,:old.validdt,:old.userid,SYSDATE);
    if (updating) then
    insert into phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values (:new.cprc,:new.suppcode,:new.itemcode,:new.cprc,:new.negodt,:new.validdt,:new.userid,SYSDATE);
    end if;
    gojko adzic
    http://gojko.net

  • Xml to Oracle (Update more than one row)

    Hi,
    I want to update more than one row in table from .xml file. My xml file is as follows:
    <ROOT>
    <PROFILE PROFILEMASTER_PKEY="54" DB_MSTR_PKEY="2" PROFILE_NAME="Bhushans" DELIMETER="~" PRE_PROCESSOR="1" POST_PROCESSOR="10" PRE_PROCESSOR_TYPE="1" POST_PROCESSOR_TYPE="2" GROUPID="2" />
    <PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="FEEDVALIDATION_ID" DATA_TYPE="NUMBER" DATA_SIZE="22" START_POSITION="12" END_POSITION="22" COLUMNORDER="1" PROFILEDETAILS_PKEY="399"/>
    <PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="CHANGE_TYPE" DATA_TYPE="VARCHAR2" DATA_SIZE="1" START_POSITION="12" END_POSITION="144" COLUMNORDER="5" PROFILEDETAILS_PKEY="403"/>
    <OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="@" PROFILE_CFILE_PKEY="337" />
    <OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="~" PROFILE_CFILE_PKEY="336" />
    </ROOT>
    To update according to xml file, I have written following procedure. My procedure updates the table if u r updating 1 row. If you try to update more than 1 row, I mean .xml file contains more than 1 row then my procedure doesn't work. Please help to solve this problem.
    Procedure:
    create or replace procedure fm_prc_xml_dup_up
    as
    f utl_file.file_type;
    s varchar2(2000);
    v varchar2(3000);
    xml XMLType;
    v_pmpk number;
    v_sdtl_pk number;
    chng_typ VARCHAR2(20);
    type r1 is ref cursor;
    rcur r1;
    v1 varchar2(120);
    v2 number;
    begin
    f := utl_file.fopen('CITI', 'S.XML', 'R');
    loop
    utl_file.get_line(f, s);
    v := v || ' ' || s;
    end loop;
    exception
    when no_data_found then
    utl_file.fclose(f);
    xml := xmltype(v);
    SELECT extract(xml, 'ROOT/CHANGE/@CHANGETYPE').getstringval()
    INTO CHNG_TYP
    FROM DUAL;
    UPDATE FM_PROFILEMAST
    set db_mstr_pkey = extract(xml, 'ROOT/PROFILE/@DB_MSTR_PKEY').getnumberval(),
    profile_name = extract(xml, 'ROOT/PROFILE/@PROFILE_NAME').getstringval(),
    file_type = extract(xml, 'ROOT/PROFILE/@FILE_TYPE').getstringval(),
    delimiter = extract(xml, 'ROOT/PROFILE/@DELIMETER').getstringval(),
    pre_processor = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR').getstringval(),
    post_processor = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR').getstringval(),
    pre_processor_type = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR_TYPE').getstringval(),
    post_processor_type = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR_TYPE').getstringval(),
    groupid = extract(xml, 'ROOT/PROFILE/@GROUPID').getstringval(),
    change_type = 'U',
    change_by = chng_typ,
    change_dt = default,
    active_flag = default
    WHERE profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval();
    UPDATE FM_PROFILEDET
    SET target_source_table = extract(xml, 'ROOT/PROFILEDETAILS/@TARGET_SOURCE_TABLE').getstringval(),
    column_name = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_NAME').getstringval(),
    data_type = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_TYPE').getstringval(),
    data_size = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_SIZE').getnumberval(),
    start_position = extract(xml, 'ROOT/PROFILEDETAILS/@START_POSITION').getnumberval(),
    end_position = extract(xml, 'ROOT/PROFILEDETAILS/@END_POSITION').getnumberval(),
    change_by = chng_typ,
    change_dt = default,
    columnorder = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMNORDER').getstringval(),
    column_format = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_FORMAT').getstringval(),
    nullable = extract(xml, 'ROOT/PROFILEDETAILS/@NULLABLE').getstringval(),
    change_type ='U',
    active_flag = default
    WHERE profiledetails_pkey = extract(xml, 'ROOT/PROFILEDETAILS/@PROFILEDETAILS_PKEY').getstringval();
    UPDATE FM_PROFILE_CFILE
    SET profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval(),
    ldr_syntx_dtls_pkey = extract(xml, 'ROOT/OPTIONS/@LDR_SYNTX_DTLS_PKEY').getstringval(),
    val = extract(xml, 'ROOT/OPTIONS/@OPTIONVALUE').getstringval(),
    change_by = chng_typ,
    change_dt = default,
    sub_line_seq = extract(xml, 'ROOT/OPTIONS/@SUB_LINE_SEQ').getstringval(),
    change_type = 'U',
    active_flag = default
    where profile_cfile_pkey = extract(xml, 'ROOT/OPTIONS/@PROFILE_CFILE_PKEY').getnumberval();
    END;

    Hi Bhushan,
    one where clause is missing in the main update.
    update fm_profiledet
    set (....)
    =(select ....)
    where id in (select your profiledetails_pkey from the xml). <--this where clause were missing.
    if xml extracting is too slow(xml very large) then you can create a procedure where exract your data from the xml and then update rows in for loop.
    something like this
    create procedure up_xmls(p_xml xmltype) is
    cursor cur_xml(p_xml xmltype) is
    select ......<--here you extract your xml
    begin
    for r_row in cur_xml(p_xml) loop
    update fm_profiledet set target_source_table=r_row.target_source_table
    where profiledetails_pkey=r_row.profiledetails_pkey;
    end loop;
    end;this should work:
    SQL> drop table fm_profiledet;
    Table dropped.
    SQL> create table fm_profiledet(
      2   profiledetails_pkey number
      3  ,target_source_table varchar2(100)
      4  ,column_name varchar2(100)
      5  ,data_type varchar2(100)
      6  ,data_size number
      7  ,start_position number
      8  ,change_type varchar2(100)
      9  )
    10  /
    Table created.
    SQL>
    SQL>
    SQL> insert into fm_profiledet
      2  values(399,'test','test1','test2',1,2,'A')
      3  /
    1 row created.
    SQL>
    SQL>
    SQL> insert into fm_profiledet
      2  values(403,'test3','test4','test5',3,4,'B')
      3  /
    1 row created.
    SQL> insert into fm_profiledet
      2  values(443,'test3','test4','test5',3,7,'B')
      3  /
    1 row created.
    SQL>
    SQL>
    SQL> select * from fm_profiledet;
    PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE  DATA_SIZE START_POSITION CHANGE_TYP                               
                    399 test       test1      test2              1              2 A                                        
                    403 test3      test4      test5              3              4 B                                        
                    443 test3      test4      test5              3              7 B                                        
    SQL>
    SQL> create or replace directory xmldir as '/home/ants';
    Directory created.
    SQL>
    SQL>
    SQL>
    SQL> update fm_profiledet fm
      2  set (target_source_table,column_name, data_type, data_size, start_position,change_type)
      3  =(
      4    select  target_source_table
      5          , column_name
      6          , data_type
      7          , data_size
      8          , start_position
      9          , change_type
    10    from(
    11      select
    12        extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
    13      , extractValue(value(x),'/PROFILEDETAILS/@TARGET_SOURCE_TABLE') target_source_table
    14      , extractValue(value(x),'/PROFILEDETAILS/@COLUMN_NAME') column_name
    15      , extractValue(value(x),'/PROFILEDETAILS/@DATA_TYPE') data_type
    16      , extractValue(value(x),'/PROFILEDETAILS/@DATA_SIZE') data_size
    17      , extractValue(value(x),'/PROFILEDETAILS/@START_POSITION') start_position
    18      ,'U' change_type
    19     from
    20      table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
    21                                      ,nls_charset_id('AL32UTF8'))
    22                               , '/ROOT/PROFILEDETAILS'))) x
    23    ) s
    24  where s.profiledetails_pkey=fm.profiledetails_pkey)
    25  where
    26    fm.profiledetails_pkey in (select
    27        extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
    28     from
    29      table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
    30                                      ,nls_charset_id('AL32UTF8'))
    31                               , '/ROOT/PROFILEDETAILS'))) x
    32  );
    2 rows updated.
    SQL>
    SQL>
    SQL> select * from fm_profiledet;
    PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE  DATA_SIZE START_POSITION CHANGE_TYP                               
                    399 FM_FEEDVAL FEEDVALIDA NUMBER            22             12 U                                        
                        IDATION_LU TION_ID                                                                                 
                    403 FM_FEEDVAL CHANGE_TYP VARCHAR2           1             12 U                                        
                        IDATION_LU E                                                                                       
                    443 test3      test4      test5              3              7 B                                        
    SQL> spool off;Ants
    Message was edited by:
    Ants Hindpere

  • Not able to update more than 10,000 records in CT04 for a characteristic

    Hi all,
    We are not able to update more than 10,000 records in CT04 for a certain characteristic.
    Is there any possible way to do this?
    Please advise...its a production issue.
    Thanks.

    Hello ,
    Please consider using a check table for the characteristic involved if you are working with large
    number of values assigned
    With a check table you have a possibility to work with a huge amount of values , also the performance should improve                          
    Please refer to the link
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/ec/62ae27416a11d1896d0000e8322d00/frameset.htm
    Section - Entering a Check Table 
    Hopefully the information helps
    Thanks
    Enda.

  • How do I update the value of a hidden field?

    Jsp has hidden field. The value of the hidden field is set.
    <%= RequestCtx.getSessionInfoAsHiddenParam() %>
    <INPUT type ="HIDDEN" name=billtoContactPartyId" Value="<%=billtoContactPartyId %>">
    Based on some logic I've added to the jsp. I want to update the value of the hidden field. This does not work. How do I update the value?
    windowForm.elements['billtoContactPartyId'].value = windowForm.elements['defaultcontactPartyId'].value;

    Hi,
    If you create a function to return wwctx_api.get_user you could
    call this inside an update trigger, you could put in an
    exception to return USER if there is an error, this would then
    work for users connected directly and users using Portal.
    Regards Michael
    e.g.
    CREATE OR REPLACE FUNCTION F_PORTAL_USER RETURN VARCHAR2 IS
         vRet VARCHAR2(50) := wwctx_api.get_user;
    BEGIN
         RETURN(vRet);
    EXCEPTION
         WHEN OTHERS THEN
              RETURN (USER);
    END F_PORTAL_USER;

  • How do we update the value of a textfield in a dialog box by clicking a button/ textbutton ?

    How do we update the value of a textfield in a dialog box by clicking a button/ textbutton ?

    Hi,
    If you create a function to return wwctx_api.get_user you could
    call this inside an update trigger, you could put in an
    exception to return USER if there is an error, this would then
    work for users connected directly and users using Portal.
    Regards Michael
    e.g.
    CREATE OR REPLACE FUNCTION F_PORTAL_USER RETURN VARCHAR2 IS
         vRet VARCHAR2(50) := wwctx_api.get_user;
    BEGIN
         RETURN(vRet);
    EXCEPTION
         WHEN OTHERS THEN
              RETURN (USER);
    END F_PORTAL_USER;

  • Update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow

    Hi,
    We have a requirement to update a column value once the item has been approved.
    Following settings have been made in the publishing articles list:
    Require content approval for submitted items : yes
    Create major and minor (draft) versions
    Who should see draft items in this document library? :Only users who can edit items
    Require documents to be checked out before they can be edited? : yes
    I have createdatu a Sharepoint 2013 workflow to check if Approval sts of current item = 0 i.e. Approved , then check out and update the item and finally checkin the item. Everything works fine till this point except that the minor version of the item is
    checked in. Due to this the updated columns are not published to others.
    Also, I created a Sharepoint 2010 workflow to SET CONTENT APPROVAL = APPROVED and started this workflow from my list workflow above, but the item does not get checked-in and always shows "In Progress" status with comment "The item is currently
    locked for editing. Waiting for item to be checked in or for the lock to be released.".
    Please let me know where I am missing out so that once the item is approved, column value gets updated and current item is still in Approved status.
    Thanks

    Hi,
    According to your post, my understanding is that you want to update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow.
    You will get into this kind of Catch-22 situation trying to set the Content Approval Status in SharePoint Designer workflow:
    - You must check out the document before you can change the Content Approval Status
             - You can't change the Content Approval Status once the document in checked out
    Since you set the Require documents to be checked out before they can be edited=Yes, you will need to check out the document when run the workflow on the item. But you cannot approve a document when it is checked
    out. So the logic in workflow conflicts.
    As a workaround, you can use the Start Another Workflow action to start the normal Approval workflow on the document.  The built-in Approval workflow can work with a document that’s not checked out.
    The designer approval workflow also can work with a document that’s not checked out.
    You can create two workflow using SharePoint Designer 2013.
    First, create a SharePoint 2010 platform workflow.
    Then, create a SharePoint 2013 platform workflow.
    Then when the SharePoint 2013 platform workflow start, it will start the SharePoint 2010 platform workflow to set content approval status, then the SharePoint 2013 platform workflow will update current item value.
    More information:
    SharePoint Designer Workflow Content Approval Issue
    SharePoint 2010 Approval Workflow with Content Approval
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to Get and Update properties values from XML tag Using Xquery or PL Sql

    Hi
    I have this tag
    <Solicitud Pais = "1">
    How i can get Pais value?
    How i can update Pais Value?
    Y can use Xquery funtions or PL SQL for this?
    Thak's
    Angel

    How i can get Pais value? ExtractValue
    How i can update Pais Value?UpdateXML
    Y can use Xquery funtions or PL SQL for this?Yes
    Without knowing more about your requirements, where information resides, or even a version of Oracle, that is the best I'll do.

  • Using Method UPDATE_CONTRACT_OBJECT to Update Facts Value

    Hello,
    I'm using method  UPDATE_CONTRACT_OBJECT to update Fact Values.
    I want to update the content of IT_FACTS-BAPI_CTRACPSOBJECT_FACTS-VALUE_GENERIC  from the FormBundel Header SYS_FORM_BUNDEL_HEADER-PERIOD_KEY.
    After generating the funtion, my mapping is modify by the generation program to T_FACTS-BAPI_CTRACPSOBJECT_FACTS-VALUE_GENERIC = CURRENT_DATE.
    This generates an error message in the method due to existing controls in BAPI_CTRACPSOBJECT_CHANGE.
    There is any way that I could avoid the generation programme to overwrite the mapping? I just want to transfer the value of the period (4 Characters-Ex: 2014) to VALUE_GENERIC?
    Thank you in advance
    Regards
    Carlos

    Hello Tobias,
    More details here, I'm using BRFplus action UPDATE_CONTRACT_OBJECT. Working in Tax Revenue Management.
    Regards
    Carlos

  • Trying to update a value if a condition is filled

    im trying to update a value in table Golf when the id is the same in table Golf and table soccer. in table soccer id is the primary key and when the cost in soccer table is 0 but it just sets info available for all 3000 rows when it should only do 282 which is what i get when i run the select below
    Select g.id, s.id
    from Golf g, Soccer s
    where
         g.id = s.id
    and
         s.cost = 0
    But when i try to use this in the update it updates all rows in Golf. Any ideas?
    update Golf
    set info = 'Available'
    where exists
    select g.id, s.id
    from Golf g, Soccer s
    where
    g.id = s.id
    and
    s.cost = 0
    );

    Hello,
    Just a few more observations:
    Instead of:
    UPDATE golf g
    SET    info = 'Available'
    WHERE  EXISTS (SELECT g.ID,
                          s.ID
                   FROM   golf g2,
                          soccer s
                   WHERE  g2.ID = s.ID
                          AND s.cost = 0
                          AND g2.ID = g.ID);It could simply be:
    UPDATE golf g
    SET    info = 'Available'
    WHERE  EXISTS (SELECT 1
                   FROM   golf g2,
                          soccer s
                   WHERE  g2.ID = s.ID
                          AND s.cost = 0
                          AND g2.ID = g.ID);You only need to check the existence in the EXISTS subquery, you don't need to actually SELECT any columns. And the g and g2 are necessary to tie the outer records to the records in the subquery, otherwise all records will be updated.

Maybe you are looking for

  • Problem with Webcam on Lenovo G560

    Hi guys, I need help with my Lenovo G560. I cannot access the Webcam, I have not been able to take any pictures/videos with my laptop. I am using Windows 7 Ultimate, 32-bit operating system. Thanks in advance guys! Nonz

  • Adobe acrobat distiller has stopped working

    While trying to create pdf file from MS dynamics GP using adobe acrobat distiller 9.0, the following error message pops up Faulting application name: acrodist.exe, version: 9.0.0.332, time stamp: 0x4850b770 Faulting module name: ntdll.dll, version: 6

  • Can a client on Contribute CS4 work with administrator on CS3?

    I have CS3 and upgrading to CS4 is not currently in the budget.  Have a client prospect who may want to work with Contribute but would have to buy it and I gather that only CS4 version of Contribute is available (and he's on a PC while I'm on a Mac).

  • Java.lang.ClassCastException in Controller Class

    Hi All, I am getting ClassCastException in one of my Controller class where initiating OABreadCrumbsBean object. The code is as below. OABreadCrumbsBean oabreadcrumbsbean = (OABreadCrumbsBean)((OAPageLayoutBean)oawebbean).getBreadCrumbsLocator(); Thi

  • Files added to server take time to show for other users

    Various users add files to server and other users with folder access cannot see files for sometimes up to 2 hours before the files appear.  It is not a rights issues as when the file final appear in the directory they can access the file and use.