logo
down
shadow

Making SharePoint Lookup field multi selection in code with PNP/SP


Making SharePoint Lookup field multi selection in code with PNP/SP

By : Sachin Agarwalla
Date : October 23 2020, 08:10 AM
Hope that helps Use Type="LookupMulti" and instead AllowMultipleVaues="TRUE" use Mult="TRUE"
code :
<Field Name="${strings.Committees}" DisplayName="${strings.Committees}" Type="LookupMulti" List="{${lookupID}}" ShowField="Title" Mult="TRUE" />


Share : facebook icon twitter icon
sharepoint lookup field how to programmatically filter to lookup only in current document library

sharepoint lookup field how to programmatically filter to lookup only in current document library


By : YoungHo Kim
Date : March 29 2020, 07:55 AM
this will help Look into http://msdn.microsoft.com/en-us/library/ms446361.aspx">SharePoint Custom Fields.
http://msdn.microsoft.com/en-us/library/ms446361.aspx
Displaying list of all items with the same lookup fields in Display Form of that Lookup field in SharePoint 2013

Displaying list of all items with the same lookup fields in Display Form of that Lookup field in SharePoint 2013


By : Mahesh Babu
Date : March 29 2020, 07:55 AM
Any of those help I have 2 lists which are Room and Equipment. , A general solution would be as follow
code :
http://portal/_api/web/lists/getByTitle('Equipments')/items/?$select=Title,ID&$filter=Room eq 'room1'
<script src="/_layouts/15/CDN/Js/jquery-1.11.1.min.js" type="text/javascript" >  </script>

<script type="text/javascript" >

function LoadEquipments(roomValue) {
    $.ajax({
        url : _spPageContextInfo.webServerRelativeUrl + "/_api/web/lists/getByTitle('Equipments')/items/" +
        "?$select=Title,ID" +
        "&$filter=Room eq '" + roomValue + "'",

        type : "GET",
        headers : {
            "accept" : "application/json;odata=verbose",
        },
        success : function (data) {

            var equipments = [];
            var results = data.d.results;
            for (var i = 0; i < results.length; i++) {

                if (equipments.indexOf(results[i].Title) < 0)
                    equipments.push(results[i].Title);
            }

            var ullist = $('<ul/>');

            for (var i = 0; i < equipments.length; i++)
                $('<li/>').val(equipments[i]).html(equipments[i]).appendTo(ullist);

            ullist.appendTo('#divEquipements'); 
            $("#divEquipements ul li").css("font-size", "16px").css("color", "salmon");

        },
        error : function (err) {
            alert(JSON.stringify(err));
        }
    });
}

$(document).ready(function () { 
    var roomVal = $("#TitleValue").text(); 
    LoadEquipments(roomVal); 
});
SharePoint 2013: How to update multi-value lookup field using JavaScript CSOM

SharePoint 2013: How to update multi-value lookup field using JavaScript CSOM


By : Randall Skavage
Date : March 29 2020, 07:55 AM
around this issue Don't build array of SP.FieldLookupValue, instead save multiple contact types to string.
code :
var clientContext = new SP.ClientContext.get_current(); //if the page and the list are in same site.If list is in different site then use relative url instead of get_current
var oList = clientContext.get_web().get_lists().getByTitle('Contacts');
var itemCreateInfo = new SP.ListItemCreationInformation();
var oListItem = oList.addItem(itemCreateInfo);

var contactTypes = null;

$.each(contact.contactTypes, function (index, contactType) {
    if (index != 0)
        contactTypes += ';#' + contactType.id + ';#' + contactType.title;
    else
        contactTypes =  contactType.id + ';#' + contactType.title;
});

// other set_item statements omitted for brevity
oListItem.set_item('ContactType', contactTypes);

oListItem.update();

clientContext.executeQueryAsync(
    // success return
    function () {
        var success = true;
    },
    // failure return
    function (sender, args) {
        window.alert('Request to create contact failed. ' + args.get_message() +
                '\n' + args.get_stackTrace());
    })
get multi selection value from lookup field using java script

get multi selection value from lookup field using java script


By : user1981800
Date : March 29 2020, 07:55 AM
like below fixes the issue I nee d get mutiple value from a lookup field and i need to validate it,if i get more than one value i need to give a message and if get one value i need to give another message.i have try something but it not work. , This may work (Javascript)
code :
function getbankdetails()
{     
  debugger;
  var arr = Array.from(document.getElementById("R3413775").selectedOptions).map((ele) => ele.value)      
  if(arr[0] && arr[1] && arr.length == 2)
  {
     alert("first"+arr[0]+" "+arr[1]);
  }
  else
  { 
     alert("sasa");
  }      
}
How do I Loop through a multi-value People Field or Lookup field in SharePoint 2013 designer using REST

How do I Loop through a multi-value People Field or Lookup field in SharePoint 2013 designer using REST


