Create ribbon button Dynamically in CRM 2011 - dynamics-crm

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.

Related

Dynamics CRM 365 seems to ignore default values for entity fields in quick create forms

For the contact entity I have set the default values for some build in fields to specific values. For example I set the default value for the field "Contact -> donotemail" to the value "Do not Allow".
In the "normal" web browser forms it seems to be working as expected.
But if I create a new contact using a quick create form and select the save and then "view created record" button the view switches to the new created contact.
If I then scroll down to the "donotemail" - field the field does not have the default value I selected in the field settings.
I googled the problem, the nearest community post I could find is
https://community.dynamics.com/crm/b/mohamedmostafacrmblog/archive/2016/06/02/set-field-default-value-in-microsoft-dynamics-crm-online-and-on-premise-using-business-rules-without-javascript-or-custom-components-plugins-or-workflows
Unfortunately the post is from 2016 and it describes how to workaround the problem using custom business rules. But due to this is build in funtionality there is no business rule I could edit and creating some new to achive the goal of setting a default value seems odd.
Did someone encounter this problem too and could find a solution?
One possible reason I could think of: you might have not refreshed the main window after publish all, maybe cached QC form didn’t work as expected bcoz “customize the system” will open a separate popup to edit & publish all.
Still technically server side should not be cached with old customizations. But QC might have rendered from cached Metadata in browser.
But publish all should reflect immediately & no delays expected. Make sure to refresh the main window next time :)

Dynamics CRM - Custom development

I'm completely new to the Dynamics CRM environment.
Within our current implementation, there is a grid which displays a list of current sales opportunities. Within this grid, there is a column for the user which is a link to another part of Dynamics. We want to instead be able to open a new window to another system. How can I customize how that link gets rendered out so that the client "onclick" function can link to a javascript function which will open a new window with the URL we need?
Please see attached:
Snapshot of Dynamics grid
Im afraid that this is not possible with supported customization.
My understanding is that you will keep URL to external system on entity and you would like to be able to open with single click from grid displaying this record?
However, Im not sure if you add this fields as single line of text with format option URL won`t work as expected. If this does not work, you would need a custom grid to display this data.
You can store url in text field with format URL, click on such field will open link in new window/tab.

Execute custom code in 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.

Joomla Custom Module Development - Backend administration Extra requirement

I am currently in the process of developing a custom joomla module for one of my client’s requirement. As part of the administration panel of that module, I have created a radio button group, well in that group; I have two more radio buttons
My question for you leaders in the web arena is I need an option that "should display extra fields when I select one of the radio buttons"
For example: I have a radio button group named as 'No of fields'. In that group, I have two radio buttons named as 'Show', 'Hide'. I need an option which should display extra fields, when I select 'show' radio button
Is this equation possible? If yes, please post me your thoughts
This kind of behavior is not provided as a part of Joomla's default administration functions. You'll have to code it yourself and call that JS file when the module is opened in the backend. I would recommend you check the code used in Mod_news_pro by Gavick. The module loads a custom JS file that add a lot of custom functions and layout options that wasn't available in Joomla.
It's quite simple, just create a custom element checkout the official docs:
http://docs.joomla.org/Creating_a_custom_form_field_type

CRM 2011 - New Appointment from Case defaults Required Attendees to Account

When I create a new appointment from the context of a saved incident it defaults the "Required Attendees" field to the incident's account. I want it to default to blank or the current user. (To create the appointment I used the navigation pane on the incident to view related activities then use the ribbon button add new activity.)
Where can I control that behaviour?
I tried looking at the entity mappings but it appears there isn't a "mappable" relationship for the "RequiredAttendees" field. (I checked as per the instructions here: http://rc.crm.dynamics.com/rc/2011/en-us/on-prem/5.0/help/ui_cust_Mapping.htm) Have I missed something or is this a hardcoded CRM-ism?
Going forward do I have any options to modify this? I suppose I could do javascript on form load but I'd prefer this be configurable inside CRM without touching javascript.
I think that best solution is to use onLoad javascript. Just check that Appointment is created from Incident form. (In Url - Type=112)
You can rewrite ribbon button on Incident form to open new window with URL
http://myCRM/myOrg/main.aspx?etc=4201&extraqs=%3fcontactInfo%3d%26etc%3d4201%26pId%3d%257bB8C55089-26D7-E111-93D4-005056986118%257d%26pName%3dCaseName%26pType%3d112%26pagemode%3diframe%26preloadcache%3d1346939630259&pagetype=entityrecord
So just exclude:
partyaddressused%3d%26
partyid%3d%257bA9D02C74-26D7-E111-93D4-05056986118%257d%26partyname%3dAdministrator%2540crm.local%26
partytype%3d2%26
This part of url contains data related to activity party ('required' field).

Resources