1

Trying to create a unique ID(not sequential which is preferably an alpha numeric unique ID) for each row item added.

The same I have tried using an EXCEL formula, but how to integrate it with SharePoint list using JSOM and script editor web part. Also need to know how to bind the code to sharepoint list.

formula used in EXCEL sheet

=CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8),"-",DEC2HEX(RANDBETWEEN(0,42949),4),"-",
  • Hi, Do you realise that SharePoint already creates a GUID for each item automatically? – James Randal May 28 at 3:07
  • @JamesRandal yes but how to capture it on item level that what my ques is. – Bibhudutta Bhanja May 28 at 8:27
3

The following example for your reference.

1.Create a custom list, add text field "GUID".

2.Add the code below into script editor web part in new form page.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function (){
    var fieldTitle="GUID";
    $("input[title='"+fieldTitle+"']").val(buildGuid());
    $("input[title='"+fieldTitle+"']").attr("disabled", "disabled");
})
function buildGuid(){  
   return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {  
      var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);  
      return v.toString(16);  
   });  
}
</script>

If you add item, we can see the GUID in the "GUID" field.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.