Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > How do I find a customer using UUID?

Forum

Search UsersRules
How do I find a customer using UUID?
#1
Just came
Points:: 0
Joined:: Oct 9, 2018

Hello

There are two catalogs.
Catolog1: CustomerName, CustomerCountry
Catolog2: RefCatolog1, CustomerEmail

I want to add a record to the second table with the web service.

The application steps are as follows:
1- User logs in to the application.
2- The customer reference area is searched from the catalog. (Ref)
3- The UUID value is transferred to a variable.

The steps I want:
1- Sending records with web service.
2- Find the customer from UUID.
3- Adding records to catalog 2.

kayitref =
 catalogs.catolog1.findbyattribut to (xxxx

How do I find a customer using UUID?

Profile
#2
Active user
Points:: 0
Joined:: Jul 3, 2013

Hi Erdoğan Uğuz!

You can function GetRef() to get a CatalogRef by value UUID

Code
Customer = Catalogs.Customers.GetRef(New UUID("134f908b-67f1-11e5-80c4-d4ae52ba0811"));

Profile
#3
Just came
Points:: 0
Joined:: Oct 9, 2018

Hi.

I do it this way.
I can't reach line values.
It gives an error.

Example

Customer = Catalogs.Customers.GetRef(New UUID("134f908b-67f1-11e5-80c4-d4ae52ba0811"));

findedrow = Customer.ref.GetObject();

varcustomerdesc = findedrow.Description; // ?? error

Profile
#4
Interested
Points:: 0
Joined:: Dec 4, 2017

Dear Erdoğan Uğuz,

Here is an infobase copy (.dt) of a sample that illustrates the behavior you mentioned:

https://mega.nz/#!yGQTVaRA!V7ttIjQijk6vtLTvvpT6AvCY2KM638mBfwt2nnof9VA

Best regards,
Vladimir Gurov

Profile
#5
Just came
Points:: 0
Joined:: Jan 5, 2016

Erdoğan Uğuz,

GetObject() return Undefined if GetRef(UID) didn't find object in db.
Another word, GetRef() by UID, that don't yet in db, gives you a new kind of Ref.
That why, you need to check searching result by condition:

Code
Catalog1Ref = Catalogs.Catalog1.GetRef(New UUID(Catalog1UUID));
If Catalog1Ref.GetObject() = Undefined Then
   //Can't find the reference with UUID...
EndIf;


P.S.
By the way, the condition "ValueIsFilled(Catalog1Ref)" will always be true.

Profile
Subscribe
Users browsing this topic (guests: 2, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.