How to customise and navigate Content Type - SharePoint 2013 List

I need some advice here. I'm customizing forms that have list built using Content Types. I noticed the difference in the links is something like this below I have one default content list type called item and the other one is called College Form
Item is ContentTypeId=0x01003FF12EB7EAB88340BEE53D34C38A906200147E508F34B9164ABE555FF698569C27
College Form is ContentTypeId=0x01003FF12EB7EAB88340BEE53D34C38A906200147E508F34B9164ABE555FF698569C27
When doing my customization of the form I would like to hide some fields and show some based on the content type. I know by default the content type does that. But im using JS to hide some fields but don't know how i can do this or what values to use to
make this happen.
Any ideas and thanks in advance

WPQ2FormCtx.ItemContentTypeId will give the content type ID of the item in each of the forms newform.aspx, ediform.aspx and displayform.aspx. You can also use WPQ2FormCtx.ItemContentTypeName, if you want to compare name instead of Id. Here is a JQuery
code to hide fields in the forms:
<script type="text/javascript">
jQuery(document).ready(function($) {
    if(WPQ2FormCtx.ItemContentTypeId == '0x010400C36D463A4788AD4AAF5F85C02DA29F8E') {
    $("h3.ms-standardheader:contains('Body')").closest("tr").hide();
</script>
Note that this script assumes the JQuery is already referenced in the site. You can place above code in Script Editor web part in each of the forms. 
Also, beware that this way you can hide the field from UI, but user can still open the page source and find the actual information in the hidden field. 
If the requirement is to completely hide the field data then you will need to set the field properties like showInEditForm, showInDisplayForm and showInNewForm
Nadeem Yousuf

Similar Messages

  • How to add [Thunderbird] Attachments content type action to list

    Thunderbird, Linux. Attachments. There is only one entry: Microsoft word documents. I want to add
    other attachment types, like .jpg (open with Gwenview) and so on, but I don't know how to add anything
    to the list.
    When I snapped on the "Post Question" box below this, it added a "troubleshooter" which was no help whatsoever.
    Please just tell me in English how to do this.
    Thanx.

    WPQ2FormCtx.ItemContentTypeId will give the content type ID of the item in each of the forms newform.aspx, ediform.aspx and displayform.aspx. You can also use WPQ2FormCtx.ItemContentTypeName, if you want to compare name instead of Id. Here is a JQuery
    code to hide fields in the forms:
    <script type="text/javascript">
    jQuery(document).ready(function($) {
        if(WPQ2FormCtx.ItemContentTypeId == '0x010400C36D463A4788AD4AAF5F85C02DA29F8E') {
        $("h3.ms-standardheader:contains('Body')").closest("tr").hide();
    </script>
    Note that this script assumes the JQuery is already referenced in the site. You can place above code in Script Editor web part in each of the forms. 
    Also, beware that this way you can hide the field from UI, but user can still open the page source and find the actual information in the hidden field. 
    If the requirement is to completely hide the field data then you will need to set the field properties like showInEditForm, showInDisplayForm and showInNewForm
    Nadeem Yousuf

  • How to access the markup in a sharepoint 2013 list

    Hello,
    I would like to try word wrapping my column headers and try changing the column width in a list. How to I access the markup (html)? I do have Sharepoint Designer 2013 installed but I am not too familiar with it.
    Also, Is there any way to add a block of text to a sharepoint list page explaining the list and how to use it?
    Thanks!
    Natalie

    Hi Natalie,
    According to your post, my understanding is that you want to make list column header word wrapping, change the columns’ width in a list and add a block of text to describe this list.
    I recommend that you can follow the steps as below to implement it in your environment.
      1.  Open your site in SharePoint Designer 2013, click on “Lists and Libraries” in the Left Navigation, click on the list which you want to modify.
      2.  Right-click the “All Items” view of this list, select the “Edit File in Advanced Mode” option,  add the following code under the <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> tag, and save
    the changes of the file.
    <style type= "text/css">
    .ms-vh, .ms-vh2, .ms-vh a, .ms-vh2 a
    width: 30px;
    white-space: normal;
    text-align:center;
    vertical-align:text-bottom;
    color:red;
    </style>
      3.  Open this list in your site, go to “List Settings”, click on “List name, description and navigation”, add some descriptions like “This is a test list~!”, and click on the “Save” button.
    Then, you can go back to this list, and you will see the corresponding descriptions in a text box when you click on the “?” icon next to this list name.
    The result is show as below:
    For more information, you can refer to:
    http://blog.pentalogic.net/2011/06/word-wrapping-sharepoint-list-column-headers/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+pentalogic+%28Pentalogic+Technology+-+SharePoint+Blog%29
    Best Regards,
    Yumi Fu

  • How to programmatically create a site column and a content type

    Hello,
    I'd like to create a site column (let's say a field text) and a content type, only  using c#  -i.e. I don't want to add new item/column and then xml. This code will be added to a FeatureActivated.My code is :
    public override void FeatureActivated(SPFeatureReceiverProperties properties) {SPWeb rootweb = (SPWeb) properties.Feature.Parent;
    SPFieldText field = new SPFieldText(SPfiledscollection???, "field1");
    if (field != null)
    rootweb.Fields.Add(field)
    rootweb.Update();
    }   SPContentType newContentType = new SPContentType(spcntenttypeId??, SPContentTypeCollection ??, "content1");
       rootweb.ContentTypes.Add(newContentType);
       rootweb.Update();
    Are there any sample codes out there? I've only found samples using xml - which has an irritating "feature"
    Thank you
    Christos

    Nice code and it helped me understand. Some small questions. I'm trying to make all the "data" for a (sub)web site.
    So, I think, my steps are:
    1. create site columns+content type
    2. create  list
    3. create a lookup site column that uses the list on <2>
    4. create content type that uses the site column on <3>
    5. Create the list for the content type on <4>
    My confusion is: should I use one feature for everything? Your code is using scope=site, so i need to "hardcode" the web site's name. I don't mind doing that , I just don't know how to use scopes in features for creating data.
    Thank you
    Christos

  • How to know whether the Content Type at Library level is Inheriting Parent Content type or not Using Powershell?

    Hi,
    How to know whether the Content Type at Library level is Inheriting Parent Content type or not using Powershell?
    Is there any property for that? Or Do I need to compare the Content type Id's at Site collection level and Library level?
    Any help would be greatly appreciated.
    Thank you,
    AA.

    Hi Ashok,
    For a content type, there is an attribute called Inherits, the value of this attribute determines whether the content type inherits fields from its parent content type when it is created.
    If Inherits is TRUE, the child content type inherits all fields that are in the parent, including fields that users have added.
    If Inherits is FALSE or absent and the parent content type is a built-in type, the child content type inherits only the fields that were in the parent content type when SharePoint Foundation was
    installed. The child content type does not have any fields that users have added to the parent content type.
    More information, please refer to the link:
    https://msdn.microsoft.com/en-us/library/office/aa544268.aspx?f=255&MSPPError=-2147217396
    Best Regards,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • SharePoint REST service to add an exsiting site content type to a list/library

    Trying to use SharePoint 2013 REST Service to add existing site content types to a list/library. Below MSDN article suggests that the POST method is available but does not say how to use it.
    http://msdn.microsoft.com/en-us/library/office/jj246793%28v=office.15%29.aspx#postsyntax_htm
    POST http://<sitecollection>/<site>/_api/web/lists(listid)/contenttypes/add(parameters)
    How do we create the body for this rest call?

    Hi You need to use the addAvailableContentType method to attach a Existing Content Type to a list/Library.
    Consider the below Sample. Take the Id of the Content Type and pass it.
    the REST API URL is 
     http://<sitecollection>/<site>/_api/web/lists(listid)/contenttypes/addAvailableContentType(contentTypeId)
    var siteUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Employees')/ContentTypes/AddAvailableContentType";
        var call = jQuery.ajax({
            url: siteUrl,
            type: "POST",
            data: JSON.stringify({            
                "contentTypeId": "0x0100E5EC1FE6D284A74A972A1776FFFE2DA0"            
            headers:
                   'accept': 'application/json;odata=verbose',
                    "content-type": "application/json;odata=verbose",
                    "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
        call.done(function (data, textStatus, jqXHR) {
            var message = jQuery("#message");
            message.text("Added Content Type Successfully");
        call.fail(function (data, errorcode, errormessage) {
            alert("Could not enable content types: " + errormessage);
    Here 0x0100E5EC1FE6D284A74A972A1776FFFE2DA0 is the Content Type Id of my existing Content type "Employees"
    Ensure the AllowContentTypes is set to True for that List/Library
    R.Mani | http://rmanimaran.wordpress.com

  • How do I set the content type ?

    Hi
    I have to upload a file from my Java Application to a remote servlet.
    I have used the HTTPConnection class to connect to the remote servlet and made it call the POST method explicitly.
    How do I set the content type of the file I am uploading from my Java apllication?
    I tried to change the content type in the doPost method. by giving
    req.setContentType("multipart/form-data"); in the doPost.
    It still doesnt work..
    Is there any way to set the content type in the Java application?
    Thanks in advance

    What class is your req variable? If your using a HttpServletRequest, then there is no method req.setContentType("");
    In the HttpServletResponse this is for telling the web browser or receving medium what kind of mime type to expect.
    And what package is the HttpConnection class from?
    I think more precise info is required before this question can be answered.

  • Urgent!!! How to convert received mail 'content type?

    How to convert received mails 'content type from text/plain to multipart/*?

    you cannot change the content type of a Message object which has been received. What you can do is create an instance of a MimeMessage class and set the content type as multipart and then add the received message as a bodypart to that message.
    You can look at the javamail example codes as to how to create a new MimeMessage with multipart content.
    anurag

  • How to calculate when I need multiple WFE and APP servers in SharePoint 2013 ?

    Hi,
    Please let me know about those factors are involved on the above topic. Share something from the real experience or with examples in details.
    Thanks
    srabon

    Hi,
    NOte: some links although for 2010 but fits for 2013
    for the WFE is the RPS  Requests per second versus the users
    to get the RPS
    http://smallcitydesign.com/how-to-get-sharepoint-2010-requests-per-second-rps/
    and this excel sheet to get the users versus RPS
    http://pcfromdc.blogspot.com/2013/02/determine-max-users-from-requests-per.html
    and here you are how to get the number of front ends
    http://abhayajoshi.blogspot.com/2014/01/how-to-calculate-number-of-web-front_24.html
    for Apps server, it is based on memory and cpu consumption, check those links
    http://blogs.msdn.com/b/sanjaynarang/archive/2013/04/06/sizing-and-capacity-planning-for-sharepoint-2013-resources.aspx
    https://technet.microsoft.com/en-us/library/ff758645.aspx
    https://technet.microsoft.com/en-us/library/cc262971.aspx
    the most important thing after you do you initial capacity planning is capacity mangement, check my wiki article in here
    http://social.technet.microsoft.com/wiki/contents/articles/28226.sharepoint-2013-capacity-management.aspx
    you can also make load testing using the following:
     Visual studio or 
    https://gallery.technet.microsoft.com/office/PressurePoint-Dragon-for-58648ae4
    Kind Regards,
    John Naguib
    Senior Consultant
    John Naguib Blog
    John Naguib Twitter
    Please remember to mark this as answered if it helped you

  • How to open and navigate between human task forms in a same page?

    Hi
    I use Oracle BPM 11.1.1.5
    I have a question about taskflows in BPM Application.
    In ADF web application, I create a sipmle task flow and insert view id and bind these to jspx pages, my pages are opend in same page when
    return an outcome.
    For exapmle I have three pages like A,B,C.
    In task flow, insert three view ids and bind to A,B,C.
    My first pages is A, and when outcome is B navigate to B, when my outcome is C then navigate to C in a same page not separate pages.
    But my problem is here.. in BPM Application when create task forms, every task has a separate task flow that there exist a single view id and a wild card flow in it.
    In BPM workspace when initiate human task form is closed, I should press refresh button to see next human task form in task list table.
    I tried to create a simple task flow and insert human task forms in it and navigate between these.. but show human task form in wrong display and don`t show some component and human task payload.
    Now, my question : How to open and navigate between human task forms in a same page like software installation?

    Having a separate Data Control for each human task is normally the case. There is a way to assign multiple human tasks to a single data control (and one task flow), but I don't think that this is going to help you with what I think you're trying to do.
    If your human task is called "EmployeeDetail", then you'd use the data control associated with this for the UI pages in the task flow diagram that is associated with this human task. For example, you might have a first page that has just the basic employee information - the fields (at least the ID field) would come from the EmployeeDetail data control. When the end user clicks "Next", you might have this UI page flow to a second UI page in the task flow diagram that has the employee's address information. You might place the address fields from the EmployeeDetail data control onto this second UI page.
    You might be asking how the work item instance can automatically flow to the next interactive activity in the process while staying inside the first interactive activity's human task's task flow diagram. This is not how it works - the task flow diagram models the end user interaction while inside a single human task that is tied to a specific interactive activity in the process. If you want a the end user to be able to move the instance through multiple interactive activities in the process in one interaction, look at "Activity Guides". Activity Guides do a nice job of this.
    Dan

  • How Do I Set XML Content-type in Flex 3

    Hi,
    My Flex 3 project makes an ExternalInterface call to some Javascript. The Javascript is then turned into XML.
    But, my xml isn't parsing in IE. It works in all other browsers. I think that the problem is that I haven't set the XML's content-type. As I understand it IE requires that the Content-type be set. Is this correct?
    My code looks like:
    myReturn =  '<myXMLReturn>' + myReturn + '</myXMLReturn>';
    myReturn = '<?xml version="1.0" encoding="UTF-8"?>' + myReturn;
    xmlReturn = new XML(myReturn);
    How would I set: header('Content-type: application/xml'); for an ExternalInterface call?
    Thank you.
    -Laxmidi

    Okay. I figured it out. I don't need to set the Content-type.
    I had a case sensitivity problem in parsing the xml. Thank you.
    -Laxmidi

  • Programmatically: Support content types in the gallery and for content types associated with a document library

    Hi there,
    Help appreciated in programmatically 'Supporting content types in the gallery and for content types associated with a document library'.
    Any resources/references or source is greatly appreciated.
    Regards,

    Hi,
    Would you mind providing more details about your requirement? Cause I'm not quite clear about what you really need.
    What’s more, there are seems two questions in your post. If you have several questions to ask, I suggest you post them into every single thread to make them easier to be discussed
    in the forum.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Choose which content type to use in sharepoint 2013 list using InfoPath 2013

    So, in my head it seems pretty simple and a feature that might be standard to InfoPath so much in fact I can't find anything on it... My goal is to a have one list where you can do a drop down or buttons to choose which content type to use.
    I will be royally disappointed if this is not possible. =(
    So, c'mon you giants of MS Support. Give me a happy answer.

    Hi Lincoln,
    According to your description, my understanding is that you want to use multiple content types in a list.
    For achieving it, you can do as the followings:
    Open the list.
    Go to List Settings->Advanced Settings.
    Under ‘Allow management of content type’, select ‘Yes’, click OK.
    In the Content Types section, click ‘Add from existing site content types’
    Then add the content types that you want to add, click OK
    Go back to the list, click ITEMS->New Item, then all content types are displayed in the drop-down list
    When you click an item, you can select the new item is created based on one of these content types
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

  • How to create a Document Set in SharePoint 2013 using JavaScript Client Side Object Model (JSOM)?

    Hi,
    The requirement is to create ""Document Sets in Bulk" using JSOM. I am using the following posts:-
    http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1904cddb-850c-4425-8205-998bfaad07d7/create-document-set-using-ecma-script
    But, when I am executing the code, I am getting error "Cannot read property 'DocumentSet' of undefined "..Please find
    below my code. I am using Content editor web part and attached my JS file with that :-
    <div>
    <label>Enter the DocumentSet Name <input type="text" id="txtGetDocumentSetName" name="DocumentSetname"/> </label> </br>
    <input type="button" id="btncreate" name="bcreateDocumentSet" value="Create Document Set" onclick="javascript:CreateDocumentSet()"/>
    </div>
    <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"> </script>
    <script type="text/javascript">
       SP.SOD.executeFunc('sp.js','SP.ClientContext','SP.DocumentSet','SP.DocumentManagement.js',CreateDocumentSet);
    // This function is called on click of the “Create Document Set” button. 
    var ctx;
    var parentFolder;
    var newDocSetName;
    var docsetContentType;
    function CreateDocumentSet() {
        alert("In ClientContext");
        var ctx = SP.ClientContext.get_current(); 
        newDocSetName = $('#txtGetDocumentSetName').val(); 
        var docSetContentTypeID = "0x0120D520";
        alert("docSetContentTypeID:=" + docSetContentTypeID);
        var web = ctx.get_web(); 
        var list = web.get_lists().getByTitle('Current Documents'); 
        ctx.load(list);
        alert("List Loaded !!");
        parentFolder = list.get_rootFolder(); 
        ctx.load(parentFolder);
        docsetContentType = web.get_contentTypes().getById(docSetContentTypeID); 
        ctx.load(docsetContentType);
        alert("docsetContentType Loaded !!");
        ctx.executeQueryAsync(onRequestSuccess, onRequestFail);
    function onRequestSuccess() {       
        alert("In Success");
        SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docsetContentType.get_id());
        alert('Document Set creation successful');
    // This function runs if the executeQueryAsync call fails.
    function onRequestFail(sender, args) {
        alert("Document Set creation failed" + + args.get_message());
    Please help !!
    Vipul Jain

    Hello,
    I have already tried your solution, however in that case I get the error - "UncaughtSys.ArgumentNullException: Sys.ArgumentNullException:
    Value cannot be null.Parameter name: context"...
    Also, I tried removing SP.SOD.executeFunc
    from my code, but no success :(
    Kindly suggest !!!
    Vipul Jain

Maybe you are looking for

  • BW Query variable default value put in Crystal report variable question

    Why BW Query variable default value put in Crystal report variable for BO InfoView to open crystal report. I using Analyzer to open bw query,variables had default value ,but crystal report can't had variable default value ,and can't search variable 

  • Macbook pro rebooted after upgrading to mountain lion

    Hi all, After upgrading to OS X mountain lion, I have experienced that the computer was restarted without any specific reason. I wonder if there are other folks experiencing similar problems. The effor code is as follows: Interval Since Last Panic Re

  • Bank Account Details to be Mandatory

    Hi, I am a FI consultant and as per client requirement, In Vendor master, " Bank Account details to be made mandatory'. Could u please guide me how to configure ? thanks JK

  • Group Assets IT - Depreciation

    Hi All, I am calculating Depreciation on Assets based on Income tax act of India. Based on this the assets purchased less than 180 days should 50% depreciation charged. this is running fine when I calculate the depreciation on Individual Assets. But

  • PS CS6 froze when using smudge tool. Will I lose my edit?

    PS CS6 froze when using smudge tool. Will I lose my edit?  Is there any way to get it to respond without a force quit? And how can I avoid having PS stop responding every time I am using the smudge tool? I shut down all other applications, browsers,