Answered by:
how to add button in CRM

Question
-
Hi,
I want to add buttton on entity. I could find few answers for this, I could not understand. Please help to add button on form by providing step by step details.
Regards,
Noushad
pnoushu@hotmail.com
Thursday, December 12, 2013 11:02 AM
Answers
-
Hello,
I would suggest to use Ribbon Workbench. Provided url contains How-To video.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blog- Proposed as answer by HIMBAPModerator Thursday, December 12, 2013 3:54 PM
- Marked as answer by P Noushad Sunday, December 22, 2013 6:25 AM
Thursday, December 12, 2013 11:07 AMModerator
All replies
-
Hello,
I would suggest to use Ribbon Workbench. Provided url contains How-To video.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blog- Proposed as answer by HIMBAPModerator Thursday, December 12, 2013 3:54 PM
- Marked as answer by P Noushad Sunday, December 22, 2013 6:25 AM
Thursday, December 12, 2013 11:07 AMModerator -
Hi,
Check below link using Visual Ribbon Editor Tool.
http://blogs.inkeysolutions.com/2012/01/crm-2011-how-to-use-visual-ribbon.html
Hope this helps
- Proposed as answer by HIMBAPModerator Thursday, December 12, 2013 3:55 PM
Thursday, December 12, 2013 11:22 AM -
Hi,
I want to send mail from custom entity by clicking on button. I created custom entity, button. When I click on the button it will call email activity. I did set up default subject as name of the account. But I could not set regarding field by default. I got error: Object expected when loading the form. Please help me to solve this issue.
I have got few solution but it did not work. Please find below the java code I have used for this.
1. I created 3 parameters. parameter_regardingid,parameter_regardingname,parameter_regardingtype on the form parameters as shown below screen-shot. Publish the form.
2. I added below java code in form onload of custom entity and publish
function Form_onload()
{var param=Xrm.Page.context.getQueryStringParameters();
var regardingId=param["parameter_regardingid"];
var regardingName=param["parameter_regardingname"];
var regardingType=param["parameter_regardingtype"];
if (regardingId != undefined)
{
Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);
}}
3. I added below java codes on button event.
function sendmail()
{var parameters = {};
var Regarding = Xrm.Page.getAttribute(“regardingobjectid”).getValue();
parameters["parameter_regardingid"] = Regarding[0].id;
parameters["parameter_regardingname"] = Regarding[0].name;
parameters["parameter_regardingtype"] = Regarding[0].entityType;
Xrm.Utility.openEntityForm("email",null,parameters);
}
pnoushu@hotmail.com
Thursday, December 19, 2013 1:40 PM -
Dear P Nousad,
1. Your initial question was "how to add button in CRM". I believe you have already got an answer that completely answers your initial question so spent a minute to close thread marking it as answered.
2. You have already asked regarding your second problem in threads
Please, don't create duplicated threads, repost your questions in different threads and so on.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blog- Marked as answer by P Noushad Sunday, December 22, 2013 6:26 AM
- Unmarked as answer by Andrii ButenkoMVP, Moderator Sunday, December 22, 2013 12:19 PM
Thursday, December 19, 2013 4:37 PMModerator -
Dear Andrii,
Thanks for giving solution to create button. It is workin fine and I can open email when click on this button. I set default parameter on subject like Sales inquire from Account Name. But I could not set default regarding parameter. I want to set regarding parameter of the custom entity or account as regarding parameter. So when the user click on the regarding they can go esily get account information. Please go through the below link and help me to find solution to set regarding of new email activity.
pnoushu@hotmail.com
- Marked as answer by P Noushad Sunday, December 22, 2013 11:07 AM
- Unmarked as answer by Andrii ButenkoMVP, Moderator Sunday, December 22, 2013 12:19 PM
Sunday, December 22, 2013 11:07 AM -
IN case youwant to add button on form create a multilinetext field add it ot form and remember that field schemaname
Now open form properties.
Create a javascript resource file with following code. new_validationbutton is your field name. ctrl.innerHTML=btn is actually replacing ctrl.innerHTML with button HTML code.
function contactsOnLoad(){ convertWebResourceToButton('new_validatebutton', 'Build Condition', '150px', '3px'); } function convertWebResourceToButton(fldName, btnLabel, btnWidth, leftMargin){ var btn = '<button id="btn_' + fldName + '" ' + ' style="margin-left:' + leftMargin + ';width:' + btnWidth + ';" ' + ' class="ms-crm-Button" ' + ' onmouseover="Mscrm.ButtonUtils.hoverOn(this);" ' + ' onmouseout="Mscrm.ButtonUtils.hoverOff(this);" ' + '>' + btnLabel + '</button>'; var ctrl = Xrm.Page.ui.controls.get(fldName)._control.get_element().childNodes[0]; // Replace controlewith buttom ctrl.innerHTML = btn; // Add Event to the newly created button ctrl.firstChild.attachEvent('onclick', ShowModal); return false; }
Thanks Regards Prashanth Kamasamudram Even the least work done for others awakens the power within; even thinking the least good of others gradually instills into the heart the strength of a lion.
Monday, December 23, 2013 3:06 PM