0

I am on SharePoint Online, using Sharepoint Designer 2013 and InfoPath 2013. I have access to our site as an admin, but I do not have access to the server.

Some background: For a task list, I needed to find a way to add a subtask to another task without going through the quick edit function in the browser, so I figured out how to add the ParentID field as a control in the NewItem.aspx form.

Unfortunately, the dropdown control only shows the ID number of the parent, which my end users never see. I need to have the title of the parent task appear in the dropdown instead of the ID number. InfoPath is not working for me as I cannot get it to connect to the hidden ParentID field (and adding a field called ParentID doesn't work). Is there any way to get the control to display the parent task's title while looking up on the ParentID field?

This link is the closest I've found when searching. However, since the ParentID field is already a lookup (as defined in the accepted answer here), I am not sure how I could implement the SPFieldLookupValue class to connect from the ParentID field to the ID field to the Title field.

I have tried the following ideas:

  1. Add another field that gets populated by a JavaScript onchange event (using similar code found at this blog post). My JavaScript failed to work; I did try to account for the input/select problem just in case.
  2. Use InfoPath's features to create the form. InfoPath does not seem to be able to access the ParentID auto-generated field.
  3. Add a content search web part that shows the IDs and task names together, requiring the end user to look up the ID number in the web part to select the correct one in the dropdown control. This is my current workaround, but it is obviously clumsy and not user-friendly.

Here's the code snippet from the form (it's in a data view web part):

<tr>
    <td width="190px" valign="top" class="ms-formlabel">
        <H3 class="ms-standardheader">
            <nobr>Parent Task</nobr>
        </H3>
    </td>
    <td width="400px" valign="top" class="ms-formbody">
        <SharePoint:FormField runat="server" id="ff13{$Pos}" ControlMode="New" FieldName="ParentID" __designer:bind="{ddwrt:DataBind('i',concat('ff13',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ParentID')}"/>
        <SharePoint:FieldDescription runat="server" id="ff13description{$Pos}" FieldName="ParentID" ControlMode="New"/>
    </td>
</tr>

For reference, I have been mostly teaching myself how to use SPD; my programming skills are in the low-intermediate range from a spotty background of classwork and guesswork. I may be using the wrong terms as a result, so please ask for clarification, and I will attempt another explanation.

I have been trying to get this working for a week and searched all over for solutions, including digging through the controls documentation from Microsoft. There is a lot of information on how to query for the parent ID, but no information on how to actually add it to an InfoPath form that I can find. There are explanations on how to make the task name display when looking up the ID through InfoPath, but nothing on how to do the same thing in the code in SPD 2013. Any help you all can provide would be highly appreciated!

(Alternatively, if anyone knows how to bind a field that does not show up in the Fields pane to a control in InfoPath, that would work, too.)

1 Answer 1

0

Laura, you say that Parent ID is already a Lookup column. Lookup columns let you specify what the display value should be. Go to the settings for that column and look near the bottom for a dropdown of fields to choose. This will change the values in your form and will still use the ID as the actual lookup value.

I would also like to note this is advice for the aspx markup you posted and NOT for any InfoPath form.

2
  • Thanks for your response. Unfortunately, this column is not one I can access on the site. It looks like it is a built-in column (someone else called it an internal property [here][1], and [someone else][2] found it as a hierarchy parent key column...). Is there a way to access the settings for those kinds of fields in SharePoint's interface or SPD? [1]: sharepoint.stackexchange.com/questions/160314/… [2]: stackoverflow.com/questions/29072730/…
    – Laura S
    Commented Apr 7, 2016 at 15:48
  • I figured it out! Thank you for putting me on the right track. For the next person, open up any column from the list settings, then change the part in the URL after Field= (at the very end of the URL) to ParentID. Then, change the dropdown from ID to Task Name.
    – Laura S
    Commented Apr 7, 2016 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.