Skip to content

Commit

Permalink
Merge pull request #596 from jetstreamapp/bug/586
Browse files Browse the repository at this point in the history
Namespace fields not included in record to apex
  • Loading branch information
paustint authored Oct 21, 2023
2 parents 8f86704 + b04c1dd commit 3738a16
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,8 @@ export const QueryResultsGetRecAsApexModal: FunctionComponent<QueryResultsGetRec
setFieldMetadata([]);
setFieldTypesByName({});
const metadata = await describeSObject(org, sobjectName);
// metadata will include namespace, but when we get the record from Salesforce it will not include the namespace
if (org.orgNamespacePrefix) {
const replaceRegex = new RegExp(`^${org.orgNamespacePrefix}__`);
metadata.data.fields = metadata.data.fields.map((field) => {
return { ...field, name: field.name.replace(replaceRegex, '') };
});
}
const fieldTypeByApiName = metadata.data.fields.reduce((output: MapOf<FieldType>, field) => {
const replaceNamespace = org.orgNamespacePrefix ? `${org.orgNamespacePrefix}__` : '';
output[field.name.replace(replaceNamespace, '')] = field.type;
output[field.name] = field.type;
return output;
}, {});
setLoading(false);
Expand Down

0 comments on commit 3738a16

Please sign in to comment.