Using .merge() and trying to get back fields that were update/created


I am trying to do a merge and gett back the fields back that were created/updated/passed in:
targetGroup = MarketingTargetGroup.merge({name: 'testName', marketingOrg: {id: 'fakeOrg'}}, {include: 'name,'})

Merge works, however, only the name field is returned to me when the merge returns… I looked over the code and this seems to be the way it should be done. I even looked at the doc and tried that way:
targetGroup = MarketingTargetGroup.make({name: 'testName', description: 'descr', marketingOrg: {id: 'fakeOrg'}}, {include: 'name,'}).merge({include: 'name, marketingOrg, description'})

Still does not return me marketingOrg field. Looking at documentation, it doesn’t look like merge can take two arguments. Is there a way to get the object back with the fields specified?


@hehom Unfortunately you can’t. Note that the MergeSpec.include field overrides the base functionality in UpsertSpec.include to indicate the fields that are being merged instead of the base behavior for create/upsert/update where it indicates the fields being returned. You will have to fetch the fields you want afterwards. This is more of an inconvenience than a performance issue since we internally do the refetch anyway for the base behavior.


@trothwein Thanks for the response!