Wednesday, September 3, 2014

How to Schedule/Subscribe report based on the result set in SQL Server 2012 Standard Edition?


In SQL Server 2012 Enterprise Edition, Data Driven Subscription is out of box, however if you want to subscribe report in SQL Server Standard Edition, there is a workaround to achieve this. Follow the below approach..

Step 1 : You create one new  SQL Server Jobs
            Job 1 :  Create a step with below condition

IF EXISTS (SELECT Order # FROM OrderMaster Where Ordervalue >100000)

BEGIN

                EXEC msdb.dbo.sp_start_job N' [GUID of the Subscribed Report Job]'        ;

END;

 

Job 2: This job will be automatically created when you subscribe the report, and the below step will be available in the job

exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='501e69b6-6e70-4cc8-9b60-f3fb0f1c5777'

Step 2:

Make sure the Report which is scheduled as “Run Once” , and that execution is already completed.  The whole idea is to create another Schedule job , which will trigger a already expired Subscription on demand basis, and the new Job can be scheduled based on your cycle.

Wednesday, June 30, 2010

Jscipt for Color Picklist Color

Changing the color of a single option in a picklist

You can change the color and background color of an option element using the following syntax:

//TODO: Replace with the schema name of the picklist in question.
var list = crmForm.all.;

//using the first option here, you need to find the one you need.
var option = list.options[0];

//Set the background color to red.
option.style.backgroundColor = "#FF0000";

//Set the text color to white.
option.style.color = "#FFFFFF";

Thursday, June 3, 2010

Calling Workflow from Jscript

CRM 4.0: Use JavaScript execute/call/launch CRM Workflow
I have a question from my colleague: How to use JavaScript execute workflow in CRM 4.0? The question also repeats very often in CRM Forums, no answer so far.

In CRM 3.0, Mitch Milam has described how to Launching a Workflow Rule from JavaScript, it works great. However, in CRM 4.0, the class: ExecuteWFProcessRequest has been deprecated, so it won’t work in CRM 4.0. Although there are many ways to launch a workflow, if you want to run it through JavaScript, here’s the trick:

/* the function */ExecuteWorkflow = function(entityId, workflowId){ var xml = "" + "" + "" + GenerateAuthenticationHeader() + " " + " " + " " + " " + entityId + "" + " " + workflowId + "" + " " + " " + " " + "" + ""; var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Execute"); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.setRequestHeader("Content-Length", xml.length); xmlHttpRequest.send(xml); var resultXml = xmlHttpRequest.responseXML; return(resultXml.xml);}/* call */var theWorkflowId = "3FD2DD58-4708-43D7-A21B-F0F90A0AA9F2"; //change to your workflow IdExecuteWorkflow(crmForm.ObjectId, theWorkflowId);

Monday, December 28, 2009

How to hide Section in Dynamics CRM 4.0 Form ?

//Sample Code

if (crmForm.all.province_supportdeduction.DataValue==1)
{
//HideSection(tabindex,sectionindex,none/block);
HideSection( 0 , 2 , "none" );
HideSection( 0 , 3 , "none" );
HideSection( 0 , 4 , "block" );
}
else
{
HideSection( 0 , 2 , "block" );
HideSection( 0 , 3 , "block" );
HideSection( 0 , 4 , "none" );
}

// Function to Hide Section in the form
function HideSection( tabIndex , sectionIndex , displayType )

{
var tab2Hide = document.getElementById( "tab" + tabIndex );

tab2Hide.childNodes[0].rows[ sectionIndex ].style.display = displayType;

}

Wednesday, October 7, 2009

My First Resume

Today it was bit nostalgic when I came across the attached document , yes my first resume...

Still it wasn't as bad as the one's we see these days from a fresher :) ....
http://cid-f011f8adf411e549.skydrive.live.com/browse.aspx/My%20Share

what you say guys..

- Ajmal Ziyad