Use elements of different content types - Plone 5

Guys ,
I have created two content types.
1. Customer
2. Loan Request
The customer content type has a field called "Customer Name" I want to use that in the loan request page. I have used default view for the content types to display in the UI screen.

customers.py

from plone.dexterity.browser.view import DefaultView
from plone import api

class CustomersView(DefaultView):
	"""Sample Browser view"""

loanrequest.py

from plone import api
from Products.Five.browser import BrowserView
from plone.dexterity.browser.view import DefaultView

class LoanRequestView(DefaultView) :
	'''Loan Request View'''

Kindly help me with this query

What is the question here?

Inside any view you can perform arbitrary queries (portal_catalog) or use acquisition or resolving a reference for getting hold of related content objects (it is up to you how you defined your object relations - either through references, containment or any other logic). If you have the other object then you can display the related attributes as needed.

-aj

Sorry I don't get it. I need to use the field in the customer content type inside the loan request page

You'll want to use RelationFields / RelationValues

https://training.plone.org/5/mastering-plone/relations.html

Not necessarily. In many cases it is more natural using containment for structuring data that belongs together.

can u give me an example

An example for what? Plone is organized hierarchical in folders and it is obvious that could can create container or folderish objects for storing other content that belongs to this particular folder. A customer could be folder containing LoanRequests as sub content inside.

@AnanthaBalaji being a non-programmer while I am not competent to evaluate your query, I don't think content types is the way forward to what you want to do. I have built applications using the add on Plomino which is available for plone 5.0. you may either use that or try to figure out your answer by exploring how Plomino does it.

Your task consists of two subtasks: 1. access fields of a given object and 2. access the object you want the fields for.

From what I understand, you already know how to perform the first subtask. If not, read the dexterity tutorial or/and look at existing examples.

The official way to access the parent of an object in the modern world (of Plone 5) is

from zope.location.interfaces import IContained
parent = IContained(obj).__parent__

I got what you are trying to say. But can you redirect me to a link where I will get the example for the second subtask. I am really thankful to you guys. The zope.location.interfaces is not present for plone 5

Are you sure?

My Plone 5.0.x installation contains zope.location==3.9.1 and, of course, it (like any other version) has an interfaces module.

can you help me with the source from which you refered.

I cannot because I do not understand your problem.

Almost surely, your Plone (apparently some version 5) has zope.location.interfaces and with it you can find the parent of an object like I have shown in a previous response.

dexterity content types likely implement the IContained interface directly. In this case, you can use obj.__parent__ to access obj's parent. The previously described "official way" (explicitly adapting obj to IContained) is safer, however, as it does not require that obj itself implements IContained, it is sufficient that it can be adapted to it.