I am moving!
Posted by anonymou | Posted in Uncategorized | Posted on 02-10-2009
0
If anyone finds this blog, I am currently in the process of moving from Typepad. My blog can be found at www.wookiecrm.typepad.com
If anyone finds this blog, I am currently in the process of moving from Typepad. My blog can be found at www.wookiecrm.typepad.com
Finally, I manged to take and pass the Microsoft Dynamics Extending Exam yesterday. The exam itself is relatively straight forward, but there are one or two tricky areas to do with deployment across multiple platforms.
Next stop the Applications Exam and then on to SQL and formal .Net qualifications.
Many thanks Adi Katz
//Activity scheduledend options
var ActivityOptions =
{
All : "All",
Overdue :"Overdue",
Today :"Today",
Tomorrow :"Tomorrow",
Next7Days :"NextXDays;7",
Next30Days :"NextXDays;30",
Next90Days :"NextXDays;90",
Next6Months :"NextXMonths;6"
}
//Activity History actualend options
var HistoryOptions =
{
All : "All",
Today : "Today",
Yesterday : "Yesterday",
Last7Days : "LastXDays;7",
Last30Days : "LastXDays;30",
Last90Days : "LastXDays;90",
Last6Months : "LastXMonths;6",
Last12Months: "LastXMonths;12"
}
var _loadarea = loadArea;
loadArea = function(areaid)
{
//load the iframe
_loadarea(areaid);
if( areaid != "areaActivityHistory" &&
areaid != "areaActivities" ) return;
//create the iframe object
var iframe = document.getElementById(areaid + "Frame");
//wait until the iframe is fully loaded ("complete")
iframe.onreadystatechange = function()
{
if( iframe.readyState == "complete")
{
var picklist,option;
//reference to the iframe document
var iframeDoc = iframe.contentWindow.document;
switch(areaid)
{
case "areaActivityHistory":
picklist = iframeDoc.all.actualend[0];
/* change to suit your needs */
option = HistoryOptions.All;
break;
case "areaActivities":
picklist = iframeDoc.all.scheduledend[0];
/* change to suit your needs */
option = ActivityOptions.All;
break;
default: return;
}
picklist.value = option;
picklist.FireOnChange();
}
}
}
Finding SQL objects that contain a particular string
The definition of SQL objects can be accessed via the sys.syscomments view in the SQL database, and can be queried. The following example returns the name of objects that contain 'Test' somewhere within the definition. The object_name function is a quick way to get the name of an object from its id – the other way is to join to the sys.objects view.
select distinct object_name(id) from sys.syscomments where text like '%Test%'
Note that this only works if the SQL object definition was not encrypted with the WITH ENCRYPTION option
Granting Permissions to a set of objects
I've yet to find a good user-interface in SQL for setting permissions on a set of objects quickly, so I tend to use SQL commands. The following procedure shows how to use a cursor to iterate through a set of objects and execute a dynamically-built GRANT statement on them
declare cur cursor fast_forward for
select name from sys.objects
where type = 'V' and name like 'vw_%' — Get all views, beginning vw_
declare @obj sysname, @sql nvarchar(2000)
open cur
fetch next from cur into @obj
while @@fetch_status = 0
begin
set @sql = 'GRANT SELECT ON ' + @obj + ' TO public'
– grant select permission to public
exec (@sql)
fetch next from cur into @obj
end
close cur
deallocate cur
Outputting stored procedure information to a table
There are cases when you might want to use the results of a stored procedure in a table structure for future processing. There's not an EXECUTE INTO statement but you can use INSERT … EXECUTE. You can also use this with dynamically constructed SQL, using EXECUTE (@sql). The following example uses both EXECUTE syntaxes, andshows how to iterate though the names of 'tables' from a linked server – this is used to query Excel spreadsheets where there is a dynamic range of identically structured worksheets
create
table #excelsheets — Store names of spreadsheets in Excel
( TABLE_CAT sysname null
,TABLE_SCHEM sysname null
,TABLE_NAME sysname not null
,TABLE_TYPE sysname null
,REMARKS nvarchar(255) null )
insert #excelsheets execute sp_tables_ex 'EXCELDYNAMIC'
– EXCELDYNAMIC is a linked server
create table #tmp
– Temporary storage of data, so results can be output as one result set
( TABLE_NAME sysname
,[Month] int
,[Target] decimal(10,2) )
declare cur cursor fast_forward
for select TABLE_NAME from #excelsheets
declare @tbl sysname, @sql nvarchar(4000)
open cur
fetch next from cur into @tbl
while @@fetch_status = 0
begin
– Build dynamic SQL statement. It would be nice to pass the statement as a parameter to OPENQUERY, but that's not permitted
set @sql = 'Select ''' + @tbl + ''' as TABLE_NAME, [Month], [Target] FROM EXCELDYNAMIC…[' + @tbl + ']'
insert #tmp exec (@sql)
fetch next from cur into @tbl
end
– Cleanup and output results
close cur
deallocate cur
select * from #tmp
drop table #tmp
drop table #excelsheets
Is the user creating a new record?
crmForm.FormType == 1
Is the user updating an existing record
crmForm.FormType ==2
Is the user unable to update this record?
crmForm.FormType == 3
Is this record deactivated?
crmForm.FormType == 4
Is the user using the Quick Create form?
crmForm.FormType == 5
Is the user using the Bulk Edit form?
crmForm.FormType == 6
What is the unique ID for this record?
= crmForm.ObjectId
What type of record is this?
= crmForm.ObjectTypeCode
What type of record is this (Entity Name)?
= crmForm.ObjectTypeName
Is the user using the Outlook Client?
crmForm.IsForOutlookClient==true
Is the user using the Outlook Light Client?
crmForm.IsForOutlookLightClient == true
Is the user working On line?
crmForm.IsOnline==true
Have any fields in this form been changed?
crmForm.IsDirty==true