[Human Readable Change History] Reserved word 'Name' seems to be causing an issue

[Human Readable Change History] Reserved word 'Name' seems to be causing an issue

Forge Component
Published on 2017-11-28 by Johan den Ouden
20 votes
Published on 2017-11-28 by Johan den Ouden
Gents - love this component!  Deployed and finding great value.  One thing I was hoping you might be able to help me with.  I'm attempting to track changes on a two columns that reference the User table.  Note:  I'm in a multi-tenant environment.  

All of my fields diff correctly except the UserID fields.  I get this error:
Error in advanced query GetReferencedRecord_Original_OSSYS in Translation_GetValuesFromReferencedEntity in DiffEntityDataToText (EXEC ('SELECT '+@NameAttribute+'   FROM ossys'+@PhysicalTableName+' WHERE '+@IdAttribute+' = '+@RecordId+'')): Incorrect syntax near 'Name'.

I went into the referenced component and added brackets like this [@NameAttribute]...thinking it would allow me to reference the reserved this way; no such luck.  

Does anyone have any suggestions?  Many thanks in advance.


Hi Ameet,

Did you find a solution for this problem?

Best regards,
No.  Unfortunatley not.  Had to simply not track those fields.  Unfortunate.  
Ameet, can show us how the query got after quoting the identifier with brackets (ie: changing to [@NameAttribute])?

Hi Ammet and Miguel,

I found a solution to this problem, you just have to remove the "EXEC" function.

In fact, as the parameters are marked with Expanded line = Yes you don't need it.

Fixed Advance Query: 

SELECT @NameAttribute
FROM ossys@PhysicalTableName
WHERE @IdAttribute = @RecordId

Best regards,
Argh! I couldn't find this in the Forge to look for answers to this issue... and I found/fixed the same issue that Ricardo posted the fix for!

Hi Justin, maybe you also want to check this one:

Ricardo -

Thanks! I just joined the team on this component, so I can post the patched version. :)

Turns out that the fix also needed to be applied to a few additional queries, a fixed version is being uploaded in a moment...