Set Default Field Value Based on Site Property - sharepoint

I am looking for a way to set a list field default value to a property that I have programmatically set on the site where the list resides.
Essentially every item in the list will have the same value which will be hidden from the normal user view. Down stream, I am using a content query web part to pull that field so I can group on it.
I am using SP2013.
Thanks for the help

With Site Properties you mean the SPSite.RootWeb.AllProperties property bag which you have filled with some custom property?
Assuming that is what you are talking about, there are unfortunately no standard ways to work with property bags - besides programming that is.
You said you want to set a default value on a list field for each list item. This sounds like an event receiver! You can choose to have it fire on item updating and/or item created for all your items and always set the hidden field on the item with the value from the site properties.

Related

Are there any negative consequences of giving ‘Title’ field a default value of ‘View’ and making it a hidden field?

When I create a list, I have gotten into the habit of doing the following:
Change Title field name to Item
Give it the default value of View
Go to Advanced Settings
Allow management of content types > Yes
Click Save
Then in Settings, click on the Item type
Then click on the Item field and select Hidden
Then go back to Advanced Settings
Allow management of content types > No
Click Save
The result of this is that:
The Title field (now called Item) is hidden in the form
I have a column called Item, which has the link View in each row (which opens up the item)
I can’t remember why I started doing this (possibly one of the reasons outlined in this video), but the use case must have demanded it and I just kept doing it.
However, lately I have been having troubling thoughts about whether it negatively effects indexing or has any other undesired outcomes.
For example, I did a search in a list the other today, and in the drop down search results that were displayed, I just got multiple rows of the value View.
I also read just before posting this question that list items in the recycle bin will be identified by the value that was in the Title column. So if they all say View it will be impossible to differentiate one from the other.
So I just thought I would see if there is any authoritative, definitive best practice around the Title column, and ask if my convention is bad and if so what I should replace it with.
Thank You.
(Edit: I also hide the Title column in document libraries, as it doesn’t seem to serve a purpose, as clicking on the value in the Name column opens up the document anyway - therefore the ‘link’ action of the Title field is not required).

Multi Select List Box Document Property with Search bar enabled

I am working on Multi Select List Box document property with search field.
It works fine when I give any keyword like 'An' it gives me Andorra, Angola, Anguilla etc. I can multi-select all these 3 records and make my underlying data table filtered.
Now the challenge is, if I search for the records that starts with Z in the search bar and click Enter then the above selection is deselected/disappeared (meaning the last search elements alone will be available).
Any ideas on how to make the current selection and newly searched elements available ?
Any inputs and suggestions would be much helpful.
Attached the sample dxp file and screenshots.
I think the filtering you are doing is based on the document property attached to this multi select list box.
You can make another property and attach this value to that doc property, whenever somebody changes this value run an IronPython to append to that doc property.
Give a reset button to clear this value when required

Netsuite custom field does not display data in search results

I'm new to Netsuite, so please bear with me. I have created a saved item search that is working fine with one exception; one of the result columns I have chosen is not displaying data in the returned rows. This is a custom field created by our old Netsuite Administrator and it does display data on an item record, just not in search results. I've done some searching and thought I found the problem when I read another post that said that "Global Search" and "Show In List" needed to be checked on the custom field. I did that, but the search results still do not display any data for that column.
The field is a custom item field of the type decimal number. Store value, show in list and global search is checked. The field is applied to inventory items, non-inventory items, kit/package and assembly/bill of materials. What am I missing? TIA
I suspect the field has field level access permissions. Go to the field definition and click the 'Access' tab. The 'Default Level or Searching/Reporting' should be at least 'Run'.
Global Search on a field makes it so if you enter a value in the Global Search bar that matches the field's value for an item then that item will be shown as a possible match. It has nothing to do with your issue. Neither does Show in List.

Associating DispForm with with an spfield item

I have a custom view of a list that doesn't include the "Title" field, I need to associate the display from with another spfield, how do I go about this?
Thanks
Achieved by setting the LinkToItemAllowed and ListItemMenuAllowed properties of the spfield to SPField.ListItemMenuState.Required;
Although not the nicest but a simple SPD workflow that populates a custom column of type Hyperlink/Picture with the DisplayForm URL. And then you can display this column into your respective view.
However, what's the reason you want to do this? You don't have the value in title? You can use the Title(linked to item) instead of Title(linked to Edit Menu). You may want to verify the names though as what I have put in terms of paranthesis might not be exact.

Sharepoint calculated field's formula for created by

i have a sharepoint list
with 2 users for examole (user A and user B)
i need a calculated field in the list items such that if user "A" created the item the field vaule will be "X" and if user "B" created the item fields value would be "Y"
but i couldnt use [created by] in the furmiula of the calculated field !! why is that ?!! and is there another way to do what i need to do ?!
If using Sharepoint Designer is an option you can create a workflow for that list. Set it to start when a new item is created -or- edited, use a condition of "If Created_By equals ..." and an action of "Set yourfield to yourvalue", then add an Else If branch and repeat. This will always override anything a user enters in "yourfield". Takes about 2 minutes to do all of this.
I believe you can create a text field that has the default value set to [Me] which should then be usable in a calculated field.
For more complicated formulae (i.e. anything with conditional logic), try creating an event handler for the content type (or doc library). This will allow you full control to set the fields to what you desire.
The field can be hidden from the user inside the edit screens.
Make sure use the STSDev from codeplex to setup the solution for deployment.

Resources