How do I find a customer using UUID?

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 9, 2018
Company: Ötüken Teknoloji Araştırma Geliştirme Eğitim Hizmetleri Ticaret Limited Şirketi

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?

 
#2
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 3, 2013
Company: TRIAX

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"));

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 9, 2018
Company: Ötüken Teknoloji Araştırma Geliştirme Eğitim Hizmetleri Ticaret Limited Şirketi

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

 
#4
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

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

1C Company support team
 
#5
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Jan 5, 2016
Company:

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.

Edited: Alexey Bendarik - Jan 06, 2019 07:27 PM (add P.S.)
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.