Execute custom code in CRM - dynamics-crm

Is there a way I can execute custom code in c# when a user clicks a button in the CRM application? I would like it a synchronous and asynchronous approach.
Actually something like when putting a button on a webform with a wired code behind click event handler.
And how can I add a button?
I want to display a list of report views the customer has assembled and access the report data in the CRM database.
It seems so complicated with CRM!
Here's an example of a custom workflow with a bunch of XAML. I dont know where they got it from.
Sample: Create a workflow in code

One way to go about it:
Use Ribbon WorkBench add add a button to the form. Only supported way of adding buttons to CRM is by editing ribbon XML.
Add an on click JavaScript Event Handler.
Call an Action which can be used to call a custom workflow where you can perform business logic.

Related

Button Click events with Dynamic actions in Oracle Apex

I have created an Edit button with associated Dynamic Action. In the dynamic action, set it to the Click event of the Edit button. I've created the actual action by reference to a JavaScript executing code. And then an update of the area.
In JavaScript code I wanted to enable items that are read only by pressing the edit button.
APEX_UTIL.PUBLIC_CHECK_AUTHORIZATION('ADMIN')
This was the check I made in the JavaScript code.
In this way I enabled edit mode for the region where I am applying.
ADMIN is a role.
How can I make the button click so that the items associated with the region that are just as read only, when clicking appear in an editable way?
In my opinion, you're reinventing the wheel.
OK, there's the ADMIN role (perhaps some other roles as well). If you know which user (identified by :APP_USER) has which role, then use
server-side condition (to decide whether to render (or process) certain page component (items, buttons, ...)
read only property (to decide whether user will be able to modify the value or not)
authorization scheme (under "Security")
So, there's no need for the EDIT button you currently have. Everything can be done declaratively by setting certain properties within Apex.
this function
APEX_UTIL.PUBLIC_CHECK_AUTHORIZATION('ADMIN')
is a plsql function, did you use it in your javascript code or as a server side condition?
you can make an ajax request to get the user role using that function and after getting the role in your javascript code you can disable/enable the items using the javascript api.
apex.item( "P1_ITEM" ).enable() ;

How to add custom forms in FullCalendar?

I have created forms in HTML (shown image below), and I want to integrate this form in FullCalendar. This form will show when I wanted to add new event. Can you give me some idea? If possible, can I do this without modifying the plugin?
You could put the form in a lightbox and show it, when the user clicks on a day. Fullcalendar provides an event for this: http://arshaw.com/fullcalendar/docs/mouse/dayClick/
Edit: Or what exactly do you mean by integrate?

Create ribbon button Dynamically in CRM 2011

Can any one help me to create a ribbon button dynamically in CRM 2011. The scenario is, when we create a record, one ribbon button has to be created dynamically based the optionset value selected in that record. Can we get it work using JScript or Plug-in or Workflow? Enable or Display rules are not useful here and should not touch XML code.
Quick principle: Ribbon Buttons are not a part the record, they are a part of the UI. You can make the UI change based on the record you are looking. Therefore you cannot 'add' a button to a record. You can add a button to an entity form.
Plugins definetly wont work here, they peform logic on the 'back-end'. JavaScript might work but I would expect this to be quite awkward. What you should do is edit the ribbon Xml. Now there is an excellent for editing the ribbon: Ribbon Workbench, this tool make it significantly easier to
edit the ribbon (this is editing the XML but this is the way its meant to be done).
Then I think you will need to
Create a ribbon button for each action.
Then follow this tutorial to enable and disable them: Enable/Disable a ribbon button dynamically based on a form value.
Using a display rule would be the right way to do this.
Create multiple buttons and set their display rule when selected option is equal
to the button's name.
We can get it done by two ways-
Through plug-in:(Note: It won't works in Sandbox mode and consume some time.)
Create one solution and add specified entity to it. Go through the source code here
Export this solution to Temp folder and unzip it.
Edit customizations.xml file to add our own RibbondiffXml tag.
Zip all the XML files and Import it to CRM.
Publish the Customization.
Through XML edit:
Export Application Ribbon, update XML to add button and replace entity name with {!EntityLogicalName} in all the places.
Ex: <CustomAction Id="New.{!EntityLogicalName}.MyButton.CustomAction" Location="Mscrm.HomepageGrid.{!EntityLogicalName}.MainTab.Management.Controls._children" Sequence="70">...
Add EnableRule to enable this button only if Config record exist for current entity.
<EnableRule Id="New.{!EntityLogicalName}.MyButton.Check">
<CustomRule FunctionName="checkConfigRecord" Library="$webresource:new_/Scripts/ValidateConfigRecords.js">
<CrmParameter Value="SelectedEntityTypeName" />
</CustomRule>
</EnableRule>
Create one JavaScript library with name new_/Scripts/ValidateConfigRecords.js which contains function checkConfigRecord which counts config records exists for particular entity. If count is greater than 1 return true. Otherwise false.
Import the ApplicationRibbon Zipped file
I ran into the same problem on Dynamics 365 and found a solution.
RibbonWorkbench includes a feature called "Fly Out Anchor Buttons"
This includes a property called PopulateQueryCommand.
You can use this command to dynamically (using JScript) add menu options to the Anchor Buttons at runtime.
The RibbonWorkbench documentation includes all the information you need to use this feature.

How to add an event to a Custom Control in Lotus Domino XPages?

I'm developing an Lotus XPages solution. I have a Custom Control that I would like to have additional functionality in the form of an event call-back.
Is it possible to create a JavaScript callback or event in a custom control? What I'd really like is to add events to one of my controls, something like OnSomething or querySomething and postSomething, so that when the event is fired, the code at the calling end is properly called.
Can it be done??
Thanks!

Using custom form in Outlook when creating a new mail message

I want to create a custom form in Outlook 2007 and then have that form be the form that comes up when the user clicks New / Mail Message in the toolbar. Is there a way to do that? I know how to create the custom form, but I don't know how to change what the menu item does.
Jon
If you are using an outlook form you can publish it to the Organizational Forms Library and the get you clients to use that new custom form instead of the default out the box form. It a registry change that points it to a new form. There are tools to do this change for you.
A good example http://www.petri.co.il/customizing_new_meeting_request_outlook_form.htm
76mel
There is a great tutorial by Ty Anderson on that located at devx on replacing the standard AppointmentItem inspector with a custom form.
Basically, you need to write code that gets triggered on the NewInspector event and display your form instead and cancel the standard inspector.

Resources