Not getting previous value of List in itemUpdated event receiver

 I have scenario that if i update any item in a listA(in sitecollection1) it should update in another listB(sitecollection2)..
I am using beforeproperties it is throwing null value..
 but i need that previous value of listA which i have updated just now in "itemupdated" event receiver
here is my code
 public override void ItemUpdated(SPItemEventProperties properties)
            base.ItemUpdated(properties);
            using (SPWeb web = new SPSite("http://natex2:1990/sites/ess/facilities/spaces").OpenWeb())
                web.AllowUnsafeUpdates = true;
                SPList list = web.Lists.TryGetList("LocationDetails");
                 //string querry = properties.ListItem["Title"].ToString();
                 string querry = properties.BeforeProperties["Title"].ToString();
                SPQuery qury = new SPQuery();
                qury.Query = "<Where><Eq>" +
                    "<FieldRef Name='Title' />" +
                   "<Value Type='Text'>" + querry + "</Value>" +
                  "</Eq>" +
                  "</Where>";
                SPListItemCollection coll = list.GetItems(qury);
                foreach (SPListItem item in coll)
                    string data = properties.AfterProperties["Title"].ToString();
                    item["Title"] = data;
                    list.Update();
                web.AllowUnsafeUpdates = false;
please anybody help me i need urgent help

Are you working with a list or a library? In a list, you will need to handle the synchronous (ItemUpdating) event instead of the asynchronous (ItemUpdated) event in order to access the original value...but there's a catch!
As per the table in
this post, the BeforeProperties hashtable is not populated for list items. You can, however, access the original value using
properties.ListItem (the line you have commented out above) in the
ItemUpdating event.
Confusing, I know...but hopefully that helps!
Danny Jessee
MCPD - SharePoint Developer 2010
MCTS - SharePoint 2010, Configuring
dannyjessee.com/blog

