Document Find By reference

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 27, 2023
Company:

Hi friends,

   How to find document by reference, this code doesnt work

  CurrDocument = Documents.SalesInvoice.FindByAttribute("Ref",DocumentRef).GetObject();    
  CurrDocument.XXX = XX;    
  CurrDocument.Write();

 
#2
People who like this:0Yes/0No
Administrator
Rating: 33
Joined: Oct 3, 2019
Company:

Hello Selim,

in your case, it is better to do it this way:

Code
DocumentObject = DocumentRef.GetObject();

DocumentObject.XXX = XX;    
DocumentObject.Write();


Since you already have Ref to the document, you don't need to search for it. Just get the object from the Ref and then work with the Object.

 
#3
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 27, 2023
Company:

That's right, thank you very much :)

 
Subscribe
Users browsing this topic (guests: 2, 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.