This is a continuation of a series that I started here:
Customizing Forms – Part 1 – Adding a New User Picker Control to the Incident Form
In this example we’ll look at a different scenario a customer brought up. In this case the goal is to add the Affected User relationship to the Change Request form using a User Picker control bound to the inherited Affected User relationship.
In this case the customer tried to do something similar to the approach used in the first post in this series by adding the control to the stack panel but ended up with this:
The new user picker control was ending up being displayed behind the Description field!
Here is how to make the Title StackPanel bigger so that it will have the additional room required to show the new controls:
First you need to move the Description StackPanel down. Select the StackPanel around Description. This is a little hard to grab. I can get it easiest by clicking just below the textbox. It should look like this when you have it selected:
Change the Top margin from 5 to something like 45. This will move it down relative to the Title stack panel:
The next thing you need to do is resize the Title StackPanel so it will show the additional new content you are going to show in there. So – select the Title StackPanel.
And drag the lower right corner down a bit until it lines up with the top of the Description label:
Now drag and drop the label control into the Title StackPanel as I previously explained making sure you drop it when the gray dotted lines are showing around the stack panel.
Change the label so it says ‘Affected user:’
Now drag and drop the User Picker into the Title StackPanel. Bind it to the AffectedUser relationship using the BindingPath attribute in the Details pane. I also set the Top margin to -5 to make it move closer to the label and changed the width to 220 since there is plenty of room there.
In the end you get this in the designer:
And this in the console after importing the MP:
If you have other scenarios you would like me to use as examples in this series please leave them or send me an email. My email address is twright@YouKnowWhere.com :)
<p>So how would I be able to add another Label and user picker (paying user) on the right side (not below) the affected user you just described how to add?</p>
<p>You can use a horizontal alignment property or margin to move elements to the right side. Actually despite the fact that stack panel is used to order items like a stack using a negative vertical margin together with a right/left one you can put item in one raw. As far as we see the most (if not all) stack panels in SCSM forms use a vertical order. And one more comment - sometimes in the authoring tool a customized form looks solid but after importing in the system your custom elements move in unpredictably strange way but after a few attempts you could get what we really want. Sometimes it's good idea to take a look in the xml file cause (it's really fun) all movements you do with controls are logged in xml and some things could be erased (carefully!) without a negative impact on the result. And finally if you add controls to several tabs of the form finish your actions on the first one otherwise the form will be opened not focused on the first tab (which is very confusing for users). Sorry for my poor English and good luck with a form drawing!</p>
<p>@Anders - another option is to put a Panel control in there. Then Left align the controls and set the left margin so that they are spaced out equally.</p>
<p>I would like to know how exactly the popluated labels at the top of the form work and how i go about duplicating those? I have a method that is workable but i see things in the labels binding path such as "Strings[label_AffectedUser].Value" so apparently i'm not doing quite the same way and I would like to. Does that make sense?</p>
<p>our customers want to different change request custom forms that has different fields. for example, Wireless Change request form has Mac address,Device model and location fields. Other firewall change request form has server name,server ip address and port fields. And this fields must be required. Is this posibble? and how?</p>
<p>Using service requests presented as request offerings on the self-service portal's service catalog is probably the best way to achieve this in SCSM 2012 (including 2012 SP1).</p>