Skip to content

Commit

Permalink
Merge pull request 1c-syntax#3212 from 1c-syntax/translations_docs-di…
Browse files Browse the repository at this point in the history
…agnostics-usingfindelementbystring-md--develop_en

Updates for file docs/diagnostics/UsingFindElementByString.md in en
  • Loading branch information
theshadowco authored Dec 18, 2023
2 parents b174b48 + 7f4f4e7 commit 061e2e1
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions docs/en/diagnostics/UsingFindElementByString.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
# Using FindByName, FindByCode and FindByNumber (UsingFindElementByString)
# Using FindByName, FindByCode and FindByNumber (UsingFindElementByString)

<!-- Блоки выше заполняются автоматически, не трогать -->
## Description

It is forbidden to use the search methods for elements "FindByName" or "FindByCode".
The rule finds the use of the `FindByName`, `FindByCode` or `FindByNumber` methods using specific numbers, codes and names of elements or documents.
Similar code may not work correctly in other databases.
Often such code is test code included in the release version, which is also not recommended.

It is recommended to specify constant data values ​​from the database in "Сonstants" or predefined metadata elements.

## Examples

Incorrect:
```bsl
Position = Catalogs.Positions.FindByName("Senior Accountant");
```
or
```bsl
Position = Catalogs.Positions.FindByCode("00-0000001");
```

or

```bsl
Position = Catalogs.Positions.FindByCode("00-0000001");
Object = Documents.Invoice.FindByNumber("0000-000001", CurrentDate());
```

Acceptable use:
Expand All @@ -24,3 +33,7 @@ Catalogs.Currencies.FindByCode(CurrentData.CurrencyCodeDigital);
```bsl
Catalogs.BankClassifier.FindByCode(BankDetails.BIK);
```

```bsl
Documents.Invoice.FindByNumber(Number);
```

0 comments on commit 061e2e1

Please sign in to comment.