Pages

Thursday, June 12, 2014

Dynamics CRM - Passing crm records id and Display report in the "Run on Current Record" menu section

1) Created SSRS report
2) Created 2 DataSets
    i) DSContact
          Query
              declare @sql as nVarchar(max)
              set @sql = 'SELECT fullname, contactid FROM (' + @CRM_FilteredContact+ ') as fc'
              exec(@sql)
          Field
             fullname - fullname
             contactid - contactid
          Parameters
             @CRM_FilteredContact - [@CRM_FilteredContact]

     ii) DSAuditHistory - sql query passing parameters @Contactid [@ContactID]

3)Created 3 parameters, all are visibility hidden
        i) CRM_FilteredContact - default values 'null'
        ii) ContactID - allow blank and null value,
                 default values - get value from a query(DataSet -  DSContact, value - contactid)
        iii) ContactName - allow blank and null value,
                 default values - get value from a query(DataSet - DSContact, value - fullname)

4)In CRM, Add New Report, select Existing File, selet contact entity name for related record type, select all the options for display in.


5)Go to contact form, select '...' -> Run Report -> Run on Current Report (your report will display here). , select your report, your report will display the record for selected records.



You can verify in the link , records query string contains selected record id.
CRMURL?action=run&context=records&helpID=AuditContactHistory.rdl&id=<ReportID>&records=%7bD664C52E-62EB-E311-89F7-0050568C6D7D%7d&recordstype=2

No comments:

Post a Comment