@@ -442,7 +442,40 @@ export class Entry<
442442 field : registryField . targetValueField ,
443443 } ;
444444 }
445-
445+ if ( this . _systemGlobal ) {
446+ // if this is a cloud_global entryType, check if the target is account-scoped, and batch update per-account
447+ const { systemGlobal, name } = this . _orm . getEntryType (
448+ registryField . targetEntryType as EntryName ,
449+ ) ;
450+ if ( ! systemGlobal ) {
451+ const sysOrm = this . _orm . withUser ( this . _orm . systemGobalUser ) ;
452+ const { rows : accounts , rowCount } = await sysOrm . getEntryList (
453+ "account" ,
454+ {
455+ columns : [ "id" ] ,
456+ limit : 0 ,
457+ } ,
458+ ) ;
459+ // this._inCloud.inLog.warn(
460+ // `${name} is not global, batch update of ${fieldKey} from ${this._name} for ${rowCount} accounts`,
461+ // { compact: true },
462+ // );
463+ for ( const { id } of accounts ) {
464+ const orm = this . _orm . withAccount ( id ) ;
465+ await orm . batchUpdateField (
466+ registryField . targetEntryType ,
467+ field ,
468+ this . _modifiedValues . get ( fieldKey ) ! . to ,
469+ [ {
470+ field : registryField . targetIdField ,
471+ op : "=" ,
472+ value : this [ "$id" as keyof typeof this ] as string ,
473+ } ] ,
474+ ) ;
475+ }
476+ continue ;
477+ }
478+ }
446479 await this . _orm . batchUpdateField (
447480 registryField . targetEntryType ,
448481 field ,
0 commit comments