Set field value in Discussion Board Reply

Hi all,
I need to set the value of a field in all discussion board replies within a discussion. In my example, I need to pass a value from the discussion board item to all of the replies (ex. when a reply is made, I want a field named "Project Number" to be populated
by the Project Number set when a Discussion is created). I need this so I can email out varying users related to the Project Number.
Thanks,
Kelly
Personal Blog: http://thebitsthatbyte.com

Hi
SPQuery query = new SPQuery();
query.Folder = discussItem.Folder;
SPListItemCollection replyCollection = ctxList.GetItems(query);
foreach (SPListItem itemReply in itemCollection)
itemReply["FIELD_TO_UPDATE"] = VALUE;
itemReply.SystemUpdate(false);
discussionItem: is a discussion item
ctxList: is a current discussion list
If there are many reply items need to be update, please build an update string and use BatchUpdateProcess command to perform update with best performance.
Hope this help.
Visit my blog: My Blog | Visit my forum:
SharePoint Community for Vietnamese |
Bamboo Solution Corporation

Similar Messages

  • Setting Fields value via reflection

    I'm starting from a c# code:
              internal void RefreshFromObject(object objFromUpdate)
                   if (this.GetType()==objFromUpdate.GetType())
                        PropertyInfo[] fieldsFrom = objFromUpdate.GetType().GetProperties();
                        PropertyInfo[] fieldsThis = this.GetType().GetProperties();
                        for(int idxProp=0; idxProp<fieldsFrom.Length;idxProp++)
                             if (fieldsThis[idxProp].CanWrite && fieldsFrom[idxProp].CanRead)
                                  fieldsThis[idxProp].SetValue(this, fieldsFrom[idxProp].GetValue(objFromUpdate,null),null);
                   else
                        throw new ObjectTypeNotValidException("Object type from which update current instance not valid. Use same type.");
    Now I have to translate it in Java:
    Class clazz = objFromUpdate.getClass();
    Class thisClazz = this.getClass();
    do {
         Field[] fieldsFrom = clazz.getDeclaredFields();
         Field[] fieldsThis = thisClazz.getDeclaredFields();
         try {
              fieldsThis[idxProp].set(thisClazz, fieldsFrom[idxProp].get(clazz));
         catch (IllegalAccessException iaccEx) {
              System.out.println("IllegalAccessException");
         catch (IllegalArgumentException iaccEx) {
              System.out.println("IllegalArgumentException");
    clazz = clazz.getSuperclass();
    thisClazz = thisClazz.getSuperclass();
    } while (clazz != null && clazz != Object.class);
    My problem is that I don't know if the field type is one of primitive, for which I should use the particular setters and getters.
    My questions are:
    1) is there in Java a more elegant way to set fields values via reflection?
    2) how can I know if a field i changable (equivalent to the method CanWrite of c#?
    Thanks a lot to each one that will answer me.
    Marco

    Hi georgemc,
    thanks for replying. I-m new with java forum, so I don't know if it is correct the code tags...
    Anyway... the problem is that the Field of reflected object could be both of Object types or primitive types. So I cannot use the general method "set" when changing Field's value.
    Maybe somebody else had the same problem...
    Seems in C# it is a very easy thing... not in java :(
    Marco
    Class clazz = objFromUpdate.getClass();
    Class thisClazz = this.getClass();
    do {
    Field[] fieldsFrom = clazz.getDeclaredFields();
    Field[] fieldsThis = thisClazz.getDeclaredFields();
    try {
    fieldsThis[idxProp].set(thisClazz, fieldsFrom[idxProp].get(clazz));
    catch (IllegalAccessException iaccEx) {
    System.out.println("IllegalAccessException");
    catch (IllegalArgumentException iaccEx) {
    System.out.println("IllegalArgumentException");
    clazz = clazz.getSuperclass();
    thisClazz = thisClazz.getSuperclass();
    } while (clazz != null && clazz != Object.class);

  • How to set field value in workflow SPD2013?

    Hi All,
    how to set field value in workflow SPD2013? Actually using Infopath, i need to update a field value through workflow.(Little differnt from SPD2010). How to do this?

    As Amit says, some elaboration here would be good.  You can use InfoPath as a form for either a list or a library and then set it to trigger a workflow upon item creation.  The workflow will consist a number of actions, one of which is the Update
    Field Item.
    More information on the available steps can be seen here.
    http://msdn.microsoft.com/en-us/library/office/jj164026.aspx
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • HELP - i can't set field value in a form

    Hi,
    I created a form based on a stored procedure.
    I try to set a field value on this form( the name of the item in the wizard is 'P_GG') from the advanced PL/SQL SECTION in the wizard, and, for exact, in "... before displaying the page..." i wrote:
    p_session.set_value(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_P_GG',
    p_value => '20');
    But when I run the form the field is blank
    Thank for everyone reply and help me.
    Simone Mancino

    Dmitry,
    thank u for your reply.
    I tried your solution, but there is another problem. I specified a default value for the form, using the syntax "#myfunction()".
    The first time I run the form, i get the correct value. But whenever i run the form again in the same session, I always get the FIRST value: it looks like the function is not evaluated again. For example, suppose the function is
    return to_char(SYSDATE, 'SS')
    (just to have a random dynamic value);
    you always get the value of the first run, even if you refresh the page.
    Regards
    Simone

  • How to Set Field value using javascript?

    I have a Field in First Page called 'SO'. I want to populate this field from the field value of SD_ITEMS.DATA.VBELN first row in the each page. Please help me with javascript to set this value.
    Thank you.
    Ranji

    I have a Field in First Page called 'SO'. I want to populate this field from the field value of SD_ITEMS.DATA.VBELN first row in the each page. Please help me with javascript to set this value.
    Thank you.
    Ranji

  • Setting field value from antother field

    I am having problems setting the value of a field depending on the entry of a previous drop down field.
    I am creating some wizard pages. On one page i wish a drop down list to populate another field. The drop downlist is unbound. (I have tried doing this with bound field aswell). To do this I have the Depends on Item of the target field to depend on the dropdown list field, so that the appropriate values are updated. (i have tried with the target field being bound and unbound aswell not that it should matter).
    I have then updated the VO (view object) adding transient fields when the fields are unbound. Then i updated the view row class. The setter of the drop down field was used to set the value of the target field. (Using the setter of target field). I added system.out.println and the fields are called and set accordingly. ie getters and setters are correct.
    However when i run the screens the target field value is not set with the value within the getter of target field.
    Could you advice if this is a bug or whether i should be coding this in a different manner. (if it is a bug and you tell me when it is likely to be fixed and any alternative work arounds).
    Cheers
    Alan

    Alan,
    Not really a bug, but "missing functionality". The problem is that ADF Faces will only refresh a UI Component value from the underlying model binding value when you submit the request with immediate="false", OR when you explicitly call resetValue() on the component.
    We have added a new boolean item-level property "Clear/Refresh Item When Depends-On-Item Changes" in the latest build.That property will do the trick for you: it will clear the value and call resetValue on the UI Components of the dependent items, BEFORE the depends-on-item model value is updated. So, in your case, the setter method of your depends-on-item attribute will update your dependent item after JHS cleared the item, and you will see the new value right away because UIComponent.resetValue() was called as well.
    Steven Davelaar,
    JHeadstart Team.

  • Set Field value

    I have placed several fields in my form. I want to set the value of those fields through code. How do i do this. Under what trigger do I have to write this code? It would be helpful if you could be a bit specific as I'm really new to Reports.

    Something like this ? (in general)
    - In your data model create your query from CASES table.
    - Use layout wizard to do the layout (for example)
    - for example you need an additional column that is something like calculation that can't be done using sql query, then create a formula column in your data model.
    - click properties for that formula column,change the data type and width accordingly.
    - click pl/sql formula, enter your calculation there.
    - put your new fields in the layout model.
    You can tell me which one you need me to explain in details.

  • Set field value problem

    Hi All,
    I want to set a field value of a class. I do this in the way of modifying codes in getText() method in XXXItemProvider.java as the red frame in the following picture.
    It generates the following problem
    But, if I remove the codes, "(NFRSoftgoal)object.setLabel......", it becomes normal.
    Can anyone help me solve the problem?
    Thanks & Regards,

    Comments below.
    On 17/07/2015 7:19 PM, Shin-Yi Lin wrote:
    > Ed Merks wrote on Fri, 17 July 2015 12:28
    >> Comments below.
    >>
    >> On 17/07/2015 4:40 AM, Shin-Yi Lin wrote:
    >>> (1) My model structure (I want to change label attribute.):
    >> So the label feature is on a class that's the root of a several other
    >> classes...
    >> ----> Yes.
    >>>
    >>> (2.1) Before (Child and parent clouds are undecided. Cloud represents NFRSoftgoal class.):
    >> This undecided thing is the default state...
    >> -----> That's right.
    >>>
    >>> (2.2) After (After child cloud changes to satisfy through command, parent cloud changes to satisfy automatically.)
    >> Is this via a command that directly modifies the label feature of the
    >> "child"? If so, that's the place to modify the state of the parents,
    >> e.g., using a compound command that modifies the child as normal, and
    >> walks up the parents to modify the parent label also using commands.
    >> What, if anything, prevents the "parent" label from being directly
    >> changed back to undecided (which is perhaps an inconsistent state for
    >> the model)?
    >> -----> I change the label feature of "child" through the red frame in the following pictures (This is under run-time application and Sirius environment.):
    >>
    >>
    >> -----> But I don't want to change the label feature of "parent" through the same way, because it should be automatically changed, not manually.
    I'm asking what's preventing that from happening? I suppose it doesn't
    matter if you've done something so that only a leaf/child can be
    directly modified.
    >> That's why I modified the code of getText( Object object) function in NFRSoftgoalItemProvide.java under bpmn.edit.
    That's not a good idea.
    >>
    >>
    >>
    >> -----> What do you mean "via a command" ? I don't know how to change via a command. Could you explain or give any reference for it?
    On the child, the set command is created by
    org.eclipse.emf.edit.provider.ItemProviderAdapter.createSetCommand(EditingDomain,
    EObject, EStructuralFeature, Object) so you can specialize this method
    of the child's item provider so that it modifies not only the child's
    label feature, but modifies also the parents. All that could be done
    with a CompoundCommand that composes all the SetCommands.
    >>
    >> Thanks & Regards,
    >>

  • Set field value whiel calling MM12

    How Can I set the value of Schedule data to some value.
    I am calling MM12 with material Number and Date.
    I can set the material Number because it has parameter ID. How can I set the value of schedule date ?. it doesn't have parameter ID. Schedule date is mandatory field.
    I need to call the MM12 Skip first screen.

    Do you think that you can use a partial BDC?
    report zrich_0003
           no standard page heading line-size 255.
    data: bdcdata type table of bdcdata with header line.
    data: bdcdate(10) type c.
    parameters: p_matnr type mara-matnr,
                p_datum type sy-datum.
    start-of-selection.
      call function 'CONVERT_DATE_TO_EXTERNAL'
           exporting
                date_internal = p_datum
           importing
                date_external = bdcdate.
      perform bdc_dynpro      using 'SAPLMGMM' '0060'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RMMG1-AEDAT'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'RMMG1-MATNR'
                              p_matnr.
      perform bdc_field       using 'RMMG1-AEDAT'
                              bdcdate.
      call transaction 'MM12' using bdcdata mode 'E'.
    *        Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      append bdcdata.
    endform.
    *        Insert field                                                  *
    form bdc_field using fnam fval.
      clear bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      append bdcdata.
    endform.
    Regards,
    Rich Heilman

  • Start workflow after discussion board reply

    I am trying to get a workflow to start when someone replies to a discussion board but it does not seem to work.  If I start the workflow manually it runs fine, but not when an item is changed.  Furthermore, when someone replies to a discussion
    board it doesn't really even seem to change the list item itself.  It's almost as if there are List items (Discussion Board Subjects) and then some sort of sub-list item that contains all the replies.
    How does this work?  I am able to run workflows on other custom lists, but discussion boards seem to be a little different than a regular list.
    Thanks.

    The discussion boards use a couple of different content types, and yes they behave very strangely in general.  I found a fix to your problem:
    In SharePoint Designer, create a new reusable workflow, and associate it with the "message" content type.  All discussion board replies are that content type.
    Build out your workflow to send an email or whatever it needs to do, and publish it.
    In your list settings of the discussion board, click on the name of the "message" content type and choose workflow settings.
    Click "add a workflow" and choose the name of the workflow you just created.  Then you can choose whether you want it to run on create or whatever.
    I just did this and it triggered correctly.
    Good luck!
    Laura Rogers, MCSE, MCTS
    SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/laura
    Twitter: WonderLaura
    Beginning SharePoint 2010: Building Business Solutions with SharePoint

  • Create an outlook form for a discussion board

    We need to create a new form or use the existing IPM.Post class and create a form along with few custom fields in our discussion board.
    Any user entry to that custom field in outlook should be posted to the list in the appropriate field.
    How do we achieve this.

    Hi,
    Do you want to create a form for a discussion board list as below?
    If so, we can customize it using InfoPath 2010 and publish the form to the discussion board list, the following article for your reference:
    http://msdn.microsoft.com/en-us/library/gg180738(v=office.14).aspx
    If I misunderstand your requirement, please provide more information.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • "One or more field types are not installed properly" when I try to add a second discussion board web part to a page

    I have a SharePoint 2010 site with two discussion boards. I added one additional field to each of the boards: a lookup to another list to link the discussions to individual projects. I need 2 different boards because they have different posting permissions
    (one is open to all for comments, and one is open only to the project team to post but everyone can read).
    When I go to the pages for each of the discussion boards, they work fine.
    But I'm putting together a page for individual projects, and want to have web parts for both discussion boards on the same page, showing the discussions related to the selected project.
    I am able to add one of the discussion boards to a web part in the page, but when I add the second discussion board to the page, the new web part contains:
    One or more field types are not installed properly. Go to the list settings page to delete these fields.
    Correlation ID: blah blah blah
    I've searched for similar postings, but mostly I see this error message related to migration from 2007 to 2010 -- this is not the case here: I created both discussion boards, and the whole site, in SP 2010. I've also found this message related
    to coding errors using SPQuery. I am not doing any coding here, just using the built-in SharePoint 2010 Edit Page -> add a web part -> select the discussion list.  I tried doing it from SPD with the same result. 

    I figured it out. I was using ?FilterField1=fieldname&FilterValue1=value on the URL to the page to pick out one project number. The web part I was trying to add was for a list that did not have that particular fieldname. I didn't realize that would matter
    since I was using the Connections -> Get Filter Values From to get my filter values from the main web part, which does have that fieldname.
    I added a field with that fieldname to the other list and set a workflow to copy the lookup value of the project number lookup field into the new field. Now all is working fine.  Sorry for the wild geese in my original question.

  • Using Auto Suggest To Set The Value Of Multipe Form Fields

    I would like to use the Spry 1.5 Preview Auto Suggest widget
    to provide the value for multiple form fields based on the row the
    user selects in the auto suggestion data set. I've placed an
    example of what I want to do here:
    http://www.brucephillips.name/spry/Spry_P1_5_Preview/autosuggest/autosuggestMultipleFields .cfm
    It appears that when the user clicks on one of the rows in
    the auto suggestion data set, the current row for the data set is
    not updated but remains the default (first row in the data set).
    Therefore, if you have a spry:detailregion that uses that data set,
    the values for that detail region are from the first row in the
    data set and not the row the user selected.
    Is it possible to set the current row of the auto suggest
    data set to the row the user clicked on in the auto suggestion data
    set so that the spry:detailregion will have the values from the row
    the user clicked on?
    I had previously modified the Spry 1.4 Auto Suggest widget to
    do this. See:
    http://www.brucephillips.name/blog/index.cfm/2006/11/6/Modifing-Sprys-Auto-Suggest-Widget- to-Bind-Users-Selection-to-A-Form
    Thank you for any assistance.

    Cristian: thank you for the reply. I understand your concern
    about the user changing the auto suggest field after updating the
    complimentary fields. I think that could be handled through user
    instruction. Additionally, instead of using form fields to hold the
    complimentary data I could use non-editable paragraphs.
    I hope the change is not too difficult. I think this
    modification would make the auto suggest widget even more useful.
    For example think about a product auto suggest. User starts to type
    in the name of the product, selects the full product name from the
    auto suggestions, and now the page can immediately show in a
    spry:detailregion all the product details.
    Thanks again for considering my request. I really appreciate
    all the work the Spry team is doing. I'm looking forward to the
    official release of Spry.

  • Set field default value

    Hallo everybody!
    at the moment I need to set a few default values into WebUI input fields. For example I want to determine the Account which is linked to a certain Person and fill the acount data into an input field when a new customer visit report is created. Whenever a new report is created, this account info input field shall be prefilled with the determined data.
    My question now: how can I prefill input fields with default values in WebUI?
    Thanks for your help and best regards!
    Markus

    This has been discussed several times. take a look at the folowing links:
    setting default value in WEB UI
    or
    BADI_CRM_BP_UIU_DEFAULTS with method GET_DEFAULT_VALUES
    regards.

  • How do I set the value of a dynamic row text field

    I have a repeated row form which contains a button and multiple text fields.  There is a text field (Input Data Field) further up with some information I want to place in the table and multiple buttons that I want to read the value of and set to the table.  I apologize there are multiple questions I have and I am using pseudocode to describe it.
    Top form looks like
    InputField
    | ButtonX1 | ButtonY1 | DescriptionX1 (read only Text Field)
    | ButtonXn | ButtonY1 | DescriptionXn
    OutputRow looks like
    | ButtonOutput | OutputField1 | OutputField2 | OutputField3 |
    So I would like it to do
    ButtonX1.click
    OutputTable.OutputRow.addInstance(true)  //this works - everything else I have questions on
    OutputTable.OutputRow.OutputField1.rawValue = DescriptionX1.rawValue
    Question 1
    How do I address the location in each table to set a value
    Question 2
    How do I get the value of the description field in the same table and row as the button
    I would like to say something to the effect of  OutputTable.OutputRow[??].OutputField1.rawValue = this.parent.DescriptionX
    OutputTable.OutputRow.OutputField2 = InputField.rawValue
      Same question as above - how do I specify a dynamic row - is this the proper syntax for getting the value from the input field?
    OutputTable.OutputRow.OutputField3 = this.ButtonLabel
    Question 3
      How can I get the value of the button's label to set in the field
      There should be very many of these buttons and buttons will be added - I would prefer to set the value based on the button's label to make the value easier - not requiring changing the code
    Question 4 - unrelated to those above.
    Is it possible to build the first table
    | ButtonX | ButtonY | Description |
    from an XML File.  I have seen examples of how to build if it is just data, but can the XML be pushed into a form with code to do the above actions?

    Each object in a form must have a unique name. I doing so it is not neccessarily the name but the path or SomExpression associated with that object that must be unique. In your case you have a Table.Row.object configuration. The Row is the part that is repeating so to give each object a unique name an instance number is placed on the repeating part. So objects in the 1st row woudl be Table.Row[0].object...objects in the second row woudl be Table.Row[1].object etc .....You can see this by adding a debug instruction on the Enter event of the description field. Put the code app.alert(this.somExpression) and when you enter the field you will see what the somExpression is. Do this for a few rows and you will see the pattern (don't forget to remove the debug code from the enter event). Now you know what you have to use to address the fields. If no instance is given it is assumed to be 0 ..that is why only the 1st row is being affected.
    So now to answer your questions:
    Question1: The square bracket notation is an issue for javascript (this is the notation for an array) so we have to use a different means of addressing the field to include the instance number. So to address the Description in the 3rd row we woudl use:
    xfa.resolveNode("Table.Row[2].Description").rawValue = "This is my new description";
    Note that the instance number is 2 for the 3rd row because the instance numbers are 0 based.
    Question2. The resolveNode notation allows you to pass a string so you can also concatinate expressions to make the string. If you are writing code on a button in the same row you can get the instance that you are on by using the expression this.parent.index. The "this" portion refers to the current object (the button) and the parent.index gets you th eindex of the Buttons parent. If the button is embedded deeper in a hierarchy then you can continue to add parent indicators until you get back to the node that you want. So rewriting your expression from Q1 it woudl be:
    xfa.resolveNode("Table.Row[" + this.parent.index + "].Description").rawValue = "This is my new description";
    Question3: The buttons caption can be retrieved by using ButtonName.caption.value.text.value
    Question4: When you say build from an XML file. What are you expecting to come from the XML file? The caption that goes on the button? Typically the XML file carries data (not to say that it cannot carry other things). Just need a bit of clarification on this one first.
    Hope that helps
    Paul

Maybe you are looking for