Smartobject with data from several CRM entities

  • 7 May 2018
  • 1 reply
  • 0 views

Hello,

 
I would like to have a SmartObject that displays data from our Microsft Dynamics 2013. And I would like to have data from several entities in the same SmartObject but I can't find how to create the relationship between the entities in K2.

 

For exemple, I want to have a Smartobject that displays information of a contact (Contacts entity) like name, email, phone number and in the same row, information of the contact's parent account (Account entity). How can I configure a relationship between Contact and Account entities in K2?

 

I have created all my CRM entities as Smartobjects using the CRM Service Type in K2.

 

Smartobjects associations doesn't seem to work for what I want. I also tried the Composite Smartobject but as my two Smartobjects come from the same service, it doesn't seem to work either.

 

Any help would be really appreciated!


1 reply

Badge +1

Hi Remi

 

You should be able to do this with a composite SmartObject. The trick here is to find the matching key between contact and account.

 

In my CRM instance, the Contact SmartObject has an "Account" field, but I noticed that nothing gets returned when I read or list contacts. But there is a "Company Name" field which returns the GUID that matches the contact's Account.

 

Create a new SmartObject (using K2 Studio) and remove all methods.

 

For the read method:

 

 Add a new read method. Add the service object method for Contact.Load and return the properties that you want (including Company Name). Then add another service object method for Account.Load. Make sure you map the input for Account to the Company Name (returned from the Contact)

 

For the list method:

 

Add a new list method to your smartobject. Add the service object method for Contact.GetList and return the properties that you want (including Company Name). Then add the service object method for Account.GetList and return the properties that you want (including Account). In the next screen map the links between the service objects: Contact.Company name matches Account.Account 

Reply