cancel
Showing results for 
Search instead for 
Did you mean: 

How to fetch the parent of a dependent object?

Former Member
0 Kudos
462

Hello Cloud Application Studio developers,

we're currently implementing a custom address validation in C4C, version 1602.

Basically we're extending the business object PartnerAddress:

  • An address of an organization or a group, or the address of a person.

We will call a web service which will perform the desired validation. Now besides the address fields, further information is required: e.g. whether the address to check is a company or individual address.

But for the dependent object PartnerAddress, unfortunately the associations ToParent or ToRoot  don't exist in the PSM. So how can be determined, from which BO the dependent object was used? How to navigate backwards?

Is there any runtime call which could help?

Or would you suggest a different approach for address validation?

Thanks in advance for any hints and assistance.

Best regards,

Christian.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member186648
Active Contributor
0 Kudos

Hi Christian,

In the PartnerAddress Validation-OnSave event, do the following:

Call Retrieve on all the host BO passing host UUID till you get result.

Ex:
call Retrieve on Customer if result is empty,

call Retrieve on Employee if result is found, then you know which is the host BO.

Thanks, Pradeep.

Former Member
0 Kudos

Hello Pradeep,

thanks for your suggestion.

Unfortunately I'm afraid that the suggested approach wouldn' t work: the PartnerAddress contains only the field UUID, which points to the current PartnerAddress instance. I cannot see any other host UUID of a Customer or Employee BO. Perhaps I miss something?

Is there a way to find the required UUID by calling some runtime help function?

Thanks,

Christian.

former_member186648
Active Contributor
0 Kudos

Hi Christian,

Dependent Object will have ParentNodeID using which you could retrieve the Parent , i guess in this case it is not PSM released, hence you are not able to see this element.

You could request for PSM release.

Thanks, Pradeep.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Christian,

There is an element called TypeCode at the Root node fo th DO PartnerAddress.

This element tells you which kind (aka type) of address it is

  • Person
  • Organisation
  • Contact
  • ...

I suggest to request a PSM release for this element.

Bye,

   Horst

Former Member
0 Kudos

Hello Horst,

thanks for the additional information and your suggestion.

Now I've requested both via the related C4C incident:

* ParentNodeID (requested 07-APR-2016)

* TypeCode (requested today)

I'm looking forward to receiving a response from Cloud support.

Best regards,

Christian.

former_member190818
Active Contributor
0 Kudos

Hello Christian,

In the PatnerAddress documentation, it says


"The dependent object Partner Address must be hosted by a business object of the type business partner (for example, Customer or Employee). The Partner Address is hosted on the Address Information node of the business partner business object. (The Address Information node also has an association to the business object Address Snapshot. For further details, see the corresponding documentation.)"

I believe you should be using Customer or Employee BO's instead of using directly PartnerAddress BO.

Let us know if you are having only address information and trying to look for the details.

Regards,

MB

Former Member
0 Kudos

Hello Mohan,

thanks for your answer.

If following your suggestion, I'd probably need to implement the logic twice which leads to duplicate source code, isn't it?

Best regards,

Christian.

former_member190818
Active Contributor
0 Kudos

Hello Christian,

Yes, you might have to write code in Customer or Business Partner BO and validate the address. As PartnerAddress is dependent object, I am not sure whether you can directly use it for validation.

Do you have any ID corresponding to Customer or Business Partner in your web service?

Can you please let us know how are you going to validate address i.e. by any address uuid?

Or you can create custom BO and have validation there at one place by checking customer or individual person, etc.

Thanks.

Regards,

MB

Former Member
0 Kudos

Hello Mohan,

the address validation is working fine using an extension of PartnerAddress.

In the Validation-OnSave action, we call an  external web service implemented in the connected ERP system, which we access through PI.

I'd strive to avoid copying this code into

  • Persons,
  • Organizations,
  • Employees
  • any other?

BO extensions.

Is it really impossible to query the runtime framework to find out, which Business Object is accessing the current PartnerAddress instance? Or could this webservice query moved into a custom library, which then would be called from different places?

Best regards,

Christian.

former_member190818
Active Contributor
0 Kudos

Hello Christian,

You can try raising incident with SAP for accessing PartnerAddress directly.

Regards,

MB