Skip to content

Commit c531d41

Browse files
committed
removed separate paragraph about excluded documents and put sample code in the main sample.
removed random `a` in the html
1 parent a507762 commit c531d41

1 file changed

Lines changed: 23 additions & 29 deletions

File tree

  • content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos

content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/consistency-checks.md

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,30 @@ export const component: IComponent = {
168168
k => k.$ID === data.configConstant!.id
169169
);
170170

171-
const constant = constants.find(c => c.$ID === data.configConstant!.id) ?? null;
172-
173-
if (constant && constant.type.$Type !== "DataTypes$StringType") {
174-
result.push({
175-
errorCode: WRONG_CONSTANT_TYPE,
176-
errorDescription: `Constant '${data.configConstant.name}' must be of type String`,
177-
severity: "error",
178-
elementText: "Config Constant",
179-
propertyName: "configConstant"
180-
});
181-
}
171+
const constant = constants.find(c => c.$ID === data.configConstant!.id);
182172

183173
if (constant) {
184-
dependentElementIds.push(data.configConstant.id);
174+
if (constant.excluded) {
175+
result.push({
176+
errorCode: DOC_EXCLUDED,
177+
errorDescription: "Referenced document is excluded",
178+
severity: "error",
179+
elementText: "Config Constant",
180+
propertyName: "configConstant"
181+
});
182+
}
183+
184+
if (constant.type.$Type !== "DataTypes$StringType") {
185+
result.push({
186+
errorCode: WRONG_CONSTANT_TYPE,
187+
errorDescription: `Constant '${data.configConstant.name}' must be of type String`,
188+
severity: "error",
189+
elementText: "Config Constant",
190+
propertyName: "configConstant"
191+
});
192+
}
193+
194+
dependentElementIds.push(data.configConstant.id);
185195
}
186196
}
187197

@@ -379,7 +389,7 @@ function PersonEditor(input: { studioPro: StudioProApi; documentId: string }) {
379389

380390
<div style={{ marginTop: 16 }}>
381391
<button onClick={selectConstant}>Select Config Constant (must be String)</button>
382-
</div>a
392+
</div>
383393
{person.configConstant && (
384394
<div style={{ marginTop: 8 }}>
385395
Selected: {person.configConstant.qualifiedName}
@@ -413,22 +423,6 @@ Return `dependentElementIds` to tell Studio Pro which elements your document dep
413423
Without dependency tracking, your checks only run during full consistency check runs. With dependency tracking, checks run immediately when referenced elements change.
414424
{{% /alert %}}
415425

416-
### Excluded Documents
417-
418-
If a document you reference is excluded, you must check for it using the following code:
419-
420-
```typescript
421-
const customDoc = await studioPro.app.model.customBlobDocuments.getDocumentById(refId);
422-
423-
if ("document" in customDoc && customDoc.document.excluded) {
424-
result.push({
425-
errorCode: DOC_EXCLUDED,
426-
errorDescription: "Referenced document is excluded",
427-
severity: "error"
428-
});
429-
}
430-
```
431-
432426
### Changed Elements
433427

434428
When one of your dependencies gets modified in Studio Pro, you can return a consistency error based on that change. To be notified when any element (document or entity) changes, subscribe to the `documentsChanged` event.

0 commit comments

Comments
 (0)