Hello Everyone,
I'm new to ribbon workbench.
when a user clicks on +new button then it should call my JavaScript.
I have installed Ribbon Workbench 2016.
I Selected Form ribbon, on new button I added new command, called my Js file and published it.
I'm still not able to trigger my JavaScript file.
please help me to fix this issue.
Thanks in Advance.
*This post is locked for comments
Hi Abby Kong,
thanks for reply.
Yes Abby now I'm able to trigger my javascript.
Is the script web resource published after changed?
yes.
Regards,
Siddhartha.
Hi Siddhartha,
It's strange. I tested your code, it actually works for me. Below is the screenshot of ribbon workbench and result. My user id does show in an alert, and after I close the alert popup, the new form is opened up.
Is the script web resource published after changed? If you add same JS Action to a command created by yourself, will it trigger?
Regards,
Abby
Hi Abby Kong,
This is Javascript function. I'm calling this from js file from Ribbon Workbench
function setLead() {
var userId = Xrm.Page.context.getUserId();
userId = userId.replace(/[{}]/g, "");
alert(userId);
}
Regards,
Siddhartha.
Hi Wei Jie Fun,
Its just a normal code which take information from one entity and append the fields info in lead entity when user clicks on +new button
Regards,
Siddhartha.
Hi Goutam Das,
Thanks for your reply.
We can add my custom js file before core js file does it works ??
Regards,
Siddhartha.
Hi Siddhartha,
What is your functions looks like? Does it have any parameters? If you do, please also remember to pass the parameters.
Also, refresh an opened page with CRTL+F5 after making changes and republish ribbons or js web resource.
It's best to share the function.
Or, try with a function really simple to make sure it triggers then replace code back.
like this function + command in the image give me
function setLead(id) { alert(id); }
Regards,
Abby
Hi,
Please share your js code.
Hi Abby Kong,
Thanks for your reply.
Yes I have done all these steps and published it, but it is not calling my Js file.
I have given my js file as well as function name.
Here is the screenshot.
Regards,
Siddhartha.
Hi Siddartha ,
Following Step you need to follow after install ribbon workbench.
- Create one test solution and include your entity , webresource (where you have mentioned on click event) in the solution.
- Open ribbon workbench , select the solution which you have created .
- Now go to the area Form , Subgrid , Home where you want to add your action , find the button.
- If its existing button then right click on button --Customize Button if its new button then also you can find this options.
- Now again right click on button just select - Customize Command. You can see the commands in command area highlighted in the above screenshot.
- Select the command and mapped web resource and your function.
- Don't forget to map the command to your button command properties. When you select the button in the Ribbon Workbench you can see command .
Hope this helps.
Hello Siddhartha,
You can add a custom button and call your scripts there, so in can lead out of the box button hidden, you can check my post here: http://himbap.com/blog/?p=1486
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6