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:
- 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. - Use InfoPath's features to create the form. InfoPath does not seem to be able to access the
ParentID
auto-generated field. - 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.)