Similar Messages

  • 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

  • TSQL Get Previous values for each group by

    Dear Friends,
    I have a problem with my TSQL statment. 
    I need to get previous value for each day and specific unit. Everything goes fine if I have always 2 unit in each day. But if same day has just one unit or less, I cannot have the previous value in the current record.
    The Output is this one:
    SK_DAY SK_UNIT
    VALUE VALUE_PREVIUS_DAY
    20131112 2
    30.00 NULL
    20131112 3
    34.00 NULL
    20131113 2
    40.00 30.00
    20131113 3
    45.00 34.00
    20131114 2
    50.00 40.00
    I dont have the second record for 2013-11-14, because in this date I just have value for unit 2.
    The final output should include the record:
    20131114 3
    0 45.00
    The Statment I have is:
    SELECT MAIN.SK_DAY, MAIN.SK_UNIT, SUM(MAIN.VALUE) AS VALUE
     SELECT SUM(VND1.VALUE) AS VALUE
     FROM FCT_TEST VND1
     WHERE CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))>=DATEADD(dd,-1,CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY)))
    AND CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))<CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY))
    AND VND1.SK_UNIT=MAIN.SK_UNIT
    ) AS VALUE_PREVIUS_DAY
    FROM FCT_TEST MAIN
    GROUP BY SK_DAY, MAIN.SK_UNIT
    SQL CREATE SCRIPT:
    CREATE TABLE [dbo].[FCT_TEST](
    [SK_DAY] [int] NOT NULL,
    [SK_UNIT] [int] NOT NULL,
    [VALUE] [decimal](18, 2) NULL,
     CONSTRAINT [PK_FCT_TEST] PRIMARY KEY CLUSTERED 
    [SK_DAY] ASC,
    [SK_UNIT] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Thank you!!!
    PPSQL

    Thank you Kalman,
    But my problem is not with date! Fortunately I have dates for all days.
    The problem is for dimension tables like UNITS that I dont have values for all days, and when I try to get the previous value for previous day and each unit I dont have records. 
    20131112
    2
     30.00
    NULL
    20131112
    3
     34.00
    NULL
    20131113
    2
     40.00
    30.00
    20131113
    3
     45.00
    34.00
    20131114
    2
     50.00
    40.00
    20131114
    3
     0
    45.00 [I NEED THIS RECORD AS IS]
    Could you help me??
    Thank you!!

  • Get column values from list of values programmatically

    hi all
    how i get column values from list of values programmatically in the
    returnPopupDataListener method

    If this answers your question , please close this thread by marking it as answered.
    Thanks

  • Hi I  newly started using Iphone 6, I am not getting all the applications list under Use Cellular date for to restrict my unwanted apps on cellular data

    Hi I  newly started using Iphone 6, I am not getting all the applications list under Use Cellular date for to restrict my unwanted apps on cellular data
    Please help me out

    Hi Rajesh778484,
    Welcome to the Apple Support Communities!
    I understand that some of your applications are not appearing under Settings > Cellular on your iPhone so that you can restrict or allow use of cellular data. If you have some installed applications on your iPhone that are not showing here, the first troubleshooting step I would suggest would be to reset your iPhone. Please refer to the attached article for information on how to perform a reset. 
    Restart or reset your iPhone, iPad, or iPod touch - Apple Support
    Best regards,
    Joe

  • Not getting field value in Input field of field exit

    Hi all
       I  am using field exit for data element GWLDT in transaction code IE02. But in this field exit I am not getting the value entered in the field "Begin guarantee date(GWLDT)" in the INPUT field of field exit.How I can get the value in the INPUT field of field exit?
    Regards
    Deepak

    Use this statement in source code.
    output = input.

  • JPA Error:Could not get a value to be injected from the factory

    HI friends ,
    I am  trying to replicate the example JPAEXample01 using JPA in CE1 from  the blogs written by
    Sabine Heider/Adrian Görler.
    During the testing of the method create employee i am getting the following error.
    "Could not get a value to be injected from the factory."
    I tried couple of examples using the above process, still held up with same error.
    Any pointers to trouble shoot this ?
    Thanks in advance
    Chandra Dasari

    HI Isaias Cristiano Barroso,
    There are lot of enries most of them pertaining to properties set to yes or no.
    out of which therre are tow errors. the log is as follows
    Message Info: Failed (javax.management.MBeanPermission,#[:j2eeType=trace,name=EndToEndCentralMBean,],isActive,getGuidByName,getTraceLevelByName,getTraceLevelByName,importTrace,isFileExistsLocally,removeTraceFile)java.lang.reflect.InvocationTargetException
    Failed (javax.management.MBeanPermission,*,DISPLAY)java.lang.reflect.InvocationTargetException
    category: com.sap.security.core.role.PermissionData
    Location:com.sap.security.core.role.PermissionData.get(ClassLoader)
    Frankly the above log is above my understanding ,Prob it may help to you undertand my the issue
    Thanks once again

  • JAPEXample01 published in sdn:error Could not get a value to be injected

    HI friends ,
    I am  trying to replicate the example JPAEXample01 using JPA in CE1 from  the blogs written by
    Sabine Heider/Adrian Görler.
    During the testing of the method create employee i am getting the following error.
    "Could not get a value to be injected from the factory."
    I tried couple of examples using the above process, still held up with same error.
    Any pointers to trouble shoot this ?
    Thanks in advance
    Chandra Dasari.

    HI Pritya Ranjan,
    Let me know the entities  and their relations ships you are using for quicker response.
    To know the proper error, use the path as mentioned
    nwa->problem management ->logs & traces->locks.
    Email the error code,
    The issue might be because of some many probabilities mentioned below.
    Point no 1
    Are you using Named queries  : If so check the queries syntax, the syntax used here is different from regulat sql queries.
    Point no 2:
    Are you using Java DIctionary  or generic  db and connecting to max db?
    check this part also
    Point no 3:
    Check your connection profile parameters:
    Point no 4 :
    Check the data-source-alias,persistence.xml and data-source.xml parameters..
    Beacuse i trouble shooted a lot on JPA's and found why the typical error's occurs.
    Regards
    chandra dasari

  • I can not get link-value  from af:tree.

    Hello.
    I use jdeveloper 10g.
    I can not get link-value from tree.
    I use following code:
    <f:facet name="nodeStamp">
    <h:panelGroup binding="#{backing_dialogDic_dic_ETS.panelGroup1}"
    id="panelGroup1">
    <h:outputText value="#{item.vidNum} #{item.vidName}"
    binding="#{backing_dialogDic_dic_ETS.outputText1}"
    id="outputText1"/>
    <af:commandLink
    binding="#{backing_dialogDic_dic_ETS.commandLink2}"
    id="commandLink2"
    action="#{backing_dialogDic_dic_ETS.returnObject}">
    <af:setActionListener from="#{item.idVid}"
    to="#{processScope.ETSId}"/>
    <af:objectImage source="/images/icons/10.gif"
    shortDesc="Выбрать"
    binding="#{backing_dialogDic_dic_ETS.objectImage2}"
    id="objectImage2"/>
    </af:commandLink>
    </h:panelGroup>
    </f:facet>
    </af:tree>
    //in java bean:
    public String return_Object() {
    Object ob = JSFUtils.getManagedBeanValue("processScope.ETSId");
    System.out.println(o);
    return null;
    In console I see null.
    How I get this value???
    I can get this value if i use treeTable instead of tree.
    Thx, Dema.

    Hi,
    not that I think it matters, but the processScope is not a managed bean but a memory scope. So if
    JSFUtils.getManagedBeanValue("processScope.ETSId");
    assumes a managed bean then this may be incorrect as most likely there exist no managed bean with this name. You should be able to access the process scope from AdfFacesContext.getProcessScope(), which then returns a Map, which you call get("ETSId") on
    Frank

  • Object - MLST_NETW container not getting the values?

    Hi,
    I created a custom FM for the object -  MLST_NETW and event STARTED 
    and in the workflow container  I created Element for this object - by selecting Obect type  - MLST_NETW
    Now the problem is - When we do status change in tcode - CJ20N it is triggering the custom worklfow but in the worklfow container it is not getting any values.  Container fields are empty.  I need to get the project defination field value to the workflow.
    Can any one tell me what could be wrong?
    Thanks in advance.
    M.

    Hi Murali,
    Yes. Binding for event to workflow not defined.
    For that, press Ctrl + F8 in the workflow template then it will take you to verision dependent tab. There you can find the start events tab.
    Here only you entered the Business object and event. Right? So there one button is there for binding. CLick on it and check whether event to workflow binding has done or not.
    Event container EVT_OBJTYPE should binded with your workflow business object.
    Thanks.

  • Not getting any value in my method

    Hi,
            I wnat to use  attributes value Company code in my custom method in the BUS ZZBUS2081 . company code is key field of another BUS  BUS0002. For that I am using  swc_get_element CONTAINER 'CompanyCode' COMPANYCODE. but when I am executing BUS zzbus2081,attributes value is populated but i am not getting this value in my custom method. please help.

    You can try to do some thing like this
    1. First if you want to access the key element of the BOR then first import the instantiated BOR from which you want to access the attributes.
      In your case it is BUS0002
    DATA:    lv_obj    type swc_object.
    swc_get_element container '<name of the instantiated BOR>' lv_obj.
    2.once you have the instantited bor element in the Mehtod then make use of the macro
    SWC_GET_PROPERTY
    please check the below snippet
    swc_get_element  container     '_Workitem'          lv_wi_object.
    swc_get_property lv_wi_object  'Workitemid'         lv_wiid.

  • OWHS table not getting any value in PLD

    I am trying to make a pld in which i want to pull the database table owhs and place the warehouse address i am not getting any value in the PLD however there is adress in the ware house field still its not getting me any result
    Please help
    Regards,
    manish

    Hi Manish....
    Even if you get the OWHS table you wont get the address format as you desire. That is complete concatenated address. It will be like city, street, country like that.....
    Regards,
    Rahul

  • Coding best practice display name vs internal name in itemUpdated event receiver

    Hi,
    In an itemupdated event receiver, when referring to list fields, is it better to use the field's internal name, or its display name?
    Is there a clear guideline or best practice, or is this a subjective discussion?
    Thanks in advance for your replies

    Hi Jorge,
    One of the best practice I follow is Repository pattern for list access, on that scenario I always use Internal Names.
    The rational behind this decision is Fristly, I will have full control, Secondly I need not to worry about column names changes by business/endusers through SharePoint UI which I cannot control of. Though we had governance in place and trained
    the users, still no avail, users will go and change the column names. 
    Thirdly, My code will not break when there is a display name change. One of my client was too UI rather than business logic, since the enduser are high profile managers, spacing between columns and readabiltily are first class citizen.  Those changes
    that we made to the list library did not affect our code and the application was running without code refactoring.
    Backto your question, I will use Internal names in my CAML query to minimize error as follows
    item["internalName"]
    Your question is subjective, I have not seen any best practices on this subject, being said that, if you are looking for best practice and guidance I would suggest you to start here -
    SharePoint 2010 Guidance
    http://msdn.microsoft.com/en-us/library/ff770300.aspx ( no idea on SP 2013 guidance availablity)
    Go through the code and doc, You will get the design rational behind each choice.
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • How to Get checkbox value when List value changed in classic report

    hi ,
    i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
    take value of checkbox item and show it in message .
    SQL for report
    SELECT
    '<INPUT TYPE="checkbox" NAME="f01" VALUE="'
    ||SEQ
    ||'">' SEQ,
    ID,
    DEPT_NO,
    EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
    now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
    i create JavaScript on the page
    function test(pThis) {
    var f01_value = $('select[name="f01"]').value;
    alert('#SEQ : '+ f01_value);
    </script>
    I call this javascript function when list change but the value undefined..
    My Question :
    How can get this value Or any value of item in reports
    regards
    Ahmed

    Hi Ahmed,
    >
    i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
    take value of checkbox item and show it in message .
    SQL for report
    SELECT
    '<INPUT TYPE="checkbox" NAME="f01" VALUE="'
    ||SEQ
    ||'">' SEQ,
    ID,
    DEPT_NO,
    EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
    >
    You should not create checkboxes like this. Either use the APEX_ITEM.CHECKBOX2 API or change the Column Type to Simple Checkbox.
    >
    now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
    i create JavaScript on the page
    function test(pThis) {
    var f01_value = $('select[name="f01"]').value;
    alert('#SEQ : '+ f01_value);
    </script>
    >
    name="f01" returns an array, what you need is single element value.
    Try
    <script type="text/javascript>
    function test(pThis) {
      var f01_value = $v(pThis);
       alert('#SEQ : '+ f01_value);
    </script>
    {code}
    {quote}
    I call this javascript function when list change but the value undefined..
    My Question :
    How can get this value Or any value of item in reports
    {quote}
    Depends in how you are invoking/triggering the change event. Are you using DA or have you written an "onchange" event on the element?
    Cheers,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • PPR event getting previous value

    Hi
    There is a PPR event on a standard text box. I am handling PPR event in my custom CO. Whenever I change the value abd tab out of the text box I get the previous value not the current(changed) value.
    ExpenseReportLinesVORowImpl expensereportlinesvorowimpl = (ExpenseReportLinesVORowImpl)expensereportlinesvoimpl.getCurrentRow();
    please help
    Thanks

    Hi,
    Here are three different ideas:
    (1) Copy the current row into a local RECORD variable inside the loop.
    (2) Do a self-join in the query, so that the cursor itself has the previous and current rows. (If necessary, use the analytic ROW_NUMBER function to number the rows so you can do the self-join correctly.)
    (3) Use the analytic LAG function to copy the necesssary columns from the previous row in the query.

Maybe you are looking for

  • Show sum column item Report in another item TEXT ?

    I have a report region to the query "select * from emp" and would like to display the sum of the salt field in another item using the TEXT APEX_APPLICATION.G_F01 rather than run the querie again without using a submit button, or whenever to have a pa

  • Decode with multiple column sub query

    Dear's What is the wrong with the query select * from common_master where (company_code,lpad(rtrim(ltrim(bu_code)),12,' ')) IN decode ('ADMIN','ADMIN',(select company_code ,lpad(rtrim(ltrim(bu_code)),12,' ') from common_master ) ,(select company_code

  • Has anyone found a solution to Error 1009?

    TypeError: Error #1009: Cannot access a property or method of a null object reference Ok. I'll simplify my code so that the problem can be better understood. I have a main.as class at the document root. Here I have a property bb:bigBox = new bigBox()

  • Using font.properties to map custom in-house true type fonts

    Hi all, I'm currently attempting to get Forms Server to display a custom fonts called TH Sans Serif which is MS Sans Serif modified for our special needs. We need to show a whole array of fonts which caters for Rumanian, Hungarian, Polish, Slovak, We

  • Crm table names required

    Hi i want to get all the activities/leads/opportunities id's for particular sales org created in last 6 months could u please kindly suggest how can i develop quickviewr query (SA38)and what are the table name that i should use for linking to extract