Skip to content

Commit f2c8068

Browse files
author
Shubham Agarwal
committed
Remove obsolete mobile GUID helper guidance
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 78870709-25fe-45d7-8669-dd0ba9470807
1 parent 7ffd79d commit f2c8068

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

plugins/mobile-apps/agents/screen-builder.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,16 @@ You will be invoked by `/create-mobile-app` Step 11 or `/edit-app` screen-rebuil
173173
- **If a create flow needs the new record immediately, pre-generate its Dataverse ID.** Do not navigate, upload, create child rows, or build lookup binds from `result.data?.<primaryid>`. Use the create-then-navigate rule below: call `newId()` from `@/utils`, include the primary ID field in the create payload, check `result.success`, then navigate/bind/upload using the ID you generated before the POST. This is the only safe pattern for flows like scandetail, create parentchild form, or create evidence rowupload image.
174174
- **Dynamic route IDs are untrusted.** Detail/edit/upload screens that read `useLocalSearchParams()` MUST normalize and validate the route ID before any Dataverse service call. Treat missing values and literal strings like `'undefined'` / `'null'` as invalid. Never pass `String(params.id ?? '')` directly into `Service.get(id)`, `Service.update(id, ...)`, or `Service.upload(id, ...)`; `enabled: !!id` is not enough because `'undefined'` is truthy. Required pattern:
175175
```ts
176-
const id = normalizeRouteId(params.id);
177-
const validId = isDataverseId(id);
178-
const query = useQuery({ enabled: validId, queryFn: () => Service.get(id) });
179-
if (!validId) return <MissingRecordIdState />;
176+
const params = useLocalSearchParams<{ id?: string | string[] }>();
177+
const rawId = Array.isArray(params.id) ? params.id[0] : params.id;
178+
const id = normalizeDataverseGuid(rawId);
179+
const query = useQuery({
180+
enabled: !!id,
181+
queryFn: () => Service.get(id!),
182+
});
183+
if (!id) return <MissingRecordIdState />;
180184
```
185+
Import `normalizeDataverseGuid` from `@/utils`. Do not invent alternate ID helpers or an inline UUID regex.
181186
- **Lookup writes use `@odata.bind`, NEVER raw GUIDs.** When a form creates or updates a record with a parent reference (TaskProject, CommentTask, InspectionSite, etc.), the foreign key field is set with the entity-bind syntax. Setting it any other way either silently saves `null` (data lossform looks like it succeeded) or 400s with a cryptic Dataverse error.
182187
- **Required pattern**open the generated target model and copy the exact quoted property ending in `@odata.bind`; value is `/<entitySetName>(<guid>)`:
183188
```ts

0 commit comments

Comments
 (0)