Content Type Lookup with cross-site column

Discussions about Cross-site Lookup
User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

03 Dec 2014

Hi;

How can we create lookup column with content type using cross-site column?

I must filter column by content types;


Thanks..

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

04 Dec 2014

Hi,

Do you mean you need to filter lookup values by their content type? If so, please, modify Request items template of the Cross-site Lookup column following way:

Code: Select all

function (term, page) {
  if (!term || term.length == 0) {
    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10&" +
    "$filter=ContentTypeId eq '0x010300C4DB8202DDA58A4B979AC8C1D217117D'";
  }
  return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&" +
    "$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and " +
    "ContentTypeId eq '0x010300C4DB8202DDA58A4B979AC8C1D217117D'&$top=10";
}
Replace Id in the code above with your content type Id.

User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

04 Dec 2014

I have 5 content types on the spform.And I have a cross-site lookup up column.It name ise SubBusinessLine.

I put content type columns and SubBusinessLine columns to all content type pages(5 page).My page changing which content type selected.But I can not lookup column filter by which content type selected.SubBusinessLine column must be filter by content type column.We can see content type like column on designer but on the list settings there hasn't any column fot content type,

User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

04 Dec 2014

I want to use it like cascading drowndown.But first dropdown will be content type column.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

08 Dec 2014

You can use Content type as any other field. Just drop it onto your form in Forms Designer and you will be able to get the selected content type Id via JavaScript:

Code: Select all

fd.field('ContentType').control()._el().find('select').val()
Use the selected value in the Request items template as I demonstrated above to filter the dependant Cross-site Lookup field.

User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

09 Dec 2014

I resolved this problem using different long way.

I have many content type and many pages on form designer.I created text column which has content type name.

And I set this column manuel(with javascript) for all content type pages.And then I got this field value from cross-site lookup.

But I will try your short way.

Thanks for your reponse..

User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

09 Dec 2014

I resolved this problem using different long way.

I have many content type and many pages on form designer.I created text column which has content type name.

And I set this column manuel(with javascript) for all content type pages.And then I got this field value from cross-site lookup.

But I will try your short way.

Thanks for your reponse..

User avatar
Mostafa Mohamed
Posts: 6
Joined: Tue Jul 26, 2016

27 Jul 2016

Although i have 2 content types on my list i can't find the content type column on forms designer to include it on my form and get its value.

please advice

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

27 Jul 2016

Hi,

If you're using SharePoint Online, you can display the content type field in the read-only mode only by placing Plain or Rich text control with the following content:

Code: Select all

[ContentType]

User avatar
Mostafa Mohamed
Posts: 6
Joined: Tue Jul 26, 2016

27 Jul 2016

how do i get the value of this plain text control via javascript ?

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests