locked
how to set field value using another custom list in same site RRS feed

  • Question

  • Dear all,

    please help me, i am struglling since last two days with infopath 2010, i am designing a list web submition form. here the form first field is ID if a employee enter his Employee ID remaining field s valve should pick up from other custom list which is in same site.

    how can i achive this, please help, i am SP beginer so please describe me little bit deep, thanks in advance.

    Saturday, March 17, 2012 4:50 AM

Answers

  •  

    Hi Nizamuddin C,

    This is need you custom development. Here is the simple code.

           /// <summary>

           /// Sets the field value of an InfoPath Form. pass isNil true for date fields

           /// </summary>

           /// <param name="xPath">copy the xpath from InfoPath designer for the field</param>

           /// <param name="xValue"> the value to be set</param>

           /// <param name="isNil">true for date fields</param>

           private void SetFieldValue(string xPath,string xValue, bool isNil)

           {

               try

               {

                

                   XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();

     

                   XPathNavigator xnMyField = xnDoc.SelectSingleNode(xPath, this.NamespaceManager);

     

                    xnMyField.SetValue(xValue);

     

                   xnDoc = null;

                   xnMyField = null;

               }

               catch (Exception ex)

               {

     

                   throw new Exception(xPath + ":" + xValue + ":" + ex.StackTrace, ex);

               }

    You can refer to the following link.

    http://walisystems.com/articles/SPS/dropdown2/sharepoint_list_data.htm

    Thanks,

    Jack

    Tuesday, March 20, 2012 8:43 AM
    Moderator

All replies

  • Dear friends,

    Please help me, my problem is in my SP2010 site had to Custom list 1st.Employee details and 2nd. Emplyee Appraisals, basically i am designing a web based form through infopath 2011, if a logged user create a new item above form will open, here EMp ID field is mandatory field. when an employee type his Emp ID remaining filed should get valves from our employee details list [in employee details list employee full details are available like e.g ID, Username, Designation, Department,Mangername{peoplepicker} et.c fields]

    How can i achive this? Thanks in advance,

    Tuesday, March 20, 2012 5:58 AM
  •  

    Hi Nizamuddin C,

    This is need you custom development. Here is the simple code.

           /// <summary>

           /// Sets the field value of an InfoPath Form. pass isNil true for date fields

           /// </summary>

           /// <param name="xPath">copy the xpath from InfoPath designer for the field</param>

           /// <param name="xValue"> the value to be set</param>

           /// <param name="isNil">true for date fields</param>

           private void SetFieldValue(string xPath,string xValue, bool isNil)

           {

               try

               {

                

                   XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();

     

                   XPathNavigator xnMyField = xnDoc.SelectSingleNode(xPath, this.NamespaceManager);

     

                    xnMyField.SetValue(xValue);

     

                   xnDoc = null;

                   xnMyField = null;

               }

               catch (Exception ex)

               {

     

                   throw new Exception(xPath + ":" + xValue + ":" + ex.StackTrace, ex);

               }

    You can refer to the following link.

    http://walisystems.com/articles/SPS/dropdown2/sharepoint_list_data.htm

    Thanks,

    Jack

    Tuesday, March 20, 2012 8:43 AM
    Moderator