By : RG.Tarantino
Date : March 29 2020, 07:55 AM
I wish this helpful for you With a lot of debugging I have gotten half my answer and maybe someone can help me with the other half. The data structure of the data when it comes back via the REST looks like (some masking of our own data):
code :
responseContent={"d":{"results":[{
"__metadata":{"id":"Web\/Lists(guid'c7bb71c8-a9dd-495f-aa5f-4dcacdf8db5c')\/Items(1)","uri":"https:\/\/xxxxx.xxxxxx.xxxxxxxxx.xxx\/hc\/teams\/MES\/_api\/Web\/Lists(guid'c7bb71c8-a9dd-495f-aa5f-4dcacdf8db5c')\/Items(1)","etag":"\"13\"","type":"SP.Data.EmailSetupListItem"},
"EmailTo":{"__metadata":{"id":"b493bee4-ec1a-4b76-a028-11766bdb7e5b","type":"SP.Data.UserInfoItem"},"EMail":"xyxee.dyff@homeward.com"},
"EmailToWorkflowPerson":{"__deferred":{"uri":"https:\/ \/xxxxx.xxxxxx.xxxxxxxxx.xxx\/hc\/teams\/MES\/_api\/Web\/Lists(guid'c7bb71c8-a9dd-495f-aa5f-4dcacdf8db5c')\/Items(1)\/EmailToWorkflowPerson"}},
"Emailcc":{"results":[{"__metadata":{"id":"790a690a-515b-4d07-bba3-73bf325fbbed","type":"SP.Data.UserInfoIt em"},"EMail":"xyxee.dyffns1@homeward.com"},{"__metadata":{"id":"3d77e75c-5fa8-4df6-937c-97e572714843","type":"SP.Data.UserInfoItem"},"EMail":"xyxee.dyffr@homeward.com"}]},
"EmailccWorkflowPersons":{"results":[{"__metadata":{"id":"06582ed9-09 10-4932-9b43-0cfb072942c7","type":"SP.Data.WorkflowPersonsListItem"},"Title":"Assistant Administrator"},{"__metadata":{"id":"13d03566-1703-4550-a21f-08ea286d4940","type":"SP.Data.WorkflowPersonsListItem"},"Title":"Initiator"}]},
"EmailYN":"No",
"EmailSubject":"BSM Request # %%ID%%",
"EmailBody":"<div class=\"ExternalClass645790473F7D4B62BE6224DD7B93990F\">%%IDLINK%%<br><\/div><div class=\"ExternalClass645790473F7D4B62BE6224DD7B93990F\">and the BSM#&#160;%%ID%%<br><\/div><div class=\"ExternalClass64 5790473F7D4B62BE6224DD7B93990F\"><br><\/div>"
}]}}
Get d/results([%variable: Index%)/Emailcc/results from Variable:responseContent (Output to Variable: EmailccResults)
Get d/results([%variable: Index%)/Emailcc/results(%Variable: Index2%)/EMail from Variable: responseContent (Output to Variable: EmailCc)
Get d/results([%variable: Index%)/EmailccWorkflowPersons/results(%Variable: Index2%)/Title from Variable: responseContent (Output to Variable: tmpvar)
Related Posts Related Posts :
  • jQuery target next of the same class in the whole DOM
  • encoding must be a valid encoding error in process encoding
  • How to do a date range to view data from selected date highcharts
  • How do I refactor this composed function with Ramda.js?
  • jQuery to serialize selected option's value, not label
  • Convert object to Chartis.js structure
  • Dynamic import with not bundled file
  • Click handler not firing for elements rendered in Ajax Callback - only in Safari
  • Math.max.apply gives an error CreateListFromArrayLike called on non-object
  • get the parent nodes to a given node in d3 dendogram
  • is-dropdown-submenu-parent makes links unclickable on Opera and Chrome
  • JS: Sum column values and updating result on change
  • Query against nested object keys
  • Fullcalendar getting its parent colspan
  • How to retrieve a dynamic number of elements by id
  • How to access redux variables and functions from deep components
  • Efficiently access Array.prorotype.filter single-item returns
  • PHP var into Javascript
  • How to parse json with javascript/jquery if content matches string
  • How can I make a pyramid based on alphabet?
  • Javascript sorting a csv rows and displaying in table
  • How to get specific data from json from api using ajax. The json looks strange to me
  • react js html5 video not working
  • Javascript Angular 4 Change ngClass from another Component
  • Hide multiple table columns with javascript
  • Convert datetime to ISO Format using moment js
  • Dynamically adjust canvas size depending on content
  • setTimeout function with document on click
  • Need advice on nested Promises.all
  • Google Captcha expiration time
  • Syntax of Javascript TAPE unit test
  • Parse php json to javascript
  • Write to Internet Explorer javascript console with vba in excel
  • 2 Forms with Jquery
  • Why the loop stops right in the middle?
  • filter system for restaurant booking
  • how to add active class in framework nav menu when (add/edit) pages are opened
  • Port a js map in dart
  • How to get value from select using javascript
  • Audio won't be muted with JavaScript - removing audio tags with mutationobserver needed
  • How to include an HTML/Javascript game into reactJS website
  • Convert Nodejs server into node module
  • Strage Vue behaviour. V-if does not watch properly
  • Is it possible to use map/filter/reduce inside a promise by returning the result with Promise.resolve?
  • Does EcmaScript have any rule where whitespace is important for the compiler during parsing
  • How is DOM and Virtual DOM represented in memory?
  • cannot display text onchange select option
  • My gulpfile can edit (change) and delete file, but dont copy new (add) files
  • How do I reset scroll position of paper-dialog-scrollable?
  • Loading unlooped gif-animation several times
  • Strange error from Google API: initializeAutocomplete is not a function
  • Array state variable is not being set during componentWillMount
  • Stop refresh on form submit when using javascript
  • Npm WARN deprecated babel-preset-es2015@6.24.1: Thanks for using Babel: we recommend using babel-preset-env now: please
  • Cant get wheel scroll delta on Firefox
  • Puppeteer with Prompt, ignoring rest of function
  • VueJS Form Input Binding
  • How To Extend mail.Chatter Widget in Javascript Odoo 10
  • How Chk two checkboxes at a time using jQuery
  • Broken "if" statement in JavaScript code…
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org