Hi
My compliance department has asked if we could create a report once a month for them stating what requests their team has approved or denied.
I have had a quick look through the forum and found the following script to be perfect, apart from the the fact that it will not pick up who approved the request, stating N/A in each occasion.
So basically I need the report to list
* Request ID
* Title
* Requester
* Request Date
* Approval Status
* Approved By
On a monthly basis.
I believe I need to ask the query to search for the email address to fill out the Approved by Column (I have highlighted this area), however I don't know what to enter in.
select wo.WORKORDERID 'Request ID', wo.TITLE 'Title', au.FIRST_NAME 'Requester',dateadd(s,wo.CREATEDTIME/1000,'01-01-1970') 'Request Date', asd.STATUSNAME 'Approval Status', au1.FIRST_NAME 'Approved by' from WorkOrder wo left join WorkOrderStates wos on wo.WORKORDERID=wos.WORKORDERID left join WorkOrder_Threaded wot on wo.WORKORDERID=wot.WORKORDERID left join ApprovalStatusDefinition asd on wos.APPR_STATUSID=asd.STATUSID left join AaaUser au on wo.REQUESTERID=au.USER_ID left join ApprovalStageMapping asm on wo.WORKORDERID=asm.WORKORDERID left join ApprovalDetails ad on asm.APPROVAL_STAGEID=ad.APPROVAL_STAGEID left join SdUser sd on ad.APPROVEDBY=sd.USERID left join AaaUser au1 on sd.USERID=au1.USER_ID where wot.WORKORDERID=wot.THD_WOID and (asd.STATUSNAME='Approved' or asd.STATUSNAME='Denied') and dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.CREATEDTIME/1000),'1970-01-01 00:00:00') >= convert(varchar,'
2011-10-01
00:00',21) and dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.CREATEDTIME/1000),'1970-01-01 00:00:00') <= convert(varchar,'
2011-10-31
23:59',21)
Any help would be appreciated.
Thanks
Lowenna