none
Making Project ID read only RRS feed

  • Question

  • Looking for a solution where we can make Project ID (default inbuilt field) read only once it is generated in Project Online. Any solutions?



    Abhijeet Mohite, PPM Consultant | abhijeetm@outlook.com

    Sunday, July 30, 2017 1:42 PM

Answers

  • Or just look to remove it from the web part on the PDP and just display it in the Project Center views?

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Monday, July 31, 2017 7:47 AM
    Moderator
  • Hi,

    It would require some javascript inserted in a hidden content editor webpart.

    See some articles:

    • https://social.technet.microsoft.com/Forums/en-US/334586d3-0743-494a-a5c1-4f7297d26ce7/how-to-make-a-standard-field-readonly?forum=projectonline
    • http://sharepoint1on1.blogspot.fr/2013/08/project-server-set-custom-field-as.html

    Hope this helps,


    Guillaume Rouyre, MBA, MVP, P-Seller

    Sunday, July 30, 2017 6:01 PM
    Moderator

All replies

  • Hi,

    It would require some javascript inserted in a hidden content editor webpart.

    See some articles:

    • https://social.technet.microsoft.com/Forums/en-US/334586d3-0743-494a-a5c1-4f7297d26ce7/how-to-make-a-standard-field-readonly?forum=projectonline
    • http://sharepoint1on1.blogspot.fr/2013/08/project-server-set-custom-field-as.html

    Hope this helps,


    Guillaume Rouyre, MBA, MVP, P-Seller

    Sunday, July 30, 2017 6:01 PM
    Moderator
  • Thanks Guillaume. Will try and share feedback.

    Abhijeet Mohite, PPM Consultant | abhijeetm@outlook.com

    Monday, July 31, 2017 4:38 AM
  • Or just look to remove it from the web part on the PDP and just display it in the Project Center views?

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Monday, July 31, 2017 7:47 AM
    Moderator
  • That's a good hint Paul.

    Hope this helps,


    Guillaume Rouyre, MBA, MVP, P-Seller

    Monday, July 31, 2017 7:50 AM
    Moderator
  • Hi Guillaume,

    with that JS Project ID gets locked when loading the page but if some other custom field is updated and saved the PDP, Project ID field gets unlocked and editable again:

    <script src="https://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    <script>
     //this function will wait for the DOM to be ready then execute 
     $(document).ready(function(){
    
    //then we will look for the input that has the title Project ID  using this input selector
     $('input[title="Project ID"]').each(function(){
     if($(this).val() !="")
     {
    
    //if the input has a value we will alert a message and make it read only
    
    //alert("Custom field is locked.");
     $(this).attr("disabled", true);
     }
    
    
    });
     });
     </script>

    How could it be done to keep it locked even after the PDP is saved after updating other custom fields in the form?

    Thanks in advance!


    Tuesday, December 24, 2019 9:58 AM