Can we update InfoPath field using Event Receiver ItemAdded method

Hi,
Can we update InfoPath browser enabled form field using Event Receiver ItemAdded method. Following is the code snippet I used to update the field but it's not updating the field.
Please help me on this issue.
public override void ItemAdded(SPItemEventProperties properties)
            base.ItemAdded(properties);
            try
                //Turn off event firing so we don't end up with a conflict 
                base.EventFiringEnabled = false;
                //Run the code elevated so we can rename our item
                SPSecurity.RunWithElevatedPrivileges(delegate()
                    using (SPSite site = new SPSite(properties.Web.Site.ID))
                        using (SPWeb web = site.OpenWeb(properties.Web.ID))
                            //Grab a new copy of our list and listitem under the new security context
                            SPList list = web.Lists[properties.List.ID];
                            SPListItem item = list.Items.GetItemById(properties.ListItemId);
                            //Change name and title to match item ID
                            item.File.CheckOut();
                            string fieldInternalName = properties.List.Fields["Employee Name"].InternalName;
                            SPUser oUser = web.EnsureUser(Convert.ToString(item["Employee Entry"]).Substring(0, Convert.ToString(item["Employee Entry"]).Length - 2));
                            item[fieldInternalName] = oUser.Name;
                            item.Update();
                            item.File.CheckIn("Changed Employee Name");
            catch (Exception ex)
                //Log an errors to the ULS
            finally
                //Turn event firing back on
                base.EventFiringEnabled = true;
Srivignesh J

When you published your infopath form, did you promote the field you are trying to update to a property, and allow updates (its one of the steps in publishing your form, where you pick which fields you want to show as fields in the list view)... 
Otherwise, how about get the Item.SPFile object, open it as XML, find the field you want to update, and update it that way... 

Similar Messages

  • How can I update my app using my own ac?

    can I know if I can update my app from the other ac ?cause when I downloaded the app I used my friend ID  but now I can't contact him .so how can I update the app using my own ac?

    You can't, all content is tied to the account that bought/downloaded it, so only that account will be able to download updates to its apps.

  • Can not update Photoshop CC (2014) and receive error message U43M1D206. What do I do?

    Can not update Photoshop CC (2014) and receive error message U43M1D206. What do I do?

    Bump
    I am also having the same issue with a lot of the softwares i have downloaded. Its unable to download the initial patch update.

  • HT5654 how can i update my iphone use itunes on the computer

    how can i update my iphone use itunes on the computer

    How to update an iDevice  Scroll down to the section about updating via iTunes on the computer.

  • I can not update my N95 using Nokia Software Updat...

    I can not update my N95 using Nokia Software Updater.
    The error message "unable to update the software" will appear.
    I have version 12.0.013.
    Come with ideas, I have contacted Nokia's support and they want me to send the phone to them but it may be the final solution.

    This page might answer your question:
    http://linux.sgms-centre.com/nokiafaq/branded-phon​es/
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • I just got my new Naite phone. Can I update the software using Mac OS X?

    I just got my new Naite phone. Can I update the software using Mac OS X?

    NO!!! i don't have to buy a PC or windows if I allready have a Mac!! I have had a Mac when I bought you phone!!! nobodey asked me what computer i have and nobody warned me about your resctrictions!!!!! so not i have to buy anything but you have to make me possible to update the phone without windows but using my Mac computer!!!!!! so do it!!!!! &&&&&&!!!!

  • Can't update or download apps. Says payment method declined.

    Can't update or download apps. Saying payment method declined.

    Go to http://www.apple.com/emea/support/itunes/contact.html to get help from the iTunes support staff who have access to your account information.

  • TS4337 How do you stop the incessant error message when calendar can't update or delete an event on my Exchange, even though I have hit every option and even deleted the exchange and the calendars.  I'm ready to never use the computer again with the const

    Calendar is incessantly posting error messages that it cannot change or delete an event on my Exchange calendar.  I have tried the "revert to server, try again, and ignore" more times than I can count.  I even deleted the exchange from my connection and reinstalled without help.  Even when I have deleted the Exchange, it continues to have this error window every 60 seconds.  I am ready to stop using the computer just for the stress of it.  Any suggestions or help before this screen winds up with a shoe in it?

    To prevent Firefox from displaying form autocomplete suggestions, you can turn off that feature using the about:config page.
    In the address bar, type or paste '''about:config''' and tap the Enter/Return key.
    I suggest bookmarking this for easier future access.
    In the search box, type or paste '''formf''' and tap the Enter/Return key.
    Scroll down to '''browser.formfill.enable''' and tap the Toggle button to switch it from true to false.
    That's it. Does it work on Facebook?
    ''The about:config preferences editor in the mobile version is similar in principle to the desktop version but many of the preferences available on the desktop version have no effect in mobile. This one I only tested on one site, but it seems to work.''

  • Get All Values From NewForm.aspx using Event Receiver Item Adding

    HI All,
             I have conditions to check before the insertion of "Calendar Event".For this I am using Item Adding Event Receiver ,When Click on Save button I need to get all the values of Items filled in NewForm.aspx and check
    the condition,If condition satisfies make them insert else show alert info  as"Not Valid",Below is code and error message
    public override void ItemAdding(SPItemEventProperties properties)
                base.ItemAdding(properties);
               string StartTime = properties.AfterProperties["Start Time"].ToString();
               string EndTime = properties.AfterProperties["End Time"].ToString();
    Error
    Object reference not set to an instance of an object.
    Use the New "Keyword to create an object instance
    Can any one help me how can I do it.
    Thanks,
    Quality Communication Provides
    Quality Work.
    http://siddiq-sharepoint2010.blogspot.in/
    Siddiqali Mohammad .

    Hi,
          Have you tried with the code snippet as mentioned below
    string EndDate = Convert.ToString(properties.AfterProperties["EndDate"]);
    string StartDate = Convert.ToString(properties.AfterProperties["EventDate"]);
    If my post is helpful - please click on the green arrow to mark it as answer

  • How can I update data fields in a merged document ?

    Hi,
    I'm looking for a way to update the values of data fields in a merged document with a script just as you can do with the user interface.
    I don't find any method like "updateDataFields ()" in the DataMerge object.
    Si I try to invoke the menu action "Update Data Fields", but it fails. The script error message is: "Error 53762, the script is not active." On the contrary, the action works if I use the interface.
    Can anyone help me?
    Thanks in advance,
    FredIsnard
    PS : I work with CS5.5 and JavaScript.

    Hi!
    You might be looking for this one:
    DataMerge.mergeRecords (outputOversetReportFile: File )
    Merges records and produces an optional overset report.
    outputOversetReportFile: Data Type: File
    The path to the file in which to store the overset report. (Optional)
    Best regards,
    Andreas

  • How can I update some field values after entering mat. number in purc. req?

    Hi.
    We want Account Assignment Category field to come as "K" for some material numbers. After we enter material number in ME51N screen, if material number is one of our "K" related materials, Account Assignment Category field should be updated automatically as "K".
    Account assignment tab becomes active in item level after entering "K" and we want "cost center" field to be filled in that tab according to given material number.
    These fields can be updated during creating or when saving the purchase requisions. Any suggessions please?
    Regards.

    Hi faramozza ,
    you can achieve this by implementing either customer exit or BADI.
    In purchase requisition context these could be useful:
    Customer Exit:
    MEREQ001
    BADI:
    ME_PROCESS_PR_REQ
    Regards
    REA

  • Document Library document delete using Event Receiver

    Please suggest your solution for the following scenario:
    A user deletes the document from document library and an e-mail has to be triggered to the admin notifying the information about the document deleted recently along with the option to Approve\Reject. If the Admin approves it, the document stays in Recycle Bin
    and if Rejected, the document gets restored to the document library.
    I came across some articles about 'event receiver' which can trigger an e-mail but couldn't find any coding for the recycle bin and deletion. Is there any other workaround to implement the same?

    Hi,
    In that case, Instead of the deleting the file through code, you can send to recycle using the SPFile.Recycle and SP.CopyTo method.
    SPFile Class
    Murugesa Pandian.,SharePoint 2010| MCPD | MCTS - Configure

  • URGENT: Updating FISTL field using BAPI_PO_CHANGE

    HI Friends,
    I am about to update the field FISTL and GEBER in EKKN .
    I am using BAPI_PO_CHANGE to update those fields . I have tried passing the fields to the table
    POITEM  and POACCOUNT in BAPI.
    i have also given the values to POITEMX  and POACCOUNTX tables .
    I have given the BAPI_COMMIT_TRANSACTION also . i have given wait time also . Even then the value is not updated in EKKN table .
    What could be reason for value not getting updated .
    Is the table to which i am passing in BAPI is ok?
    Please help me in this issue , its urgent.
    Reward is sure

    Hi Gokul,
    Try 'BAPI_PO_CREATE1' and see if you can achieve the result.
    *& Report  YDM_PO_CREATE                                               *
    REPORT  ydm_po_create.
    *-- Input File Declaration
    TYPES: BEGIN OF ty_input_file,
           column1 TYPE char50,
           column2 TYPE char50,
           column3 TYPE char50,
           column4 TYPE char50,
           column5 TYPE char50,
           column6 TYPE char50,
           column7 TYPE char50,
           column8 TYPE char50,
           column9 TYPE char50,
           column10 TYPE char50,
           column11 TYPE char50,
           column12 TYPE char50,
           column13 TYPE char50,
           column14 TYPE char50,
           column15 TYPE char50,
           column16 TYPE char50,
           column17 TYPE char50,
           column18 TYPE char50,
    END OF ty_input_file.
    DATA: i_input_file  TYPE STANDARD TABLE OF ty_input_file,
          wa_input_file TYPE ty_input_file.
    CONSTANTS: c_path     TYPE char20 VALUE 'C:\',
               c_mask     TYPE char9  VALUE ',*.*,*.*.',
               c_mode     TYPE char1  VALUE 'O',
               c_filetype TYPE char10 VALUE 'ASC',
               c_x        TYPE char01 VALUE 'X'.
    PARAMETERS : p_fname   LIKE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    *-- Browse Presentation Server
      PERFORM f4_presentation_file.
    START-OF-SELECTION..
    *-- Read presentation server file
      PERFORM f1003_upload_file.
      IF NOT i_input_file[] IS INITIAL.
        PERFORM split_data.
      ENDIF.
    *&                  Form  f4_presentation_file
    *&                F4 Help for presentation server
    FORM f4_presentation_file .
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = c_path
          mask             = c_mask
          mode             = c_mode
          title            = text-001
        IMPORTING
          filename         = p_fname
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " f4_presentation_file
    *&                      Form  f1003_upload_file
    *&                         Upload File
    FORM f1003_upload_file .
      DATA: lcl_filename TYPE string.
      lcl_filename = p_fname.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lcl_filename
          filetype                = c_filetype
          has_field_separator     = c_x
        TABLES
          data_tab                = i_input_file
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ENDIF.
    ENDFORM.                    " f1003_upload_file
    *&      Form  split_data
          Collect data for creating Purchase Order
    FORM split_data .
      DATA: i_poitem        TYPE STANDARD TABLE OF bapimepoitem,
            i_poitemx       TYPE STANDARD TABLE OF bapimepoitemx,
            i_poitem_sch    TYPE STANDARD TABLE OF bapimeposchedule,
            i_poitem_schx   TYPE STANDARD TABLE OF bapimeposchedulx,
            i_acct_***      TYPE STANDARD TABLE OF bapimepoaccount,
            i_acct_assx     TYPE STANDARD TABLE OF bapimepoaccountx,
            i_services      TYPE STANDARD TABLE OF bapiesllc ,
            i_srvacc        TYPE STANDARD TABLE OF bapiesklc,
            i_return        TYPE STANDARD TABLE OF bapiret2,
            wa_header       TYPE bapimepoheader,
            wa_headerx      TYPE bapimepoheaderx,
            wa_poitem       TYPE bapimepoitem,
            wa_poitemx      TYPE bapimepoitemx,
            wa_poitem_sch   TYPE bapimeposchedule,
            wa_poitem_schx  TYPE bapimeposchedulx,
            wa_acct_***     TYPE bapimepoaccount,
            wa_acct_assx    TYPE bapimepoaccountx,
            wa_services     TYPE bapiesllc,
            wa_srvacc       TYPE bapiesklc,
            wa_return       TYPE bapiret2,
            ws_po           TYPE bapimepoheader-po_number.
      break gbpra8.
      wa_services-pckg_no = 10.
      wa_services-line_no = 1.
      wa_services-outl_no = '0'.
      wa_services-outl_ind = c_x.
      wa_services-subpckg_no = 20.
      APPEND wa_services TO i_services.
      wa_srvacc-pckg_no = 10.
      wa_srvacc-line_no = 1.
      wa_srvacc-serno_line = 01.
      wa_srvacc-serial_no = 01.
      wa_srvacc-percentage = 100.
      APPEND wa_srvacc TO i_srvacc.
      LOOP AT i_input_file INTO wa_input_file.
        IF wa_input_file-column2 EQ 'HD'.
          wa_header-doc_type = wa_input_file-column3.
          wa_header-creat_date = sy-datum.
          wa_header-created_by = sy-uname.
          wa_header-vendor = wa_input_file-column4.
          PERFORM conversion_output USING wa_header-vendor
                                    CHANGING wa_header-vendor.
          wa_header-comp_code = 'DE03'.
          wa_header-purch_org = 'DE03'.
          wa_header-pur_group = 'DE1'.
          wa_header-vper_start = wa_input_file-column9.
          wa_header-vper_end = wa_input_file-column10.
          wa_headerx-comp_code = c_x.
          wa_headerx-doc_type = c_x.
          wa_headerx-creat_date = c_x.
          wa_headerx-created_by = c_x.
          wa_headerx-vendor = c_x.
          wa_headerx-purch_org = c_x.
          wa_headerx-pur_group = c_x.
          wa_headerx-vper_start = c_x.
          wa_headerx-vper_end = c_x.
        ENDIF.
        IF wa_input_file-column2 EQ 'IT'.
          wa_poitem-po_item = wa_input_file-column3.
          wa_poitem-short_text = wa_input_file-column6.
          wa_poitem-plant = wa_input_file-column8.
          wa_poitem-quantity = '1'.
          wa_poitem-tax_code = 'V0'.
          wa_poitem-item_cat = 'D'.
          wa_poitem-acctasscat = 'K'.
          wa_poitem-matl_group = wa_input_file-column7.
          wa_poitem-pckg_no = '10'.
          APPEND wa_poitem TO i_poitem .
          wa_poitemx-po_item = wa_input_file-column3.
          wa_poitemx-po_itemx = c_x.
          wa_poitemx-short_text = c_x.
          wa_poitemx-plant = c_x.
          wa_poitemx-quantity = c_x.
          wa_poitemx-tax_code = c_x.
          wa_poitemx-item_cat = c_x.
          wa_poitemx-acctasscat = c_x.
          wa_poitemx-matl_group = c_x.
          wa_poitemx-pckg_no = c_x.
          APPEND wa_poitemx TO i_poitemx.
          wa_poitem_sch-po_item = wa_input_file-column3.
          wa_poitem_sch-delivery_date = sy-datum.
          APPEND wa_poitem_sch TO i_poitem_sch.
          wa_poitem_schx-po_item = wa_input_file-column3.
          wa_poitem_schx-po_itemx = c_x.
          wa_poitem_schx-delivery_date = c_x.
          APPEND wa_poitem_schx TO i_poitem_schx.
          wa_acct_***-po_item = 10.
          wa_acct_***-serial_no = 01.
          wa_acct_***-gl_account = '0006360100'.
          wa_acct_***-co_area  = '1000'.
          wa_acct_***-costcenter = 'KC010000'.
          APPEND wa_acct_*** TO i_acct_***.
          wa_acct_***-po_item = 10.
          wa_acct_***-serial_no = 02.
          wa_acct_***-gl_account = '0006360100'.
          wa_acct_***-co_area  = '1000'.
          wa_acct_***-costcenter = 'KC010000'.
          APPEND wa_acct_*** TO i_acct_***.
          wa_acct_assx-po_item = 10.
          wa_acct_assx-serial_no = 01.
          wa_acct_assx-po_itemx = c_x.
          wa_acct_assx-serial_nox = c_x.
          wa_acct_assx-gl_account = c_x.
          wa_acct_assx-co_area  = c_x.
          wa_acct_assx-costcenter = c_x.
          APPEND wa_acct_assx TO i_acct_assx.
          wa_acct_assx-po_item = 10.
          wa_acct_assx-serial_no = 02.
          wa_acct_assx-po_itemx = c_x.
          wa_acct_assx-serial_nox = c_x.
          wa_acct_assx-gl_account = c_x.
          wa_acct_assx-co_area  = c_x.
          wa_acct_assx-costcenter = c_x.
          APPEND wa_acct_assx TO i_acct_assx.
          wa_services-pckg_no = 20.
          wa_services-line_no = 2.
          wa_services-service = wa_input_file-column9.
          wa_services-quantity = '100'.
          wa_services-gr_price = '100'.
          wa_services-userf1_txt = wa_input_file-column13.
          APPEND wa_services TO i_services.
          wa_srvacc-pckg_no = 20.
          wa_srvacc-line_no = 1.
          wa_srvacc-serno_line = 02.
          wa_srvacc-serial_no = 02.
          wa_srvacc-percentage = 100.
          APPEND wa_srvacc TO i_srvacc.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader                     = wa_header
          poheaderx                    = wa_headerx
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
      POEXPIMPHEADER               =
      POEXPIMPHEADERX              =
      VERSIONS                     =
      NO_MESSAGING                 =
      NO_MESSAGE_REQ               =
      NO_AUTHORITY                 =
      NO_PRICE_FROM_PO             =
       IMPORTING
         exppurchaseorder             = ws_po
      EXPHEADER                    =
      EXPPOEXPIMPHEADER            =
       TABLES
         return                       = i_return
         poitem                       = i_poitem
         poitemx                      = i_poitemx
      POADDRDELIVERY               =
         poschedule                   = i_poitem_sch
         poschedulex                  = i_poitem_schx
         poaccount                    = i_acct_***
      POACCOUNTPROFITSEGMENT       =
         poaccountx                   = i_acct_assx
      POCONDHEADER                 =
      POCONDHEADERX                =
      POCOND                       =
      POCONDX                      =
      POLIMITS                     =
      POCONTRACTLIMITS             =
         poservices                   = i_services
         posrvaccessvalues            = i_srvacc
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POEXPIMPITEM                 =
      POEXPIMPITEMX                =
      POTEXTHEADER                 =
      POTEXTITEM                   =
      ALLVERSIONS                  =
      POPARTNER                    =
      break gbpra8.
      LOOP AT i_return INTO wa_return.
      ENDLOOP.
    ENDFORM.                    " split_data
    *&      Form  conversion_output
          Conversion exit input
    FORM conversion_output  USING    p_ip
                            CHANGING p_op.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = p_ip
        IMPORTING
          output = p_op.
    ENDFORM.                    " conversion_output
    <b>Reward points if this helps.
    Manish</b>

  • Add an item into announcement list in site collec. and repeat the same in all the sub webs' announcement list without using event receiver

    hi,
    I have a requirement: in my site collection i have an announcement list. and in my site collection  some 600+ sub sites exist. sharepoint admin uploads an announcement into this rootweb's announcement list. now is there any way
    i can add the same announcement -which has title, description, date time etc .- to all the 600+ sub sites' announcement list?
    i know , if i write a list item event receiver i will be able to iterate through eacha nd every subweb of my site collec and add this item into those sub web's  announcement list. But, without writing an event receiver and creating and deploying
    another wsp and avoiding all those headache, is it possible to achieve this requirement?
    any other approaches are highly appreciated!

    Hi,
    As a workaround, we can create a winform application for admin use only to add the item to all the sub web's announcement list.
    Developing Sharepoint Windows Forms
    http://www.codeproject.com/Tips/566370/Developing-Sharepoint-Windows-Forms
    Best Regards,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Unable to update a field using the Data tab on a VIEW

    When viewing data using a VIEW instead of going to the table directly, am unable to change the values in any of the fields
    When I click on the list of VIEWs for a schema, then select a view that is based on a SELECT statement for a single table with a Primary key, and then click on the DATA tab to modify the value in one of the fields, SQL Developer does not allow me to change the value.
    Went into SQL Plus, and was able to execute an UPDATE statement against the same row of that VIEW, and update that field ("UPDATE vw_mytable SET thisfield = 'YES' WHEN row_id_number = 1'").
    Does SQL Developer not allow updating tables through a VIEW?
    Will it allow updating in the future? Please say yes.
    Oracle 10g DB and latest version of SQL Developer.

    Remember to add feature requests and vote on them on the SQL Developer Exchange!
    <br>
    <p>We have added updateable views to 1.1, but do remember, not all views are updateable - even in SQL*Plus.</p>
    <br>
    Sue

Maybe you are looking for