The #Codes are a set of codes that indicate to CRM as the dll parses the Meta data it should substitute these references with internal function calls. These are for use where SQL is used directly as the control mechanism to limit the data returned.
#U - CurrentUser ID - Used in Escalation Rules, Dashboard Blocks and OrderQuotes
#L - CurrentUser Logon - Used in Escalation Rules and Dashboard Blocks
#T - Current System Date/Time - Used in Escalation Rules and Dashboard Blocks
#C - CurrentUser TeamID - Used in Escalation Rules, Dashboard Blocks and OrderQuotes
#D - CurrentUser Team Name - Used in Escalation Rules and Dashboard Blocks
#R - Recent List Info - Only Used in Dashboard Blocks
#O - Current Opportunity ID - Only Used in OrderQuote Configuration
#N - Current Version of Order/Quote - Only Used in OrderQuote Configuration
Usage in Escalation Rules The escalation rule (Communication Reminder) that is provided by default within the system to create on screen notification for meetings and tasks is based on the vEscalationComms view.
To examine the rule go to
Administration -> Advanced Customization -> Escalation The where clause used is
Escl_DateTime<#T And Escl_UserID=#U AND Upper(RTRIM(comm_status))=N'PENDING'
This shows how the #T and #U system variables are referenced. When the rule is processed the #T and #U are substituted for functions that generate the actual SQL that is run.
For the above “Communication Reminder” rule the actual SQL would look like this:
select * from vEscalationComms WITH (NOLOCK) WHERE Escl_DateTime<'20060922 07:52:45' And Escl_UserID=1 AND Upper(RTRIM(comm_status))=N'PENDING' ORDER BY Comm_CommunicationId
The #T has been substituted for the current System Date/Time, the equivalent of a getDate() function or sysdate reference depending on RDBMS used.
The #U has been substituted for the current users unique ID. It should be noted that this #Code can only be used for rules that depend on a user being logged on to the system.
Usage in Order Quotes The example usage of the #Codes to generate the IDs for Orders and Quotes can be found at:
Administration -> Data Management -> Products The QuoteFormat field within the Product Configuration screen has a default value of
QT-#O/#N
#O will be subsituted for the current Opportunity ID and the #N the number of the Quote within the opportunity. Only #Codes that generate numeric returns are suitable for use here.
#Codes and SQL The #Codes are not allowed to used in the following circumstances:
Tab SQL – Tab SQL uses its one special codes (U:, C:, T: ) which are discussed elsewhere.
Field SQL