@dataverse-kit/export-engine 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -24947,19 +24947,21 @@ export async function handleCommandClick(
24947
24947
  case 'activate':
24948
24948
  case 'deactivate': {
24949
24949
  if (!requireSelection(ctx, item.actionType)) return;
24950
- const isActivate = item.actionType === 'activate';
24951
- const statecode = isActivate ? 0 : 1;
24952
- const statuscode = isActivate ? 1 : 2;
24950
+ // Set only statecode (0=Active / 1=Inactive); Dataverse applies the entity's default status
24951
+ // reason. Hardcoding statuscode 1/2 was wrong for entities with custom status reasons. The
24952
+ // bulk-edit form prefills statecode and lets the user pick the reason. (Same fix as the
24953
+ // subgrid dispatcher; opportunity/lead/incident still need Win/Qualify/Close \u2014 unchanged.)
24954
+ const statecode = item.actionType === 'activate' ? 0 : 1;
24953
24955
  if (ctx.selectedIds.length > 1) {
24954
24956
  await Xrm?.Navigation?.openBulkEditForm?.({
24955
24957
  entityName,
24956
24958
  entityIds: ctx.selectedIds,
24957
- formParameters: { statecode, statuscode },
24959
+ formParameters: { statecode },
24958
24960
  });
24959
24961
  await ctx.refreshGrid();
24960
24962
  return;
24961
24963
  }
24962
- await Xrm?.WebApi?.updateRecord?.(entityName, ctx.selectedIds[0], { statecode, statuscode });
24964
+ await Xrm?.WebApi?.updateRecord?.(entityName, ctx.selectedIds[0], { statecode });
24963
24965
  await ctx.refreshGrid();
24964
24966
  return;
24965
24967
  }
package/dist/index.mjs CHANGED
@@ -24927,19 +24927,21 @@ export async function handleCommandClick(
24927
24927
  case 'activate':
24928
24928
  case 'deactivate': {
24929
24929
  if (!requireSelection(ctx, item.actionType)) return;
24930
- const isActivate = item.actionType === 'activate';
24931
- const statecode = isActivate ? 0 : 1;
24932
- const statuscode = isActivate ? 1 : 2;
24930
+ // Set only statecode (0=Active / 1=Inactive); Dataverse applies the entity's default status
24931
+ // reason. Hardcoding statuscode 1/2 was wrong for entities with custom status reasons. The
24932
+ // bulk-edit form prefills statecode and lets the user pick the reason. (Same fix as the
24933
+ // subgrid dispatcher; opportunity/lead/incident still need Win/Qualify/Close \u2014 unchanged.)
24934
+ const statecode = item.actionType === 'activate' ? 0 : 1;
24933
24935
  if (ctx.selectedIds.length > 1) {
24934
24936
  await Xrm?.Navigation?.openBulkEditForm?.({
24935
24937
  entityName,
24936
24938
  entityIds: ctx.selectedIds,
24937
- formParameters: { statecode, statuscode },
24939
+ formParameters: { statecode },
24938
24940
  });
24939
24941
  await ctx.refreshGrid();
24940
24942
  return;
24941
24943
  }
24942
- await Xrm?.WebApi?.updateRecord?.(entityName, ctx.selectedIds[0], { statecode, statuscode });
24944
+ await Xrm?.WebApi?.updateRecord?.(entityName, ctx.selectedIds[0], { statecode });
24943
24945
  await ctx.refreshGrid();
24944
24946
  return;
24945
24947
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataverse-kit/export-engine",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",