Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have an external list that I want to add action to copy list item to NewForm. or any othwer way to take data from external list item to a new form. From display form, edit form any way will be useful. I understood that Workflow doesn't work with ECT.

So how do I Copy data from external List Item to New Form?

share|improve this question

1 Answer 1

Not sure I fully understand what are you after. ECTs are NOT stored physically in SharePoint, but rather queried in a lively-manner from the back-end system. You could however use CSOM ECMA Javascript to load from one particular item. Notice:

  1. The actual ID is the BcsIdentity column - which is not a regular Integer but rather an ugly, long GUID like, e.g. __dg8100230003001300030013000300kc000d4001400e400k410084002500d20013008300
  2. You absolutelly need to specify the columns to include both in the ViewFields and using the 'Include(BcsIdentity,Title) (here I'm only loading BcsIdentity and Title).

Use this in a CEWP that you could load somewhere to read behind-the-scenes the actual data from the Item you are targeting and than use it to perform whatever operations you are after! Example of Javascript based Query:

 var caml = '<View><Query><Where><Eq><FieldRef Name="BcsIdentity" /><Value Type="Text">' + curPageFirstId + '</Value></Eq></Where><OrderBy><FieldRef Name="BcsIdentity" Ascending="FALSE"/></OrderBy></Query>'+
                '<ViewFields>' +
                '<FieldRef Name="BcsIdentity"/><FieldRef Name="Title" Type="Text"/></ViewFields><RowLimit>1</RowLimit></View>';

            var ctx = new SP.ClientContext.get_current(); 
            var web = ctx.get_web(); 
            var list = web.get_lists().getByTitle("YourListHere");
            var query = new SP.CamlQuery();
query.set_viewXml(caml);
var listItems = list.getItems(query);
ctx.load(listItems, 'Include(BcsIdentity,Title)');
ctx.executeQueryAsync( 
function(){  if (listItems.get_count() > 0) {
  var listItemEnumerator = listItems.getEnumerator();
  listItemEnumerator.moveNext();
  DoSomethingElseHereWithEachRow(listItemEnumerator.get_current(), rowData, rowId);}}, 
function(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
});
share|improve this answer
    
Hi, Thanks, For the answer and help. it looks very complicated. like building the whole page from scratch. i try some trick to pass ItemID to new form (like EditForm) and it put the right data only in the picker's fields automatically, but not in the regular fields. is there's a way to fill up the rest of the fields it's looks more simple BTW the edit form and the new form are connecting to Stored procedure with the same signature. and same fields. –  omri Apr 17 '13 at 7:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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