Skip to main content
deleted 4 characters in body
Source Link

Use javascript by adding a Content Editor to the page or adding it to the markup itself. I did something similar, picked up ContactId from Query String. Picked up this code from here

    <script type="textsrc="https:/javascript" src="/sitesajax.googleapis.com/StandardLifeajax/SiteAssetslibs/jquery/1.811.3/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    jQuery(document).ready(function($) {
    
        //get the Contact ID from they query string
        var contactId = getParameterByName("contactId");
        
        //Set the corresponding Lookup field value to the Contact ID
        $("select[title='Contact Name']").val(contactId);    
        
        //use this line to disable the lookup field selection
        $("select[title='Contact Name']").attr('disabled','disabled')
        
        //use this line to hide the lookup field and label entirely
        //$("select[title='Contact Name']").closest("tr").hide();            
    });
    
    function getParameterByName(name)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.href);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    
    </script>

Regards

Use javascript by adding a Content Editor to the page or adding it to the markup itself. I did something similar, picked up ContactId from Query String. Picked up this code from here

    <script type="text/javascript" src="/sites/StandardLife/SiteAssets/jquery/1.8.3/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    jQuery(document).ready(function($) {
    
        //get the Contact ID from they query string
        var contactId = getParameterByName("contactId");
        
        //Set the corresponding Lookup field value to the Contact ID
        $("select[title='Contact Name']").val(contactId);    
        
        //use this line to disable the lookup field selection
        $("select[title='Contact Name']").attr('disabled','disabled')
        
        //use this line to hide the lookup field and label entirely
        //$("select[title='Contact Name']").closest("tr").hide();            
    });
    
    function getParameterByName(name)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.href);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    
    </script>

Regards

Use javascript by adding a Content Editor to the page or adding it to the markup itself. I did something similar, picked up ContactId from Query String. Picked up this code from here

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    jQuery(document).ready(function($) {
    
        //get the Contact ID from they query string
        var contactId = getParameterByName("contactId");
        
        //Set the corresponding Lookup field value to the Contact ID
        $("select[title='Contact Name']").val(contactId);    
        
        //use this line to disable the lookup field selection
        $("select[title='Contact Name']").attr('disabled','disabled')
        
        //use this line to hide the lookup field and label entirely
        //$("select[title='Contact Name']").closest("tr").hide();            
    });
    
    function getParameterByName(name)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.href);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    
    </script>

Regards

Source Link

Use javascript by adding a Content Editor to the page or adding it to the markup itself. I did something similar, picked up ContactId from Query String. Picked up this code from here

    <script type="text/javascript" src="/sites/StandardLife/SiteAssets/jquery/1.8.3/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    jQuery(document).ready(function($) {
    
        //get the Contact ID from they query string
        var contactId = getParameterByName("contactId");
        
        //Set the corresponding Lookup field value to the Contact ID
        $("select[title='Contact Name']").val(contactId);    
        
        //use this line to disable the lookup field selection
        $("select[title='Contact Name']").attr('disabled','disabled')
        
        //use this line to hide the lookup field and label entirely
        //$("select[title='Contact Name']").closest("tr").hide();            
    });
    
    function getParameterByName(name)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.href);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    
    </script>

Regards