Skip to Content
0

Retrieving Address snapshot of a Business Partner - C4C

Jul 24, 2017 at 08:58 AM

184

avatar image
Former Member

Hi Experts,

I have a requirement to retrieve the current logged in users Address Snapshot details like the Country Code ,City and Communication details

.

I have used the following approach for my scenario.I have queried the Address Snapshot Business Object using the UUID of the Address Snapshot node of the Current logged in user.

But the query result is not retrieving a table with Address details of the given UUID instead it is again returning the same UUID.

I tried to query the Address Snapshot BO us

ing the UUID in Repository explorer but this particular BO is not having a query to execute.

Kindly help me in understanding the behavior of this BO and how to retrieve data from it.

Please let me know the approach which I need to follow to get the Address Information of a given BP.

Please find the screen shots for your reference.

Regards

Navin

scriptfile.jpg (78.5 kB)
addresssnapshot.jpg (183.0 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Saurabh Kabra
Jul 24, 2017 at 05:17 PM
0

Hi,

Current user Address will be stored in Employee BO and You can make use of following code to fetch the Address Related information from Employee BO.

import ABSL;
import AP.Common.GDT;
import AP.FO.BusinessPartner.Global;
import AP.PC.IdentityManagement.Global;

var new = Identity.Retrieve(Context.GetCurrentIdentityUUID());
if (new.IsSet())
{
	var ID = new.BusinessPartnerUUID.content;
	if ( !ID.IsInitial())
	{
		var BP = BusinessPartner.Retrieve(new.BusinessPartnerUUID);
		if ( BP.IsSet())
		{
			var EMP_ID = BP.Identification.GetFirst().BusinessPartnerID;
			var emp : EmployeeID;
			emp.content = EMP_ID;
			if (!EMP_ID.IsInitial())
			{
				var res = Employee.Identification.Retrieve(emp);				
				if (res.IsSet())
				{
					var data = res.ToRoot.CurrentDefaultEmployeeWorkplaceAddressInformation;
					if ( data.IsSet())
					{
						var city = data.EmployeeWorkplaceAddressOrganisationAddress.DefaultPostalAddressRepresentation.CityName;
					}
				}
			}
		}
	}
}




Thanks

Saurabh

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Saurabh,

Thanks for sharing the code.I still have a query when I use repository explorer for the same Employee I am not able to find the Address details but the values are available in the code level.

Could you please comment on this behavior.If the current logged in user is not a employee if he is just as Business User which node should I use to get the Address details.

Regards

Navin

0