Generating dynamic list columns fields in SharePoint list form - list

We have created a custom list form with SharePoint designer and now the requirement is like below:
User will request server creation using this form and now server can be of any type which user can choose from a drop-down such as Production,stage,Test or multiple production servers are required. And for each server type, there will be corresponding 20-25 fields which user need to fill for that server details. so i want to know the best way to achieve this as we cant create 200-250 list columns in this list and scrolling also will be a difficult task while user will submit the request. So what is the best way to achieve this requirement?

You can create a list containing all server types that will be used to create a server type lookup. Then you can create a list with a 'Server Type' column and 'Server Requirements' (multiple lines of text) column. You can store all requirements for a particular server as a JSON object e.g.:
{"RAM":"8GB", "CPU":"4"}
OR you can create a nested JSON object for each server type e.g.
{"ServerType": "Staging", "Requirements": {"RAM":"8GB", "CPU":"4"}}
wherever you want to show/send/populate data, you just need to retrieve this json and parse.
Hope this helps.

first I think the recommended way would be to try OOTB SharePoint solutions and in Your case I think You could try to use ContentTypes and OOTB list forms.
Lets say You create a content type per server type. To each type You add only the 20-25 fields that are corresponding to this server type. Then in list settings in advanced settings You turn on content type management and You add does content types to the list (also hide the default Element content type). After that when the user will want to add a new item to the list he will be albo to chose between the content types (server types in Your case), and after that the form will have only the fields that are added to this content type. Also in edit form the user will be able to pick between content types and will see only the corresponding fields. Please see the attached screens to also understand what I mean on a very simple case:
list
ContentType1 (ColumnA)
ContentType2 (ColumnB, ColumnC)
if this OOTB features are not enough and You already created a custom form using SharePoint Designer
Then You should be able to attach custom javascript file to it and jQuery library. The javascript You may store under _layouts path on server. Every field in the form has its own tr (row) You could to each row attach some custom css class like- class="forServerProd allFields" and then in js You could listen onChange event of Your list and show or hide fields with $(".allFields").css('dispaly','none'); // first hide all
$(".forServerProd ").css('dispaly','table-row'); // then show only relevant

Related

How do i create a custom document property in excel so that i can auto populate with a SharePoint workflow

I am setting up an automatic document generator on our department's SharePoint site - users will submit the necessary details via a SharePoint list and the workflow will run automatically in the background to generate the three documents namely; specification (word doc), clearance form (word doc) and requisition form(excel). I have managed to auto-populate the first two forms. However, i am not able to do the same for the third file, which is an excel file.
I understand that there is no insert function for document property and tried following this particular advise but i couldn't get it to work. https://superuser.com/questions/99386/excel-cell-value-as-excel-document-metadata-property
Anyone know how?
By default, SharePoint uses Word file template as the default template of Document content type.
If you want to create an excel file by using SharePoint Designer workflow, you can create a custom Document Type (in my testing, it is named "Excel Content Type")and set Document Template to an Excel file:
Then add the custom Document into your library, then use "Create List Item" to create an Excel file using the custom content type:
After the workflow runs, the result is like:

Cannot Preprocess Data for Web Service Submit To SharePoint from InfoPath

I recently added SharePoint web service submission functionality to a customized (InfoPath) list form (not an xml forms library form) so users could add items to another SharePoint list from the current form. Works great. Sets up repeating table from XML data connection template, and submits data to the UpdateListItems method in Lists.asmx.
List form illustration
However, users have to hand type all field values into the repeating table that is submitted to the Lists.asmx web service. I want to pre-populate some rows of the repeating table with derived values and values that come from other parts of the InfoPath form.
Several approaches I tried did not work:
Created rule to set values in the Field element in the repeating table (i.e.: set Field to "myvalue"). That does not work because it populates Field element for all rows. Cannot find a way to target one row (i.e.: to set Field to “yes” where Name attribute = Field1).
Added filter to rule in Manifest.xsf that sets the field value in attempt to target a specific row of the repeating table. Tried to filter with # symbol since I’m attempting to filter on attribute (i.e: Field[#Name = "Field1"]). Also tried without # symbol (i.e.: Field[Name="Field1"]). Neither worked as expected.
Created string field to send in the submit, and used concat to assemble the XML that UpdateListItems expects. Received SOAP error message:
Seems like a simple thing to do, but cannot get it to work. Am I missing something? First thought was to code-behind, but this is a list form, not an XML forms library form (cannot code-behind in list form template).
Has anyone else successfully automatically populated some data values and submitted to SharePoint web service to add or update another SharePoint list?

Creating Managed Metadata field in html sharepoint

I am showing sharepoint list in jsgrid in custom html.
One of the column in list is of managed metadata type. I want to show this field in jsgrid along with editing. Possible?
If I understand you want to render a managed metadata field in your own jsgrid.
I believe this tutorial could be a start for you
https://github.com/SharePoint/PnP/tree/master/Components/Core.TaxonomyPicker

Sitecore users to add fields to template

I'm building a products table to show all the products attributes. However I need to allow users to add/edit/remove those attributes from the products later on in production without any dev work. I thought about branch templates but when I edit the branch template, existing products are not getting updated. Maybe I'm looking in the wrong direction? Any suggestions?
In an older project we have a similar setup with product and attributes and used a custom database to help us out:
products are stored as items in Sitecore
attributes are stored as items in Sitecore
a custom database stores the values of all attributes for all products
publish events are used to keep the custom database in sync when deleting products
on a product template we added an extra tab in the content editor including an aspx page that offers an editor on our custom database for that product. We use the products Sitecore ID and display all possible attributes in an editable way.
Most attributes have simple string values but that is extendable. Our attributes have a type (string, bool, (multi-)list, ..) and we use that to create the editor. The lists refer back to Sitecore items (a parent is selected on the attribute item).
Adding an extra tab in the editor can be done by creating a new item in the core database (/sitecore/content/Applications/Content Editor/Editors) that point towards your aspx file. In the standard values of your product template, you select the created "editor" in the Appearance section. (note that this is in Sitecore 6 - might have been changed although the path to the editors is still valid)
This solution does mean that the values of your attributes are stored outside Sitecore, but it worked for our requirements.

URLs of pages on which item appears in Sitecore

In Sitecore, how can I get a list of all pages on which an item appears? Thanks
Internally Sitecore maintains a database of references between Items called the Link Database. You can query this by using the "Links" dropdown on the "Navigate" tab on the Content Editor ribbon. That may give you the information you need.
(You can also query the Links Database via code - See example code on http://laubplusco.net/sitecore-item-extensions-get-referrers-as-items/ for one example of doing this - or the docs in SDN)
If the relations to your target Item are via selection field types (multilist, treeview etc) or via the DataSource property of Renderings/Sublayouts/etc then you should be able to select the item you're interested in and click the "Links" dropdown to see a list of the relationships Sitecore has recorded. This will list system relationships (which template does this item use) as well as the sort of relationships you're interested in where one item points at another item.
Note that this approach cannot tell you about some types of relationship: the most common sort being ones which are calculated at runtime. (EG API queries, or searches) because those relationships don't exist in the Links Database.
-- edited to add --
You ask about getting the URLs for these Items. In code you can get the URL for an item by calling LinkManager.GetItemUrl() and passing in the item you're interested in. That gives you the public website URL, rather than the Sitecore Item Path that you'd get directly from the Link Database.