Monday 9 October 2017

How to Identify Error Line , Message in store Procedure (1)at time of Exception Handling .


CREATE TABLE [dbo].[tbl_dbLogs](
[LogSerialId] [int] IDENTITY(1,1) NOT NULL,
[Error_line] [int] NULL,
[ERROR_MESSAGE] [nvarchar](max) NULL,
[ERROR_PROCEDURE] [nvarchar](100) NULL,
[CreateDate] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO


Alter Procedure SP_PaymentToSupplierEmployee_Periodically
@tbl_OrganizationId nvarchar(50)
AS
BEGIN
SET NOCOUNT ON;
Begin try
SELECT  
COUNT(tbl_PaymentToSupplierEmployeeId) As TotalTransaction, DateName(wk,PaymentDate)As [Week],DateName(d, PaymentDate)As [days], DateName(dw,PaymentDate) As [DayName], DateName(m,PaymentDate) AS [month],
DateName(qq,PaymentDate) As [Quarter],DateName(yy, PaymentDate) As [Year],
SUM(Total) As TotalRevenue,  case when IsPosted='False' then count(IsPosted)end As pending,
CASE WHEN IsPosted='true' then count(IsPosted)end As Posted 
FROM tbl_PaymentToSupplierEmployee
--WHERE IsDeleted='False' And tbl_OrganizationId='42D1401E-EA99-42E2-8954-2969858CE625'
WHERE IsDeleted='False' And tbl_OrganizationId=@tbl_OrganizationId
GROUP BY PaymentDate,IsPosted
End try
Begin catch 
  insert into tbl_dbLogs([Error_line],[ERROR_MESSAGE],[ERROR_PROCEDURE],CreateDate)values(ERROR_LINE(),ERROR_MESSAGE(),ERROR_PROCEDURE(),GetDate())

End  catch
End


How to get logged in User's Security Roles using Java Script in dynamic CRM 365.

 function GetloggedUser () {     var roles = Xrm.Utility.getGlobalContext().userSettings.roles;      if (roles === null) return false;      ...